version 1.18 | | version 1.19 |
---|
| | |
#include "polyobj.h" | | #include "polyobj.h" |
#include "gamefont.h" | | #include "gamefont.h" |
| | |
| | //change to 1 for lots of spew. |
| | #if 0 |
| | #define glmprintf(a) mprintf(a) |
| | #else |
| | #define glmprintf(a) |
| | #endif |
| | |
#ifndef M_PI | | #ifndef M_PI |
#define M_PI 3.14159 | | #define M_PI 3.14159 |
| | |
int ogl_luminance4_alpha4_ok=1; | | int ogl_luminance4_alpha4_ok=1; |
int ogl_rgba2_ok=1; | | int ogl_rgba2_ok=1; |
int ogl_readpixels_ok=1; | | int ogl_readpixels_ok=1; |
| | int ogl_gettexlevelparam_ok=1; |
| | #ifdef GL_ARB_multitexture |
| | int ogl_arb_multitexture_ok=0; |
| | #endif |
| | #ifdef GL_SGIS_multitexture |
| | int ogl_sgis_multitexture_ok=0; |
| | #endif |
| | |
int sphereh=0; | | int sphereh=0; |
int circleh5=0; | | int circleh5=0; |
| | |
if (gr_renderstats){ | | if (gr_renderstats){ |
gr_printf(5,GAME_FONT->ft_h*14+3*14,"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024); | | gr_printf(5,GAME_FONT->ft_h*14+3*14,"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024); |
} | | } |
// mprintf((0,"ogl tex stats: %i(%i,%i|%i,%i,%i,%i,%i) %i(%i)b (%i(%i)wasted)\n",used,usedrgba,usedl4a4,prio0,prio1,prio2,prio3,prioh,truebytes,truetexel,truebytes-databytes,truetexel-datatexel)); | | // glmprintf((0,"ogl tex stats: %i(%i,%i|%i,%i,%i,%i,%i) %i(%i)b (%i(%i)wasted)\n",used,usedrgba,usedl4a4,prio0,prio1,prio2,prio3,prioh,truebytes,truetexel,truebytes-databytes,truetexel-datatexel)); |
return truebytes; | | return truebytes; |
} | | } |
int ogl_mem_target=-1; | | int ogl_mem_target=-1; |
| | |
OGL_BINDTEXTURE(bm->gltexture->handle); | | OGL_BINDTEXTURE(bm->gltexture->handle); |
bm->gltexture->lastrend=GameTime; | | bm->gltexture->lastrend=GameTime; |
bm->gltexture->numrend++; | | bm->gltexture->numrend++; |
if (bm->gltexture->numrend==80 || bm->gltexture->numrend==4000 || bm->gltexture->numrend==80000){ | | // if (bm->gltexture->numrend==80 || bm->gltexture->numrend==4000 || bm->gltexture->numrend==80000){ |
| | if (bm->gltexture->numrend==100){ |
bm->gltexture->prio+=0.1; | | bm->gltexture->prio+=0.1; |
// glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,bm->gltexture->prio); | | // glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY,bm->gltexture->prio); |
glPrioritizeTextures(1,&bm->gltexture->handle,&bm->gltexture->prio); | | glPrioritizeTextures(1,&bm->gltexture->handle,&bm->gltexture->prio); |
| | |
if (ec->vc.num_frames>max_efx) | | if (ec->vc.num_frames>max_efx) |
max_efx=ec->vc.num_frames; | | max_efx=ec->vc.num_frames; |
} | | } |
mprintf((0,"max_efx:%i\n",max_efx)); | | glmprintf((0,"max_efx:%i\n",max_efx)); |
for (ef=0;ef<max_efx;ef++){ | | for (ef=0;ef<max_efx;ef++){ |
for (i=0,ec=Effects;i<Num_effects;i++,ec++) { | | for (i=0,ec=Effects;i<Num_effects;i++,ec++) { |
if ((Effects[i].changing_wall_texture == -1) && (Effects[i].changing_object_texture==-1) ) | | if ((Effects[i].changing_wall_texture == -1) && (Effects[i].changing_object_texture==-1) ) |
| | |
tmap1=sidep->tmap_num; | | tmap1=sidep->tmap_num; |
tmap2=sidep->tmap_num2; | | tmap2=sidep->tmap_num2; |
if (tmap1<0 || tmap1>=NumTextures){ | | if (tmap1<0 || tmap1>=NumTextures){ |
mprintf((0,"ogl_cache_level_textures %i %i %i %i\n",seg,side,tmap1,NumTextures)); | | glmprintf((0,"ogl_cache_level_textures %i %i %i %i\n",seg,side,tmap1,NumTextures)); |
// tmap1=0; | | // tmap1=0; |
continue; | | continue; |
} | | } |
| | |
else { | | else { |
ogl_loadbmtexture(bm2); | | ogl_loadbmtexture(bm2); |
} | | } |
// mprintf((0,"ogl_cache_level_textures seg %i side %i t1 %i t2 %x bm %p NT %i\n",seg,side,tmap1,tmap2,bm,NumTextures)); | | // glmprintf((0,"ogl_cache_level_textures seg %i side %i t1 %i t2 %x bm %p NT %i\n",seg,side,tmap1,tmap2,bm,NumTextures)); |
} | | } |
ogl_loadbmtexture(bm); | | ogl_loadbmtexture(bm); |
} | | } |
} | | } |
mprintf((0,"finished ef:%i\n",ef)); | | glmprintf((0,"finished ef:%i\n",ef)); |
} | | } |
reset_special_effects(); | | reset_special_effects(); |
init_special_effects(); | | init_special_effects(); |
| | |
} | | } |
} | | } |
} | | } |
mprintf((0,"finished caching\n")); | | glmprintf((0,"finished caching\n")); |
} | | } |
| | |
int r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc; | | int r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc; |
| | |
// glVertex3f(f2glf(pnt->p3_vec.x),f2glf(pnt->p3_vec.y),-f2glf(pnt->p3_vec.z)); | | // glVertex3f(f2glf(pnt->p3_vec.x),f2glf(pnt->p3_vec.y),-f2glf(pnt->p3_vec.z)); |
// glEnd(); | | // glEnd(); |
glPushMatrix(); | | glPushMatrix(); |
mprintf((0,"circle: %f(%i),%f(%i),%f\n",(f2fl(xc1)+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,f2i(xc1),(f2fl(yc1)+grd_curcanv->cv_bitmap.bm_y)/(float)last_height,f2i(yc1),f2fl(r1))); | | glmprintf((0,"circle: %f(%i),%f(%i),%f\n",(f2fl(xc1)+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,f2i(xc1),(f2fl(yc1)+grd_curcanv->cv_bitmap.bm_y)/(float)last_height,f2i(yc1),f2fl(r1))); |
glTranslatef( | | glTranslatef( |
(f2fl(xc1)+grd_curcanv->cv_bitmap.bm_x)/(float)last_width, | | (f2fl(xc1)+grd_curcanv->cv_bitmap.bm_x)/(float)last_width, |
1.0-(f2fl(yc1)+grd_curcanv->cv_bitmap.bm_y)/(float)last_height,0); | | 1.0-(f2fl(yc1)+grd_curcanv->cv_bitmap.bm_y)/(float)last_height,0); |
| | |
for (i=0; i<nv; i++) | | for (i=0; i<nv; i++) |
average_light += uvl_list[i].l;*/ | | average_light += uvl_list[i].l;*/ |
OGL_DISABLE(TEXTURE_2D); | | OGL_DISABLE(TEXTURE_2D); |
// mprintf((0,"Gr_scanline_darkening_level=%i %f\n",Gr_scanline_darkening_level,Gr_scanline_darkening_level/(float)NUM_LIGHTING_LEVELS)); | | // glmprintf((0,"Gr_scanline_darkening_level=%i %f\n",Gr_scanline_darkening_level,Gr_scanline_darkening_level/(float)NUM_LIGHTING_LEVELS)); |
glColor4f(0,0,0,1.0-(Gr_scanline_darkening_level/(float)NUM_LIGHTING_LEVELS)); | | glColor4f(0,0,0,1.0-(Gr_scanline_darkening_level/(float)NUM_LIGHTING_LEVELS)); |
//glColor4f(0,0,0,f2fl(average_light/nv)); | | //glColor4f(0,0,0,f2fl(average_light/nv)); |
glBegin(GL_TRIANGLE_FAN); | | glBegin(GL_TRIANGLE_FAN); |
| | |
} | | } |
bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm,int orient) | | bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm,int orient) |
{ | | { |
| | #if (defined(GL_ARB_multitexture) || defined(GL_SGIS_multitexture)) |
| | if (ogl_arb_multitexture_ok || ogl_sgis_multitexture_ok){ |
| | int c; |
| | float l,u1,v1; |
| | |
| | r_tpolyc+=2; |
| | /* if (bm->bm_w !=64||bm->bm_h!=64) |
| | printf("g3_draw_tmap w %i h %i\n",bm->bm_w,bm->bm_h);*/ |
| | if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glActiveTextureARB(GL_TEXTURE0_ARB); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glSelectTextureSGIS(GL_TEXTURE0_SGIS); |
| | #endif |
| | } |
| | ogl_bindbmtex(bmbot); |
| | OGL_ENABLE(TEXTURE_2D); |
| | glEnable(GL_TEXTURE_2D); |
| | ogl_texwrap(bmbot->gltexture,GL_REPEAT); |
| | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
| | glEnable(GL_BLEND); |
| | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| | |
| | if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glActiveTextureARB(GL_TEXTURE1_ARB); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glSelectTextureSGIS(GL_TEXTURE1_SGIS); |
| | #endif |
| | } |
| | ogl_bindbmtex(bm); |
| | // OGL_ENABLE(TEXTURE_2D); |
| | glEnable(GL_TEXTURE_2D); |
| | ogl_texwrap(bm->gltexture,GL_REPEAT); |
| | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
| | |
| | glEnable(GL_BLEND); |
| | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| | |
| | glBegin(GL_TRIANGLE_FAN); |
| | for (c=0;c<nv;c++){ |
| | switch(orient){ |
| | case 1: |
| | u1=1.0-f2glf(uvl_list[c].v); |
| | v1=f2glf(uvl_list[c].u); |
| | break; |
| | case 2: |
| | u1=1.0-f2glf(uvl_list[c].u); |
| | v1=1.0-f2glf(uvl_list[c].v); |
| | break; |
| | case 3: |
| | u1=f2glf(uvl_list[c].v); |
| | v1=1.0-f2glf(uvl_list[c].u); |
| | break; |
| | default: |
| | u1=f2glf(uvl_list[c].u); |
| | v1=f2glf(uvl_list[c].v); |
| | break; |
| | } |
| | if (bm->bm_flags&BM_FLAG_NO_LIGHTING){ |
| | l=1.0; |
| | }else{ |
| | //l=f2fl(uvl_list[c].l)+gr_palette_gamma/63.0; |
| | l=f2fl(uvl_list[c].l); |
| | } |
| | glColor3f(l,l,l); |
| | // glTexCoord2f(f2glf(uvl_list[c].u),f2glf(uvl_list[c].v)); |
| | if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glMultiTexCoord2fARB(GL_TEXTURE0_ARB,f2glf(uvl_list[c].u),f2glf(uvl_list[c].v)); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glMultiTexCoord2fSGIS(GL_TEXTURE0_SGIS,f2glf(uvl_list[c].u),f2glf(uvl_list[c].v)); |
| | #endif |
| | } |
| | if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glMultiTexCoord2fARB(GL_TEXTURE1_ARB,u1,v1); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glMultiTexCoord2fSGIS(GL_TEXTURE1_SGIS,u1,v1); |
| | #endif |
| | } |
| | //glVertex3f(f2glf(pointlist[c]->p3_vec.x),f2glf(pointlist[c]->p3_vec.y),f2glf(pointlist[c]->p3_vec.z)); |
| | //glVertex3f(f2glf(pointlist[c]->p3_vec.x),f2glf(pointlist[c]->p3_vec.y),f2glf(pointlist[c]->p3_vec.z)); |
| | glVertex3f(f2glf(pointlist[c]->p3_vec.x),f2glf(pointlist[c]->p3_vec.y),-f2glf(pointlist[c]->p3_vec.z)); |
| | } |
| | glEnd(); |
| | /* if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glActiveTextureARB(GL_TEXTURE1_ARB); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glSelectTextureSGIS(GL_TEXTURE1_SGIS); |
| | #endif |
| | } |
| | // OGL_ENABLE(TEXTURE_2D);*/ |
| | glDisable(GL_TEXTURE_2D); |
| | if (ogl_arb_multitexture_ok){ |
| | #ifdef GL_ARB_multitexture |
| | glActiveTextureARB(GL_TEXTURE0_ARB); |
| | #endif |
| | }else if (ogl_sgis_multitexture_ok){ |
| | #ifdef GL_SGIS_multitexture |
| | glSelectTextureSGIS(GL_TEXTURE0_SGIS); |
| | #endif |
| | } |
| | }else |
| | #endif |
| | { |
int c; | | int c; |
float l,u1,v1; | | float l,u1,v1; |
| | |
| | |
glVertex3f(f2glf(pointlist[c]->p3_vec.x),f2glf(pointlist[c]->p3_vec.y),-f2glf(pointlist[c]->p3_vec.z)); | | glVertex3f(f2glf(pointlist[c]->p3_vec.x),f2glf(pointlist[c]->p3_vec.y),-f2glf(pointlist[c]->p3_vec.z)); |
} | | } |
glEnd(); | | glEnd(); |
| | } |
return 0; | | return 0; |
} | | } |
| | |
| | |
bool ogl_ubitblt(int w,int h,int dx,int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest) | | bool ogl_ubitblt(int w,int h,int dx,int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest) |
{ | | { |
GLfloat xo,yo;//,xs,ys; | | GLfloat xo,yo;//,xs,ys; |
mprintf((0,"ogl_ubitblt(w=%i,h=%i,dx=%i,dy=%i,sx=%i,sy=%i,src=%p,dest=%p\n",w,h, dx, dy,sx, sy, src,dest)); | | glmprintf((0,"ogl_ubitblt(w=%i,h=%i,dx=%i,dy=%i,sx=%i,sy=%i,src=%p,dest=%p\n",w,h, dx, dy,sx, sy, src,dest)); |
| | |
dx+=dest->bm_x; | | dx+=dest->bm_x; |
dy+=dest->bm_y; | | dy+=dest->bm_y; |
| | |
d=e; | | d=e; |
d+=dest->bm_rowsize; | | d+=dest->bm_rowsize; |
} | | } |
mprintf((0,"c=%i w*h=%i\n",c,w*h)); | | glmprintf((0,"c=%i w*h=%i\n",c,w*h)); |
#endif | | #endif |
return 0; | | return 0; |
} | | } |
| | |
ogl_clean_texture_cache(); | | ogl_clean_texture_cache(); |
if (gr_renderstats){ | | if (gr_renderstats){ |
gr_printf(5,GAME_FONT->ft_h*13+3*13,"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc); | | gr_printf(5,GAME_FONT->ft_h*13+3*13,"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc); |
// mprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame | | // glmprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame |
} | | } |
ogl_do_palfx(); | | ogl_do_palfx(); |
ogl_swap_buffers_internal(); | | ogl_swap_buffers_internal(); |
| | |
} | | } |
int tex_format_verify(ogl_texture *tex){ | | int tex_format_verify(ogl_texture *tex){ |
while (!tex_format_supported(tex->internalformat,tex->format)){ | | while (!tex_format_supported(tex->internalformat,tex->format)){ |
mprintf((0,"tex format %x not supported",tex->internalformat)); | | glmprintf((0,"tex format %x not supported",tex->internalformat)); |
switch (tex->internalformat){ | | switch (tex->internalformat){ |
case GL_INTENSITY4: | | case GL_INTENSITY4: |
if (ogl_luminance4_alpha4_ok){ | | if (ogl_luminance4_alpha4_ok){ |
| | |
mprintf((0,"...no tex format to fall back on\n")); | | mprintf((0,"...no tex format to fall back on\n")); |
return 1; | | return 1; |
} | | } |
mprintf((0,"...falling back to %x\n",tex->internalformat)); | | glmprintf((0,"...falling back to %x\n",tex->internalformat)); |
} | | } |
return 0; | | return 0; |
} | | } |
| | |
int u; | | int u; |
if (tex->tw!=w || tex->th!=h){ | | if (tex->tw!=w || tex->th!=h){ |
u=(tex->w/(float)tex->tw*w) * (tex->h/(float)tex->th*h); | | u=(tex->w/(float)tex->tw*w) * (tex->h/(float)tex->th*h); |
mprintf((0,"shrunken texture?\n")); | | glmprintf((0,"shrunken texture?\n")); |
}else | | }else |
u=tex->w*tex->h; | | u=tex->w*tex->h; |
if (bits<=0){//the beta nvidia GLX serverdoesn't ever return any bit sizes, so just use some assumptions. | | if (bits<=0){//the beta nvidia GLX server. doesn't ever return any bit sizes, so just use some assumptions. |
tex->bytes=((float)w*h*dbits)/8.0; | | tex->bytes=((float)w*h*dbits)/8.0; |
tex->bytesu=((float)u*dbits)/8.0; | | tex->bytesu=((float)u*dbits)/8.0; |
}else{ | | }else{ |
tex->bytes=((float)w*h*bits)/8.0; | | tex->bytes=((float)w*h*bits)/8.0; |
tex->bytesu=((float)u*bits)/8.0; | | tex->bytesu=((float)u*bits)/8.0; |
} | | } |
mprintf((0,"tex_set_size1: %ix%i, %ib(%i) %iB\n",w,h,bits,dbits,tex->bytes)); | | glmprintf((0,"tex_set_size1: %ix%i, %ib(%i) %iB\n",w,h,bits,dbits,tex->bytes)); |
} | | } |
void tex_set_size(ogl_texture *tex){ | | void tex_set_size(ogl_texture *tex){ |
// int w,h,r,g,b,a; | | int w,h,bi=16,a=0; |
int w,h,bi=16,a=0,t; | | if (ogl_gettexlevelparam_ok){ |
| | int t; |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&w); | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&w); |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&h); | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&h); |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_LUMINANCE_SIZE,&t);a+=t; | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_LUMINANCE_SIZE,&t);a+=t; |
| | |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_GREEN_SIZE,&t);a+=t; | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_GREEN_SIZE,&t);a+=t; |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_BLUE_SIZE,&t);a+=t; | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_BLUE_SIZE,&t);a+=t; |
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_ALPHA_SIZE,&t);a+=t; | | glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_ALPHA_SIZE,&t);a+=t; |
| | }else{ |
| | w=tex->tw; |
| | h=tex->th; |
| | } |
switch (tex->format){ | | switch (tex->format){ |
case GL_LUMINANCE: | | case GL_LUMINANCE: |
bi=8; | | bi=8; |
| | |
// int format=GL_RGBA; | | // int format=GL_RGBA; |
//int filltype=0; | | //int filltype=0; |
tex->tw=pow2ize(tex->w);tex->th=pow2ize(tex->h);//calculate smallest texture size that can accomodate us (must be multiples of 2) | | tex->tw=pow2ize(tex->w);tex->th=pow2ize(tex->h);//calculate smallest texture size that can accomodate us (must be multiples of 2) |
| | // tex->tw=tex->w;tex->th=tex->h;//feeling lucky? |
| | |
if(gr_badtexture>0) return; | | if(gr_badtexture>0) return; |
| | |
| | |
tex->v=(float)tex->h/(float)tex->th; | | tex->v=(float)tex->h/(float)tex->th; |
| | |
// if (width!=twidth || height!=theight) | | // if (width!=twidth || height!=theight) |
// mprintf((0,"sizing %ix%i texture up to %ix%i\n",width,height,twidth,theight)); | | // glmprintf((0,"sizing %ix%i texture up to %ix%i\n",width,height,twidth,theight)); |
ogl_filltexbuf(data,texbuf,tex->lw,tex->w,tex->h,dxo,dyo,tex->tw,tex->th,tex->format); | | ogl_filltexbuf(data,texbuf,tex->lw,tex->w,tex->h,dxo,dyo,tex->tw,tex->th,tex->format); |
| | |
// Generate OpenGL texture IDs. | | // Generate OpenGL texture IDs. |
| | |
tex_set_size(tex); | | tex_set_size(tex); |
| | |
r_texcount++; | | r_texcount++; |
mprintf((0,"ogl_loadtexture(%p,%i,%i,%ix%i,%p):%i u=%f v=%f b=%i bu=%i (%i)\n",data,tex->tw,tex->th,dxo,dyo,tex,tex->handle,tex->u,tex->v,tex->bytes,tex->bytesu,r_texcount)); | | glmprintf((0,"ogl_loadtexture(%p,%i,%i,%ix%i,%p):%i u=%f v=%f b=%i bu=%i (%i)\n",data,tex->tw,tex->th,dxo,dyo,tex,tex->handle,tex->u,tex->v,tex->bytes,tex->bytesu,r_texcount)); |
| | |
} | | } |
unsigned char decodebuf[512*512]; | | unsigned char decodebuf[512*512]; |
| | |
void ogl_freetexture(ogl_texture *gltexture){ | | void ogl_freetexture(ogl_texture *gltexture){ |
if (gltexture->handle>0){ | | if (gltexture->handle>0){ |
r_texcount--; | | r_texcount--; |
mprintf((0,"ogl_freetexture(%p):%i (last rend %is) (%i left)\n",gltexture,gltexture->handle,(GameTime-gltexture->lastrend)/f1_0,r_texcount)); | | glmprintf((0,"ogl_freetexture(%p):%i (last rend %is) (%i left)\n",gltexture,gltexture->handle,(GameTime-gltexture->lastrend)/f1_0,r_texcount)); |
glDeleteTextures( 1, &gltexture->handle ); | | glDeleteTextures( 1, &gltexture->handle ); |
// gltexture->handle=0; | | // gltexture->handle=0; |
ogl_init_texture(gltexture); | | ogl_init_texture(gltexture); |
| | |
ogl_freetexture(bm->gltexture); | | ogl_freetexture(bm->gltexture); |
bm->gltexture=NULL; | | bm->gltexture=NULL; |
// r_texcount--; | | // r_texcount--; |
// mprintf((0,"ogl_freebmtexture(%p,%p):%i (%i left)\n",bm->bm_data,&bm->gltexture,bm->gltexture,r_texcount)); | | // glmprintf((0,"ogl_freebmtexture(%p,%p):%i (%i left)\n",bm->bm_data,&bm->gltexture,bm->gltexture,r_texcount)); |
// glDeleteTextures( 1, &bm->gltexture ); | | // glDeleteTextures( 1, &bm->gltexture ); |
// bm->gltexture=-1; | | // bm->gltexture=-1; |
} | | } |