亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91免费版pro下载短视频| 日韩久久久久久| 日韩欧美精品在线视频| 国产精品美日韩| 人人爽香蕉精品| 色综合中文字幕国产 | 国产精品久久看| 亚洲国产精品久久久男人的天堂 | 99re在线精品| 久久综合999| 免费不卡在线观看| 欧美三级资源在线| 日韩理论电影院| 成人av资源在线| 2017欧美狠狠色| 日本成人超碰在线观看| 在线观看免费成人| 亚洲欧洲制服丝袜| 成人av网在线| 国产日韩欧美不卡| 国产一区不卡视频| 日韩一区二区三区三四区视频在线观看| 国产精品伦一区二区三级视频| 国内成+人亚洲+欧美+综合在线| 欧美日韩精品三区| 亚洲18色成人| 欧美日韩国产一二三| 亚洲第一二三四区| 欧美一区午夜视频在线观看| 日韩精品欧美精品| 日韩一区二区三区观看| 日本欧美一区二区三区乱码| 欧美一二三四区在线| 午夜欧美大尺度福利影院在线看| 欧美无人高清视频在线观看| 亚洲一区二区三区四区不卡| 欧美人伦禁忌dvd放荡欲情| 亚洲午夜激情网页| 欧美一区二区三区精品| 麻豆成人av在线| 久久亚洲精华国产精华液 | 色婷婷综合五月| 亚洲精品中文字幕乱码三区| 在线亚洲一区二区| 亚洲国产综合91精品麻豆| 欧美日韩大陆一区二区| 麻豆精品一二三| 亚洲国产高清不卡| 在线免费不卡视频| 日韩av一级片| 久久精品这里都是精品| 91在线视频18| 图片区小说区国产精品视频| 日韩精品一区在线| 懂色中文一区二区在线播放| 一区二区视频在线看| 欧美一区二区日韩一区二区| 国产高清成人在线| 亚洲一区二区三区视频在线播放 | 亚洲少妇屁股交4| 在线看日本不卡| 精品一区二区三区在线观看| 国产精品久久久久久久久免费相片 | 国产精品毛片久久久久久| 91蝌蚪porny| 开心九九激情九九欧美日韩精美视频电影 | 欧美日韩高清一区二区不卡| 久久97超碰国产精品超碰| 国产精品免费久久| 在线成人午夜影院| 成人黄色在线视频| 日韩电影一二三区| 亚洲婷婷国产精品电影人久久| 欧美日韩1区2区| 成人深夜福利app| 日韩精品国产欧美| 亚洲欧洲一区二区三区| 日韩欧美在线观看一区二区三区| 成年人国产精品| 裸体在线国模精品偷拍| 亚洲久草在线视频| 国产午夜精品一区二区三区四区| 色综合天天综合网天天看片| 韩国女主播一区二区三区| 亚洲午夜久久久久中文字幕久| 国产精品伦理在线| 久久你懂得1024| 欧美日韩mp4| 欧美羞羞免费网站| av高清不卡在线| 国产一区二区不卡在线| 日韩av网站在线观看| 亚洲人成网站精品片在线观看| www国产精品av| 91麻豆精品91久久久久同性| 日本精品一级二级| 99久久精品免费看| 国产成人免费在线| 国产老肥熟一区二区三区| 免费欧美在线视频| 日本不卡123| 亚洲大片在线观看| 一区二区欧美国产| 亚洲男人的天堂在线aⅴ视频| 中文字幕一区二区三区视频| 中文一区一区三区高中清不卡| 国产视频一区在线观看| 久久日韩精品一区二区五区| 欧美成人三级在线| 精品理论电影在线| 欧美一二区视频| 日韩欧美的一区二区| 56国语精品自产拍在线观看| 欧美精品久久天天躁| 欧美三级资源在线| 欧美日本一区二区三区四区| 欧美日韩高清不卡| 欧美一区二区三区四区久久| 欧美一区二区三区不卡| 精品久久久久久最新网址| 久久天天做天天爱综合色| 国产三级精品在线| 欧美极品另类videosde| 中文字幕制服丝袜一区二区三区 | 成人激情视频网站| 91亚洲精品一区二区乱码| 91免费观看国产| 欧美亚洲综合一区| 欧美一级片免费看| 久久久精品影视| 综合久久给合久久狠狠狠97色| 亚洲色图视频免费播放| 亚洲一区免费在线观看| 日韩中文字幕91| 久久99国产精品成人| 成人精品高清在线| 日本高清无吗v一区| 日韩一级免费一区| 久久久精品中文字幕麻豆发布| 亚洲欧洲另类国产综合| 亚洲综合小说图片| 九九九精品视频| 成人白浆超碰人人人人| 欧美久久久一区| 久久影院午夜论| 亚洲伦理在线免费看| 日本美女一区二区三区视频| 国内成人免费视频| 91福利区一区二区三区| 欧美大片在线观看一区二区| 亚洲欧美一区二区视频| 日韩av在线播放中文字幕| 成人免费视频一区二区| 在线播放91灌醉迷j高跟美女| 国产欧美一二三区| 亚洲影院在线观看| 国产乱妇无码大片在线观看| 欧美午夜影院一区| 国产欧美日韩在线视频| 亚洲国产欧美日韩另类综合 | 国产精品成人在线观看| 美女网站一区二区| 一本大道av伊人久久综合| 欧美一级爆毛片| 亚洲午夜久久久久久久久电影院| 国产91精品一区二区麻豆亚洲| 欧美日韩一区久久| 国产精品久久免费看| 日本vs亚洲vs韩国一区三区| 91蜜桃传媒精品久久久一区二区 | 4hu四虎永久在线影院成人| 中文字幕一区二区在线播放| 奇米色一区二区三区四区| 色综合天天综合在线视频| 久久伊人中文字幕| 蜜臀av性久久久久蜜臀aⅴ四虎| 91在线观看高清| 日本一区二区三区四区在线视频| 亚洲电影在线播放| 99精品在线免费| 国产色综合久久| 久久国产视频网| 欧美日韩免费观看一区三区| 国产精品青草综合久久久久99| 麻豆久久久久久久| 日韩一级片网站| 亚洲成年人网站在线观看| 97se亚洲国产综合自在线| 欧美激情在线看| 国产福利一区二区| 久久先锋影音av| 久久www免费人成看片高清| 777a∨成人精品桃花网| 日韩国产成人精品| 欧美日韩精品一区二区三区四区| 洋洋成人永久网站入口| 欧美自拍偷拍午夜视频| 亚洲另类在线制服丝袜| 欧美综合视频在线观看| 亚洲制服丝袜av|