Opengl: low fps when using texture -
after setting texture there 20fps before aplying texture 300fps
my code:
void loadtex() { gluint texture; hbitmap gltex; bitmap tex; byte texture=tex; glgentextures(sizeof(texture), &texture); gltex= (hbitmap)loadimage(getmodulehandle(null),makeintresource(texture), image_bitmap, 0, 0, lr_createdibsection); getobject(gltex,sizeof(tex), &tex); glpixelstorei(gl_unpack_alignment,4); glbindtexture(gl_texture_2d, texture); gltexenvf( gl_texture_env, gl_texture_env_mode, gl_modulate ); gltexparameterf( gl_texture_2d, gl_texture_min_filter,gl_linear_mipmap_nearest ); gltexparameterf( gl_texture_2d, gl_texture_mag_filter, gl_linear ); glubuild2dmipmaps(gl_texture_2d, 3, tex.bmwidth, tex.bmheight, gl_rgb, gl_unsigned_byte, tex.bmbits); deleteobject(gltex); }
as can see load texture resourcs file. call loadtex()
in main winapi loop.
the second problem texture bit transparent takes color face behind , mixes itself. why?
i call loadtex() in main winapi loop.
i'm assuming means call once per frame, in case reason performance drop. should load texture once before loop, , draw each frame.
the second problem texture bit transparent takes color face behind , mixes itself
without seeing code rendering texture hard why. disable blending gldisable(gl_blend) , texture no longer transparent.
Comments
Post a Comment