| version 1.6 | | version 1.7 |
|---|
| | |
| GLuint kludgetexture; | | GLuint kludgetexture; |
| unsigned char *kludgetexturedata=NULL; | | unsigned char *kludgetexturedata=NULL; |
| | | |
| | | |
| void ogl_init_state(void){ | | void ogl_init_state(void){ |
| /* select clearing (background) color */ | | /* select clearing (background) color */ |
| glClearColor(0.0, 0.0, 0.0, 0.0); | | glClearColor(0.0, 0.0, 0.0, 0.0); |
| | |
| ky = (32.0/(float)grd_curscreen->sc_h); | | ky = (32.0/(float)grd_curscreen->sc_h); |
| | | |
| ogl_init_state(); | | ogl_init_state(); |
| | | glEnable( GL_TEXTURE_2D ); |
| for (i=0; i<grd_curscreen->sc_w/32; i++) { | | for (i=0; i<grd_curscreen->sc_w/32; i++) { |
| for (j=0; j<grd_curscreen->sc_h/32; j++) { | | for (j=0; j<grd_curscreen->sc_h/32; j++) { |
| int y,x,c,t; | | int y,x,c,t; |
| | |
| t+=grd_curscreen->sc_w; | | t+=grd_curscreen->sc_w; |
| } | | } |
| | | |
| glEnable( GL_TEXTURE_2D ); | | |
| // select our current texture | | // select our current texture |
| glBindTexture( GL_TEXTURE_2D, kludgetexture ); | | glBindTexture( GL_TEXTURE_2D, kludgetexture ); |
| glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); | | glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); |
| // when texture area is small, bilinear filter the closest MIP map | | |
| glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST ); | | glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST ); |
| // when texture area is large, bilinear filter the first MIP map | | |
| glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); | | glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); |
| | | |
| // if wrap is true, the texture wraps over at the edges (repeat) | | // if wrap is true, the texture wraps over at the edges (repeat) |
| // ... false, the texture ends at the edges (clamp) | | // ... false, the texture ends at the edges (clamp) |
| glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, | | glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP ); |
| 0 ? GL_REPEAT : GL_CLAMP ); | | glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP ); |
| glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, | | |
| 0 ? GL_REPEAT : GL_CLAMP ); | | |
| glTexImage2D( GL_TEXTURE_2D, 0, 3, 32, | | glTexImage2D( GL_TEXTURE_2D, 0, 3, 32, |
| 32, 0, GL_RGB, GL_UNSIGNED_BYTE, kludgetexturedata ); | | 32, 0, GL_RGB, GL_UNSIGNED_BYTE, kludgetexturedata ); |
| | | |
| | | |
| glBegin( GL_QUADS ); | | glBegin( GL_QUADS ); |
| glColor3f(1.0,1.0,1.0); | | glColor3f(1.0,1.0,1.0); |
| glTexCoord2d(0.0,0.0); glVertex2f(kx*(float)i,ky*(float)j); | | glTexCoord2d(0.0,0.0); glVertex2f(kx*(float)i,ky*(float)j); |
| | |
| glTexCoord2d(1.0,1.0); glVertex2f(kx*(float)(i+1),ky*(float)(j+1)); | | glTexCoord2d(1.0,1.0); glVertex2f(kx*(float)(i+1),ky*(float)(j+1)); |
| glTexCoord2d(0.0,1.0); glVertex2f(kx*(float)i,ky*(float)(j+1)); | | glTexCoord2d(0.0,1.0); glVertex2f(kx*(float)i,ky*(float)(j+1)); |
| glEnd(); | | glEnd(); |
| glDisable( GL_TEXTURE_2D ); | | glDeleteTextures( 1, &kludgetexture ); |
| } | | } |
| } | | } |
| | | glDisable( GL_TEXTURE_2D ); |
| | | |
| | | |
| ogl_swap_buffers();//platform specific code | | ogl_swap_buffers();//platform specific code |
| glDeleteTextures( 1, &kludgetexture ); | | |
| } | | } |
| // else | | // else |
| // ogl_swap_buffers();//platform specific code | | // ogl_swap_buffers();//platform specific code |
| | |
| if (gr_installed==1) | | if (gr_installed==1) |
| return -1; | | return -1; |
| | | |
| | | #ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE |
| | | if (FindArg("-fullscreen")) |
| | | gr_toggle_fullscreen(); |
| | | #endif |
| | | |
| | | |
| ogl_init();//platform specific initialization | | ogl_init();//platform specific initialization |
| | | |
| // allocate a texture name | | // allocate a texture name |
| | |
| } | | } |
| | | |
| // Palette functions follow. | | // Palette functions follow. |
| ////inline GLfloat PAL2Tr(int c) {return (gr_palette[c*3]+gr_palette_gamma)/63.0;} | | //////inline GLfloat PAL2Tr(int c) {return (gr_palette[c*3]+gr_palette_gamma)/63.0;} |
| ////inline GLfloat PAL2Tg(int c) {return (gr_palette[c*3+1]+gr_palette_gamma)/63.0;} | | //////inline GLfloat PAL2Tg(int c) {return (gr_palette[c*3+1]+gr_palette_gamma)/63.0;} |
| ////inline GLfloat PAL2Tb(int c) {return (gr_palette[c*3+2]+gr_palette_gamma)/63.0;} | | //////inline GLfloat PAL2Tb(int c) {return (gr_palette[c*3+2]+gr_palette_gamma)/63.0;} |
| | | ////inline GLfloat PAL2Tr(int c) {return (gr_current_pal[c*3]+gr_palette_gamma)/63.0;} |
| | | ////inline GLfloat PAL2Tg(int c) {return (gr_current_pal[c*3+1]+gr_palette_gamma)/63.0;} |
| | | ////inline GLfloat PAL2Tb(int c) {return (gr_current_pal[c*3+2]+gr_palette_gamma)/63.0;} |
| //inline GLfloat PAL2Tr(int c) {return (gr_current_pal[c*3]+gr_palette_gamma)/63.0;} | | //inline GLfloat PAL2Tr(int c) {return (gr_current_pal[c*3]+gr_palette_gamma)/63.0;} |
| //inline GLfloat PAL2Tg(int c) {return (gr_current_pal[c*3+1]+gr_palette_gamma)/63.0;} | | //inline GLfloat PAL2Tg(int c) {return (gr_current_pal[c*3+1]+gr_palette_gamma)/63.0;} |
| //inline GLfloat PAL2Tb(int c) {return (gr_current_pal[c*3+2]+gr_palette_gamma)/63.0;} | | //inline GLfloat PAL2Tb(int c) {return (gr_current_pal[c*3+2]+gr_palette_gamma)/63.0;} |
| inline GLfloat PAL2Tr(int c) {return (gr_current_pal[c*3]+gr_palette_gamma)/63.0;} | | |
| inline GLfloat PAL2Tg(int c) {return (gr_current_pal[c*3+1]+gr_palette_gamma)/63.0;} | | |
| inline GLfloat PAL2Tb(int c) {return (gr_current_pal[c*3+2]+gr_palette_gamma)/63.0;} | | |
| | | |
| //static int last_r=0, last_g=0, last_b=0; | | //static int last_r=0, last_g=0, last_b=0; |
| GLfloat last_r=0, last_g=0, last_b=0; | | GLfloat last_r=0, last_g=0, last_b=0; |