static void myinit(void) { InitValues(); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glShadeModel(GL_FLAT); glTranslatef(0.0, 0.0, -3.6); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &texImage); glBindTexture(GL_TEXTURE_2D, texImage); makeImages(1); glGenTextures(1, &texColor); glBindTexture(GL_TEXTURE_2D, texColor); makeImages(0); texCurrent = texImage; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); }
void texturemipmap::initializeGL() { glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); glTranslatef(0.0, 0.0, -3.6); makeImages(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &texName); glBindTexture(GL_TEXTURE_2D, texName); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage32); glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage16); glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage8); glTexImage2D(GL_TEXTURE_2D, 3, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage4); glTexImage2D(GL_TEXTURE_2D, 4, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage2); glTexImage2D(GL_TEXTURE_2D, 5, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, mipmapImage1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); }
static void myinit(void) { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glShadeModel(GL_FLAT); glTranslatef(0.0, 0.0, -3.6); makeImages(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, 3, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage32[0][0][0]); glTexImage2D(GL_TEXTURE_2D, 1, 3, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage16[0][0][0]); glTexImage2D(GL_TEXTURE_2D, 2, 3, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage8[0][0][0]); glTexImage2D(GL_TEXTURE_2D, 3, 3, 4, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage4[0][0][0]); glTexImage2D(GL_TEXTURE_2D, 4, 3, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage2[0][0][0]); glTexImage2D(GL_TEXTURE_2D, 5, 3, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, &mipmapImage1[0][0][0]); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); }
/* * buildView() */ static void buildView(bt_view_t *view, cityTile_t *tiles, uint32_t tagIndex) { uint32_t i; int32_t x, y; uint8_t imageCount; uint8_t width; imageCount = str_read16le(dundata->buf) / 4; i = 0; while (tiles[i].depth) { x = quadXYmap[tiles[i].index].column; y = quadXYmap[tiles[i].index].row; if (x < 0) { if ((x + b44278[tiles[i].index]) < 0) width = 0; else width = x + b44278[tiles[i].index]; x = 0; } else { if ((x + b44278[tiles[i].index]) > 56) width = 55 - x; else width = b44278[tiles[i].index]; } xmkdir(mkImagePath("%s/%d%s", gfx_tags[tagIndex], tiles[i].depth, tiles[i].quad )); makeImages(&tiles[i], tagIndex, width, imageCount); bt_view_new_facet( view, bts_sprintf("%d%s", tiles[i].depth, tiles[i].quad), bts_strcpy(tiles[i].facet), x << 2, y << 1, 0, 0 ); i++; } }
void init(void) { GLfloat diffuse[4] = {1.0, 1.0, 1.0, 1.0}; glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); makeImages(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_WRAP_R, GL_REPEAT); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image1); glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image4); glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image2); glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image5); glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image3); glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT, 0, GL_RGBA, imageSize, imageSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, image6); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_EXT); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_TEXTURE_CUBE_MAP_EXT); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_AUTO_NORMAL); glEnable(GL_NORMALIZE); glMaterialfv (GL_FRONT, GL_DIFFUSE, diffuse); }
BOOL CDlgMakeTChartImage::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù. layoutCtrls(); CString fname; fname.Format("%s%s", this->m_strSubjectFolder, this->m_pTI->m_chFileName); loadData(fname); makeImages(); OnOK(); return TRUE; // return TRUE unless you set the focus to a control // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝȯÇØ¾ß ÇÕ´Ï´Ù. }
int main (int argc, char **argv) { int i; double now; feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW); init_sdl_gl_flags (WIDTH, HEIGHT, 0); srandom (time (NULL)); init_gl (&argc, argv); glEnable (GL_LIGHTING); glEnable (GL_DEPTH_TEST); glEnable (GL_AUTO_NORMAL); glEnable (GL_NORMALIZE); glClearDepth (1); glViewport (0, 0, WIDTH, HEIGHT); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluPerspective (60, (GLfloat) WIDTH/(GLfloat) HEIGHT, .1, 1000); glClearColor (0, 0, 0, 0); glMatrixMode (GL_MODELVIEW); SDL_ShowCursor (1); makeImages (); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glGenTextures (1, texName); makeTexture (texName[0], groundtexture.texturesize, (GLubyte ***) groundtexture.tex); glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glBlendFunc (GL_SRC_ALPHA, GL_ONE); gndcounter = 1; read_terrain (); player.p.x = 0; player.p.y = 0; player.p.z = ground_height (&player.p); player.loc = detect_plane (&player.p); player.movtype = GROUNDED; player.speed = 100; player.mass = 1; vset (&player.vel, 0, 0, 0); player.turnspeed = DTOR (180); player.theta = DTOR (0); player.camdist = 15; player.lasttime = get_secs (); player.moving = NO; playercamera.phi = DTOR (0); playercamera.theta_difference = 0; while (1) { process_input (); if (mousebutton[1] == 0 && mousebutton[2] == 0 && mousebutton[3] == 0) { SDL_ShowCursor (1); } else { SDL_ShowCursor (0); } movement (); if (paused == NO) { for (i = 0; i < 1; i++) { moving (); now = get_secs (); player.lasttime = now; } } process_mouse (); draw (); now = get_secs (); player.lasttime = now; SDL_Delay (10); } return (0); }