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

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

?? texture.c

?? 圖形學課件 圖形學課件 圖形學課件
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*    texture.c    Nate Robins, 1997    Tool for teaching about OpenGL texture.    */#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 texcoords[2*4] = {    { 1, 140, 370, -2.0, 2.0, 0.0, 0.01,        "Specifies S value of 1st texture coordinate", "%.1f" },    { 2, 190, 370, -2.0, 2.0, 0.0, 0.01,    "Specifies T value of 1st texture coordinate", "%.1f" },    { 3, 140, 400, -2.0, 2.0, 1.0, 0.01,    "Specifies S value of 2nd texture coordinate", "%.1f" },    { 4, 190, 400, -2.0, 2.0, 0.0, 0.01,    "Specifies T value of 2nd texture coordinate", "%.1f" },    { 5, 140, 430, -2.0, 2.0, 1.0, 0.01,    "Specifies S value of 3rd texture coordinate", "%.1f" },    { 6, 190, 430, -2.0, 2.0, 1.0, 0.01,    "Specifies T value of 3rd texture coordinate", "%.1f" },    { 7, 140, 460, -2.0, 2.0, 0.0, 0.01,    "Specifies S value of 4th texture coordinate", "%.1f" },    { 8, 190, 460, -2.0, 2.0, 1.0, 0.01,    "Specifies T value of 4th texture coordinate", "%.1f" },};cell vertices[3*4] = {    { 9, 350, 370, -2.0, 2.0, -1.0, 0.01,        "Specifies X coordinate of 1st vertex", "%.1f" },    { 10, 400, 370, -2.0, 2.0, -1.0, 0.01,    "Specifies Y coordinate of 1st vertex", "%.1f" },    { 11, 450, 370, -2.0, 2.0, 0.0, 0.01,    "Specifies Z coordinate of 1st vertex", "%.1f" },    { 12, 350, 400, -2.0, 2.0, 1.0, 0.01,    "Specifies X coordinate of 2nd vertex", "%.1f" },    { 13, 400, 400, -2.0, 2.0, -1.0, 0.01,    "Specifies Y coordinate of 2nd vertex", "%.1f" },    { 14, 450, 400, -2.0, 2.0, 0.0, 0.01,    "Specifies Z coordinate of 2nd vertex", "%.1f" },    { 15, 350, 430, -2.0, 2.0, 1.0, 0.01,    "Specifies X coordinate of 3rd vertex", "%.1f" },    { 16, 400, 430, -2.0, 2.0, 1.0, 0.01,    "Specifies Y coordinate of 3rd vertex", "%.1f" },    { 17, 450, 430, -2.0, 2.0, 0.0, 0.01,    "Specifies Z coordinate of 3rd vertex", "%.1f" },    { 18, 350, 460, -2.0, 2.0, -1.0, 0.01,    "Specifies X coordinate of 4th vertex", "%.1f" },    { 19, 400, 460, -2.0, 2.0, 1.0, 0.01,    "Specifies Y coordinate of 4th vertex", "%.1f" },    { 20, 450, 460, -2.0, 2.0, 0.0, 0.01,    "Specifies Z coordinate of 4th vertex", "%.1f" },};GLenum minfilter = GL_NEAREST;GLenum magfilter = GL_NEAREST;GLenum env = GL_MODULATE;GLenum wraps = GL_REPEAT;GLenum wrapt = GL_REPEAT;cell translation[3] = {    { 21, 120, 90, -5.0, 5.0, 0.0, 0.01,        "Specifies X coordinate of translation vector.", "%.2f" },    { 22, 180, 90, -5.0, 5.0, 0.0, 0.01,    "Specifies Y coordinate of translation vector.", "%.2f" },    { 23, 240, 90, -5.0, 5.0, 0.0, 0.01,    "Specifies Z coordinate of translation vector.", "%.2f" },};cell rotation[4] = {    { 24, 120, 120, -360.0, 360.0, 0.0, 1.0,        "Specifies angle of rotation, in degrees.", "%.1f" },    { 25, 180, 120, -1.0, 1.0, 0.0, 0.01,    "Specifies X coordinate of vector to rotate about.", "%.2f" },    { 26, 240, 120, -1.0, 1.0, 0.0, 0.01,    "Specifies Y coordinate of vector to rotate about.", "%.2f" },    { 27, 300, 120, -1.0, 1.0, 1.0, 0.01,    "Specifies Z coordinate of vector to rotate about.", "%.2f" },};cell scale[3] = {    { 28, 120, 150, -5.0, 5.0, 1.0, 0.01,        "Specifies scale factor along X axis.", "%.2f" },    { 29, 180, 150, -5.0, 5.0, 1.0, 0.01,    "Specifies scale factor along Y axis.", "%.2f" },    { 30, 240, 150, -5.0, 5.0, 1.0, 0.01,    "Specifies scale factor along Z axis.", "%.2f" },};cell pcolor[4] = {    { 31, 120, 310, 0.0, 1.0, 0.6, 0.01,        "Specifies red component of polygon color.", "%.2f" },    { 32, 180, 310, 0.0, 1.0, 0.6, 0.01,    "Specifies green component of polygon color.", "%.2f" },    { 33, 240, 310, 0.0, 1.0, 0.6, 0.01,    "Specifies blue component of polygon color.", "%.2f" },    { 34, 300, 310, 0.0, 1.0, 1.0, 0.01,    "Specifies alpha component of polygon color.", "%.2f" },};cell bcolor[4] = {    { 39, 240, 30, 0.0, 1.0, 1.0, 0.01,        "Specifies red component of texture border color.", "%.2f" },    { 40, 300, 30, 0.0, 1.0, 0.0, 0.01,    "Specifies green component of texture border color.", "%.2f" },    { 41, 360, 30, 0.0, 1.0, 0.0, 0.01,    "Specifies blue component of texture border color.", "%.2f" },    { 42, 420, 30, 0.0, 1.0, 1.0, 0.01,    "Specifies alpha component of texture border color.", "%.2f" },};cell ecolor[4] = {    { 35, 240, 60, 0.0, 1.0, 0.0, 0.01,        "Specifies red component of texture environment color.", "%.2f" },    { 36, 300, 60, 0.0, 1.0, 1.0, 0.01,    "Specifies green component of texture environment color.", "%.2f" },    { 37, 360, 60, 0.0, 1.0, 0.0, 0.01,    "Specifies blue component of texture environment color.", "%.2f" },    { 38, 420, 60, 0.0, 1.0, 1.0, 0.01,    "Specifies alpha component of texture environment color.", "%.2f" },};GLfloat eye[3] = { 0.0, 0.0, 3.0 };GLfloat at[3]  = { 0.0, 0.0, 0.0 };GLfloat up[3]  = { 0.0, 1.0, 0.0 };void redisplay_all(void);GLuint window, world, screen, command;GLuint sub_width = 256, sub_height = 256;GLint selection = 0;GLfloat spin_x = 0.0;GLfloat spin_y = 0.0;int iheight, iwidth;unsigned char* image = NULL;int twidth, theight;int stipple;#if defined(GL_VERSION_1_1)#define GL_REPLACE_EXT GL_REPLACE#endifGLvoid *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, 525, 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+50 &&        y > cell->y-20 && 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;}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');}voidtexenv(void){    GLfloat env_color[4], border_color[4];        cell_vector(env_color, ecolor, 4);    cell_vector(border_color, bcolor, 4);        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magfilter);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wraps);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapt);    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env);    glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color);    glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_color);}voidtexture(void){    texenv();    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, iwidth, iheight, GL_RGB, GL_UNSIGNED_BYTE, image);}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)/3;    sub_height = (height-GAP*3)/2;        glutSetWindow(screen);    glutPositionWindow(GAP, GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(world);    glutPositionWindow(GAP, GAP+sub_height+GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(command);    glutPositionWindow(GAP+sub_width+GAP, GAP);    glutReshapeWindow(sub_width*2, sub_height*2+GAP);}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, "Screen-space view");    drawstr(GAP+sub_width+GAP, GAP-5, "Command manipulation window");    drawstr(GAP, GAP+sub_height+GAP-5, "Texture-space view");    glutSwapBuffers();}voidworld_reshape(int width, int height){    twidth = width;    theight = height;        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wraps);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapt);    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);        glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    glOrtho(0, width, 0, height, -1, 1);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    glClearColor(0.0, 0.0, 0.0, 1.0);    glDisable(GL_DEPTH_TEST);    glEnable(GL_LIGHT0);}voidworld_display(void){    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    glOrtho(0, twidth, 0, theight, -1, 1);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );    glColor3ub(255, 255, 255);        glEnable(GL_TEXTURE_2D);    glEnable(GL_LIGHTING);        glBegin(GL_POLYGON);    glTexCoord2f(-0.5, -0.5);    glVertex2i(0, 0);    glTexCoord2f(1.5, -0.5);    glVertex2i(twidth, 0);    glTexCoord2f(1.5, 1.5);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99国产精品久久99| 日韩毛片高清在线播放| 久久99久国产精品黄毛片色诱| 欧美片网站yy| 裸体一区二区三区| 久久一日本道色综合| 国产成人精品影院| 国产精品视频麻豆| 色老汉av一区二区三区| 日韩精品乱码免费| 欧美精品一区视频| 成人动漫一区二区在线| 一区二区三区日韩欧美精品| 国产高清不卡一区| 亚洲免费资源在线播放| 7777精品伊人久久久大香线蕉超级流畅 | 国产精品911| 中文字幕一区二区三区不卡 | 国产激情一区二区三区四区| 亚洲国产高清aⅴ视频| 欧美亚洲动漫制服丝袜| 六月丁香婷婷久久| 国产精品福利一区| 91麻豆精品国产91久久久久久久久 | 9191成人精品久久| 国产精选一区二区三区| 亚洲精品伦理在线| 日韩精品中文字幕在线不卡尤物| 国产999精品久久| 亚洲综合区在线| 精品乱码亚洲一区二区不卡| 99国产精品久久久久久久久久久 | 久久国产尿小便嘘嘘尿| 国产精品卡一卡二| 69堂亚洲精品首页| www.一区二区| 久久国产免费看| 亚洲午夜久久久久| 欧美国产精品一区二区| 日韩一区二区中文字幕| 91农村精品一区二区在线| 精品一二三四在线| 亚洲成人av福利| 国产精品美女www爽爽爽| 欧美一区二区在线免费观看| 成人av在线资源网站| 久久精品国产久精国产爱| 亚洲综合免费观看高清在线观看 | 中文字幕中文字幕一区| 欧美xxxxxxxx| 欧美视频一区二区三区在线观看| 国产精品正在播放| 麻豆91在线播放免费| 亚洲国产精品精华液网站| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 丁香网亚洲国际| 日本免费新一区视频| 一区二区三区在线视频免费| 中文在线一区二区| 久久亚洲一区二区三区明星换脸| 欧美精品乱人伦久久久久久| 日本久久一区二区| 91丨porny丨中文| 成人午夜在线播放| 国产精品99精品久久免费| 精品一区二区三区不卡| 日本不卡一二三| 三级欧美在线一区| 日本成人中文字幕在线视频| 亚洲动漫第一页| 亚洲香蕉伊在人在线观| 亚洲一二三专区| 亚洲精品高清视频在线观看| 亚洲天堂网中文字| 一区二区三区四区中文字幕| 一区二区三区在线视频观看58| 亚洲精品免费在线观看| 亚洲色图一区二区三区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 在线视频你懂得一区二区三区| 91视视频在线观看入口直接观看www | 1区2区3区欧美| 亚洲免费在线观看| 一区二区日韩av| 亚洲国产精品久久人人爱 | 日韩一区二区电影在线| 日韩视频一区二区三区| 日韩欧美视频在线| 亚洲精品一区二区三区福利| 久久一区二区三区四区| 中文字幕av一区二区三区高| 最新日韩在线视频| 亚洲综合激情网| 日本特黄久久久高潮| 久久精品国产亚洲高清剧情介绍 | 日本一区二区高清| 亚洲嫩草精品久久| 三级精品在线观看| 国产精品99久久久久| 91免费视频观看| 欧美一区二区免费观在线| 亚洲精品一区二区三区精华液 | 久久久亚洲午夜电影| 国产精品亲子伦对白| 亚洲免费观看在线观看| 肉肉av福利一精品导航| 国产精品影视在线观看| a级精品国产片在线观看| 欧美日韩精品专区| 久久综合九色综合欧美98| 中文字幕中文字幕在线一区| 亚洲国产欧美在线人成| 精品亚洲免费视频| 99久久婷婷国产综合精品| 欧美一区二区精品在线| 中文子幕无线码一区tr| 3d成人动漫网站| 国产成人三级在线观看| 亚洲视频图片小说| 精品成a人在线观看| 91蝌蚪国产九色| 视频一区免费在线观看| 91美女视频网站| 国产女人18毛片水真多成人如厕| 在线观看免费亚洲| 欧美一区二区三区成人| 国产精品久久久久久久岛一牛影视| 夜夜精品浪潮av一区二区三区| 久久99九九99精品| 欧美在线不卡一区| 中文字幕不卡在线观看| 日韩av成人高清| 91黄色激情网站| 中文文精品字幕一区二区| 偷偷要91色婷婷| 99久久精品国产观看| 久久一留热品黄| 日本不卡一区二区三区| 色综合网色综合| 国产人久久人人人人爽| 蜜桃av一区二区三区| 在线观看日韩高清av| 国产精品久久三区| 国产剧情一区在线| 日韩视频免费观看高清在线视频| 综合久久国产九一剧情麻豆| 国产一区二区三区四区五区美女 | 午夜一区二区三区在线观看| 成人av影视在线观看| xnxx国产精品| 蜜桃av一区二区| 欧美一级二级三级乱码| 一区二区三区欧美在线观看| 成人a免费在线看| 国产欧美一区二区在线观看| 精品一区二区国语对白| 欧美一区二区三区电影| 日韩主播视频在线| 在线播放国产精品二区一二区四区| 亚洲欧美日韩国产另类专区| 成人av免费观看| 国产精品久久久久久久久免费丝袜| 国产高清不卡一区二区| 久久精品亚洲精品国产欧美kt∨| 精品亚洲porn| 国产亚洲精品精华液| 国产高清不卡一区| 国产精品无码永久免费888| 国产+成+人+亚洲欧洲自线| 欧美国产精品久久| 99精品黄色片免费大全| 亚洲乱码精品一二三四区日韩在线| 91在线看国产| 一区二区三区四区蜜桃 | 成人国产电影网| 自拍偷自拍亚洲精品播放| av影院午夜一区| 一区二区三区四区在线播放| 欧美视频中文字幕| 免费成人美女在线观看| 欧美电影免费观看高清完整版 | 一区二区三区**美女毛片| 在线观看区一区二| 日本欧美一区二区在线观看| 欧美变态口味重另类| 国产一区 二区| 国产精品久久久久影院老司| 色爱区综合激月婷婷| 日韩国产欧美在线播放| 欧美成人女星排名| 成人免费视频app| 亚洲男人电影天堂| 欧美精品久久天天躁| 久久成人综合网| 亚洲欧洲韩国日本视频| 欧美午夜视频网站| 韩国理伦片一区二区三区在线播放| 国产日韩欧美精品电影三级在线| 不卡一区二区中文字幕| 香蕉影视欧美成人|