texture problem

Started by
2 comments, last by cody 22 years, 5 months ago
what is needed to draw a textured rectangle on the screen in 2d-mode? im doing the following: -i have loaded a texture, i assume this works -glEnable(GL_TEXTURE_2D); -glColor(1,1,1); -glBindTexture(GL_TEXTURE_2D, id); -rendering: glBegin(GL_QUADS); or glBegin(GL_TRIANGLES); glTexCoord2f(u,v); glVertex2f(x,y); ... glEnd(); i have read the red book and this should be ok i think... but i just get a white rectangle on the screen, no texture at all! it looks as if i didnt bind the texture! i took the texture-loading code from a sample and it works. are there any commands missing? thanks for any help cody
Advertisement
Hi,

I don''t really see anything missing in your code. Are you sure that the texture was loaded correctly? Make sure that both loading the texture from disk, as well as storing the texture to OpenGL using glTexImage or gluBuildMipmaps works. This is essential. Note that OpenGL replaces broken texture data with white, while D3D uses black.

If it does, you might want to check your texture. Are width and length powers of two? Try textures with 128x128 pixels (if you aren''t using such already . They do always work if thats the matter.
oh you are right, gluBuildMipmaps returns "out of memory".
i didnt check this because it wasnt my code.

so i cant load a 128x128 texture on my geforce3 with 64mb, nice!

this texture file works with the sample... what the hell?!
oh im so silly, i put the loading code in my init function before opengl is initialized... uuuuuhhhh

This topic is closed to new replies.

Advertisement