PDA

View Full Version : Texture problems



andres
06-06-2000, 09:27 PM
I'm writing a program with VisualC++ 6.0, it loads many textures and
bind them with glBind but executing the program many times the texture
aspect get worse like near columns in the bitmap were shifted ,the
problem appear and disappear also if I resize the Opengl window.
I tried the program on a Tnt2 M64 using various driver versions and the
problem remains.
I think that is not a driver problem but I have no idea what can I try
in my code.
Any suggestions?
Thanks

lgrosshennig
06-07-2000, 11:24 AM
Hi Andres!

Hm, do you mean each time you start your programm the texturing get worse?

Or has your window every time a different size? Than it could be that perspective correct texturemapping is not enabled.

If you could post a code snipped or so, the community will probably able to help you.

Or do you have screenshots showing the problem?

What kind of system (OS, graphics card) are you using?

Regards,

LG http://www.opengl.org/discussion_boards/ubb/biggrin.gif

andres
06-07-2000, 10:46 PM
This is the code I use for binding a texture
void Bitmap::MakeBind(int genBind)
{
glEnable(GL_TEXTURE_2D);
if(genBind)
glGenTextures(1,&bindId);
glBindTexture(GL_TEXTURE_2D,bindId);
glPixelStorei(GL_PACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
if(isRGBA)
glTexImage2D(GL_TEXTURE_2D,0,4,getWidth(),getHeigh t(),0,GL_RGBA,GL_UNSIGNED_BYTE,(GLubyte*)data);
else glTexImage2D(GL_TEXTURE_2D,0,3,getWidth(),getHeigh t(),0,GL_RGB,GL_UNSIGNED_BYTE,(GLubyte*)data);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MO DULATE);
}
The problem occur also when I set the view with glOrtho
Sometimes the texture is correctly displayed but when I resize the window it can happen that
the near columns of the texture lose alignment.
The problem continues if I restart the program maybe because the driver were broken during debug
with VisualStudio.
I use Microsoft VisualC++ 6.0 on Win98 with a Tnt2 M64