亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? projection.c

?? OpenGL的大海量資料收集
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*    projection.c    Nate Robins, 1997    Tool for teaching about OpenGL projections.    */#include <math.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <GL/glut.h>#include "glm.h"
#pragma comment( linker, "/entry:\"mainCRTStartup\"" )  // set the entry point to be main()
typedef struct _cell {    int id;    int x, y;    float min, max;    float value;    float step;    char* info;    char* format;} cell;cell lookat[9] = {    { 1, 180, 120, -5.0, 5.0, 0.0, 0.1,        "Specifies the X position of the eye point.", "%.2f" },    { 2, 240, 120, -5.0, 5.0, 0.0, 0.1,    "Specifies the Y position of the eye point.", "%.2f" },    { 3, 300, 120, -5.0, 5.0, 2.0, 0.1,    "Specifies the Z position of the eye point.", "%.2f" },    { 4, 180, 160, -5.0, 5.0, 0.0, 0.1,    "Specifies the X position of the reference point.", "%.2f" },    { 5, 240, 160, -5.0, 5.0, 0.0, 0.1,    "Specifies the Y position of the reference point.", "%.2f" },    { 6, 300, 160, -5.0, 5.0, 0.0, 0.1,    "Specifies the Z position of the reference point.", "%.2f" },    { 7, 180, 200, -2.0, 2.0, 0.0, 0.1,    "Specifies the X direction of the up vector.", "%.2f" },    { 8, 240, 200, -2.0, 2.0, 1.0, 0.1,    "Specifies the Y direction of the up vector.", "%.2f" },    { 9, 300, 200, -2.0, 2.0, 0.0, 0.1,    "Specifies the Z direction of the up vector.", "%.2f" },};cell perspective[4] = {    { 10, 180, 80, 1.0, 179.0, 60.0, 1.0,        "Specifies field of view angle (in degrees) in y direction.", "%.1f" },    { 11, 240, 80, -3.0, 3.0, 1.0, 0.01,    "Specifies field of view in x direction (width/height).", "%.2f" },    { 12, 300, 80, 0.1, 10.0, 1.0, 0.05,    "Specifies distance from viewer to near clipping plane.", "%.1f" },    { 13, 360, 80, 0.1, 10.0, 10.0, 0.05,    "Specifies distance from viewer to far clipping plane.", "%.1f" },};cell frustum[6] = {    { 14, 120, 80, -10.0, 10.0, -1.0, 0.1,        "Specifies coordinate for left vertical clipping plane.", "%.2f" },    { 15, 180, 80, -10.0, 10.0, 1.0, 0.1,    "Specifies coordinate for right vertical clipping plane.", "%.2f" },    { 16, 240, 80, -10.0, 10.0, -1.0, 0.1,    "Specifies coordinate for bottom vertical clipping plane.", "%.2f" },    { 17, 300, 80, -10.0, 10.0, 1.0, 0.1,    "Specifies coordinate for top vertical clipping plane.", "%.2f" },    { 18, 360, 80, 0.1, 5.0, 1.0, 0.01,    "Specifies distance to near clipping plane.", "%.2f" },    { 19, 420, 80, 0.1, 5.0, 3.5, 0.01,    "Specifies distance to far clipping plane.", "%.2f" },};cell ortho[6] = {    { 14, 120, 80, -10.0, 10.0, -1.0, 0.1,        "Specifies coordinate for left vertical clipping plane.", "%.2f" },    { 15, 180, 80, -10.0, 10.0, 1.0, 0.1,    "Specifies coordinate for right vertical clipping plane.", "%.2f" },    { 16, 240, 80, -10.0, 10.0, -1.0, 0.1,    "Specifies coordinate for bottom vertical clipping plane.", "%.2f" },    { 17, 300, 80, -10.0, 10.0, 1.0, 0.1,    "Specifies coordinate for top vertical clipping plane.", "%.2f" },    { 18, 360, 80, -5.0, 5.0, 1.0, 0.01,    "Specifies distance to near clipping plane.", "%.2f" },    { 19, 420, 80, -5.0, 5.0, 3.5, 0.01,    "Specifies distance to far clipping plane.", "%.2f" },};enum {    PERSPECTIVE, FRUSTUM, ORTHO} mode = PERSPECTIVE;GLboolean world_draw = GL_TRUE;GLMmodel* pmodel = NULL;GLint selection = 0;void redisplay_all(void);GLdouble projection[16], modelview[16], inverse[16];GLuint window, world, screen, command;GLuint sub_width = 256, sub_height = 256;GLvoid *font_style = GLUT_BITMAP_TIMES_ROMAN_10;voidsetfont(char* name, int size){    font_style = GLUT_BITMAP_HELVETICA_10;    if (strcmp(name, "helvetica") == 0) {        if (size == 12)             font_style = GLUT_BITMAP_HELVETICA_12;        else if (size == 18)            font_style = GLUT_BITMAP_HELVETICA_18;    } else if (strcmp(name, "times roman") == 0) {        font_style = GLUT_BITMAP_TIMES_ROMAN_10;        if (size == 24)            font_style = GLUT_BITMAP_TIMES_ROMAN_24;    } else if (strcmp(name, "8x13") == 0) {        font_style = GLUT_BITMAP_8_BY_13;    } else if (strcmp(name, "9x15") == 0) {        font_style = GLUT_BITMAP_9_BY_15;    }}void drawstr(GLuint x, GLuint y, char* format, ...){    va_list args;    char buffer[255], *s;        va_start(args, format);    vsprintf(buffer, format, args);    va_end(args);        glRasterPos2i(x, y);    for (s = buffer; *s; s++)        glutBitmapCharacter(font_style, *s);}voidcell_draw(cell* cell){    glColor3ub(0, 255, 128);    if (selection == cell->id) {        glColor3ub(255, 255, 0);        drawstr(10, 240, cell->info);        glColor3ub(255, 0, 0);    }        drawstr(cell->x, cell->y, cell->format, cell->value);}intcell_hit(cell* cell, int x, int y){    if (x > cell->x && x < cell->x + 60 &&        y > cell->y-30 && y < cell->y+10)        return cell->id;    return 0;}voidcell_update(cell* cell, int update){    if (selection != cell->id)        return;        cell->value += update * cell->step;        if (cell->value < cell->min)        cell->value = cell->min;    else if (cell->value > cell->max)         cell->value = cell->max;    }voidcell_vector(float* dst, cell* cell, int num){    while (--num >= 0)        dst[num] = cell[num].value;}voiddrawmodel(void){    if (!pmodel) {        pmodel = glmReadOBJ("data/al.obj");        if (!pmodel) exit(0);        glmUnitize(pmodel);        glmFacetNormals(pmodel);        glmVertexNormals(pmodel, 90.0);    }        glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL);}voiddrawaxes(void){    glColor3ub(255, 0, 0);    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(1.0, 0.0, 0.0);    glVertex3f(0.75, 0.25, 0.0);    glVertex3f(0.75, -0.25, 0.0);    glVertex3f(1.0, 0.0, 0.0);    glVertex3f(0.75, 0.0, 0.25);    glVertex3f(0.75, 0.0, -0.25);    glVertex3f(1.0, 0.0, 0.0);    glEnd();    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(0.0, 1.0, 0.0);    glVertex3f(0.0, 0.75, 0.25);    glVertex3f(0.0, 0.75, -0.25);    glVertex3f(0.0, 1.0, 0.0);    glVertex3f(0.25, 0.75, 0.0);    glVertex3f(-0.25, 0.75, 0.0);    glVertex3f(0.0, 1.0, 0.0);    glEnd();    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(0.0, 0.0, 1.0);    glVertex3f(0.25, 0.0, 0.75);    glVertex3f(-0.25, 0.0, 0.75);    glVertex3f(0.0, 0.0, 1.0);    glVertex3f(0.0, 0.25, 0.75);    glVertex3f(0.0, -0.25, 0.75);    glVertex3f(0.0, 0.0, 1.0);    glEnd();        glColor3ub(255, 255, 0);    glRasterPos3f(1.1, 0.0, 0.0);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'x');    glRasterPos3f(0.0, 1.1, 0.0);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'y');    glRasterPos3f(0.0, 0.0, 1.1);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'z');}voididentity(GLdouble m[16]){    m[0+4*0] = 1; m[0+4*1] = 0; m[0+4*2] = 0; m[0+4*3] = 0;    m[1+4*0] = 0; m[1+4*1] = 1; m[1+4*2] = 0; m[1+4*3] = 0;    m[2+4*0] = 0; m[2+4*1] = 0; m[2+4*2] = 1; m[2+4*3] = 0;    m[3+4*0] = 0; m[3+4*1] = 0; m[3+4*2] = 0; m[3+4*3] = 1;}GLbooleaninvert(GLdouble src[16], GLdouble inverse[16]){    double t;    int i, j, k, swap;    GLdouble tmp[4][4];        identity(inverse);        for (i = 0; i < 4; i++) {        for (j = 0; j < 4; j++) {            tmp[i][j] = src[i*4+j];        }    }        for (i = 0; i < 4; i++) {        /* look for largest element in column. */        swap = i;        for (j = i + 1; j < 4; j++) {            if (fabs(tmp[j][i]) > fabs(tmp[i][i])) {                swap = j;            }        }                if (swap != i) {            /* swap rows. */            for (k = 0; k < 4; k++) {                t = tmp[i][k];                tmp[i][k] = tmp[swap][k];                tmp[swap][k] = t;                                t = inverse[i*4+k];                inverse[i*4+k] = inverse[swap*4+k];                inverse[swap*4+k] = t;            }        }                if (tmp[i][i] == 0) {        /* no non-zero pivot.  the matrix is singular, which           shouldn't happen.  This means the user gave us a bad            matrix. */            return GL_FALSE;        }                t = tmp[i][i];        for (k = 0; k < 4; k++) {            tmp[i][k] /= t;            inverse[i*4+k] /= t;        }        for (j = 0; j < 4; j++) {            if (j != i) {                t = tmp[j][i];                for (k = 0; k < 4; k++) {                    tmp[j][k] -= tmp[i][k]*t;                    inverse[j*4+k] -= inverse[i*4+k]*t;                }            }        }    }    return GL_TRUE;}floatnormalize(float* v){    float length;        length = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);    v[0] /= length;    v[1] /= length;    v[2] /= length;        return length;}voidmain_reshape(int width,  int height) {    glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    gluOrtho2D(0, width, height, 0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    #define GAP  25             /* gap between subwindows */    sub_width = (width-GAP*3)/2.0;    sub_height = (height-GAP*3)/2.0;        glutSetWindow(world);    glutPositionWindow(GAP, GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(screen);    glutPositionWindow(GAP+sub_width+GAP, GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(command);    glutPositionWindow(GAP, GAP+sub_height+GAP);    glutReshapeWindow(sub_width+GAP+sub_width, sub_height);}voidmain_display(void){    glClearColor(0.8, 0.8, 0.8, 0.0);    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glColor3ub(0, 0, 0);    setfont("helvetica", 12);    drawstr(GAP, GAP-5, "World-space view");    drawstr(GAP+sub_width+GAP, GAP-5, "Screen-space view");    drawstr(GAP, GAP+sub_height+GAP-5, "Command manipulation window");    glutSwapBuffers();}voidmain_keyboard(unsigned char key, int x, int y){    switch (key) {    case 'p':        mode = PERSPECTIVE;        break;    case 'o':        mode = ORTHO;        break;    case 'f':        mode = FRUSTUM;        break;    case 'r':        perspective[0].value = 60.0;        perspective[1].value = 1.0;        perspective[2].value = 1.0;        perspective[3].value = 10.0;        ortho[0].value = -1.0;        ortho[1].value = 1.0;        ortho[2].value = -1.0;        ortho[3].value = 1.0;        ortho[4].value = 1.0;        ortho[5].value = 3.5;        frustum[0].value = -1.0;        frustum[1].value = 1.0;        frustum[2].value = -1.0;        frustum[3].value = 1.0;        frustum[4].value = 1.0;        frustum[5].value = 3.5;        lookat[0].value = 0.0;        lookat[1].value = 0.0;        lookat[2].value = 2.0;        lookat[3].value = 0.0;        lookat[4].value = 0.0;        lookat[5].value = 0.0;        lookat[6].value = 0.0;        lookat[7].value = 1.0;        lookat[8].value = 0.0;        break;    case 27:        exit(0);    }        redisplay_all();}voidworld_reshape(int width, int height){    glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    gluPerspective(60.0, (GLfloat)width/height, 1.0, 256.0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    glTranslatef(0.0, 0.0, -5.0);    glRotatef(-45.0, 0.0, 1.0, 0.0);    glClearColor(0.0, 0.0, 0.0, 0.0);    glEnable(GL_DEPTH_TEST);    glEnable(GL_LIGHT0);}voidworld_display(void){    GLfloat light_pos[] = { 0.0, 0.0, 1.0, 0.0 };    double length;    float l[3];        l[0] = lookat[3].value - lookat[0].value;     l[1] = lookat[4].value - lookat[1].value;     l[2] = lookat[5].value - lookat[2].value;    length = normalize(l);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲 欧美综合在线网络| 亚洲国产精品成人久久综合一区| 国产精品护士白丝一区av| 蜜臀a∨国产成人精品| av动漫一区二区| 精品国产一区a| 首页亚洲欧美制服丝腿| 97国产一区二区| 国产午夜精品一区二区| 日本美女一区二区| 在线看一区二区| 国产精品乱人伦一区二区| 久久精品噜噜噜成人av农村| 欧美亚洲丝袜传媒另类| 国产精品久久久久一区| 激情六月婷婷综合| 欧美一区二区三区不卡| 亚洲成人av电影在线| 99久久婷婷国产综合精品 | 国产精品66部| 91精选在线观看| 亚洲在线中文字幕| 97se狠狠狠综合亚洲狠狠| 国产欧美日韩不卡免费| 国产精品影视在线观看| 欧美变态口味重另类| 日本欧美在线看| 欧美一区二区三区人| 水蜜桃久久夜色精品一区的特点| 精品视频在线免费| 午夜精品一区二区三区电影天堂| 欧美伊人久久久久久久久影院 | 亚洲日本电影在线| 成人黄动漫网站免费app| 国产色一区二区| 国产精品羞羞答答xxdd| 久久精品一二三| 国产成人免费视频精品含羞草妖精 | 日韩中文字幕区一区有砖一区| 欧美在线观看一二区| 一个色在线综合| 色猫猫国产区一区二在线视频| 亚洲卡通欧美制服中文| 色综合一区二区| 亚洲精品视频自拍| 在线精品视频一区二区| 亚洲一区av在线| 欧美精品第一页| 日本不卡一区二区三区| 日韩视频一区二区三区在线播放| 免费欧美高清视频| 精品久久人人做人人爰| 欧美日韩一区三区| 亚洲高清视频在线| 欧美精品久久天天躁| 毛片基地黄久久久久久天堂| 日韩限制级电影在线观看| 美女网站一区二区| 精品国产凹凸成av人导航| 国产一区二区调教| 中文字幕一区二区日韩精品绯色| 日本精品视频一区二区| 亚洲成人av一区二区| 日韩免费看的电影| 国产成人综合精品三级| 亚洲欧洲精品成人久久奇米网| 在线免费观看视频一区| 免费高清不卡av| 国产欧美日韩在线| 91网站在线播放| 亚洲国产日韩精品| 精品国产乱码久久久久久1区2区 | 精品一区二区三区欧美| 国产女人aaa级久久久级| 91视频国产资源| 丝袜诱惑亚洲看片| 国产午夜亚洲精品理论片色戒 | 国产91精品一区二区麻豆亚洲| 国产精品久久看| 6080国产精品一区二区| 国产曰批免费观看久久久| 中文字幕一区视频| 欧美一级日韩一级| 成人午夜免费电影| 亚洲国产日韩综合久久精品| www亚洲一区| 91高清在线观看| 捆绑变态av一区二区三区| 亚洲国产精品成人久久综合一区| 欧美色精品在线视频| 国产精品99久久久久久有的能看| 一区二区日韩电影| 26uuu成人网一区二区三区| 色香蕉成人二区免费| 国产在线精品一区二区不卡了 | 国产精品免费视频观看| 欧美日本不卡视频| 国产精品一区二区久激情瑜伽| 亚洲男人的天堂一区二区| 日韩美女主播在线视频一区二区三区| 成人精品高清在线| 麻豆精品一区二区av白丝在线| 国产精品护士白丝一区av| 6080亚洲精品一区二区| av一二三不卡影片| 老司机精品视频一区二区三区| 亚洲精品国久久99热| 久久综合狠狠综合久久激情 | bt7086福利一区国产| 日本成人在线视频网站| 玉足女爽爽91| 中文字幕不卡三区| 精品久久久久一区| 国产精品女主播在线观看| 欧美日韩在线精品一区二区三区激情 | 国产欧美一区二区精品忘忧草| 欧美日韩一区二区在线观看视频 | 久久不见久久见免费视频7| 亚洲人亚洲人成电影网站色| 欧美不卡123| 欧美精品少妇一区二区三区| 99视频一区二区| 国精产品一区一区三区mba视频| 亚洲午夜日本在线观看| 国产精品久久看| 国产午夜亚洲精品羞羞网站| 日韩一二在线观看| 欧美日韩国产小视频| 91色在线porny| 成人综合婷婷国产精品久久蜜臀| 看国产成人h片视频| 日本中文字幕不卡| 亚洲成人午夜电影| 一区二区三区四区不卡在线| 中文字幕在线一区免费| 国产校园另类小说区| 亚洲精品一区二区三区99| 8x福利精品第一导航| 欧洲av在线精品| 色欧美日韩亚洲| 色综合久久综合网97色综合 | 日韩成人免费在线| 亚洲成av人在线观看| 一区二区三区在线播| 亚洲精品国产精品乱码不99 | 欧美伦理视频网站| 欧美艳星brazzers| 欧美性猛交xxxxxx富婆| 欧美主播一区二区三区美女| 91在线视频观看| thepron国产精品| 99精品视频一区二区| 成人午夜视频在线观看| 波多野结衣91| 91麻豆免费观看| 在线一区二区三区四区| 一本久久精品一区二区| 日本久久一区二区三区| 在线观看日韩国产| 欧美日免费三级在线| 欧美视频中文一区二区三区在线观看 | 日韩极品在线观看| 日韩经典一区二区| 开心九九激情九九欧美日韩精美视频电影| 日本亚洲天堂网| 久久se精品一区精品二区| 久久99精品国产.久久久久久| 极品美女销魂一区二区三区免费| 精品亚洲国产成人av制服丝袜| 国产乱色国产精品免费视频| 国产成人精品亚洲午夜麻豆| 成人黄色电影在线| 91久久精品午夜一区二区| 欧美日韩中文另类| 欧美一区二区黄色| 久久久噜噜噜久久人人看| 国产精品全国免费观看高清| 亚洲视频小说图片| 亚洲超碰97人人做人人爱| 麻豆国产精品一区二区三区| 国产综合久久久久影院| 成人免费毛片a| 色噜噜狠狠色综合中国| 欧美日产在线观看| 精品国产一区二区在线观看| 国产精品乱人伦中文| 亚洲一区二区不卡免费| 麻豆一区二区在线| 成人激情午夜影院| 欧美日韩一区高清| 欧美精品一区二区在线观看| 亚洲婷婷国产精品电影人久久| 亚洲第一综合色| 国产伦精品一区二区三区在线观看| 成人av第一页| 91.麻豆视频| 国产精品麻豆欧美日韩ww| 午夜国产精品一区| 国产精品一区二区久久不卡| 91老师片黄在线观看|