• Advertisement

Archived

This topic is now archived and is closed to further replies.

texture problem

This topic is 5946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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?!

Share this post


Link to post
Share on other sites
oh im so silly, i put the loading code in my init function before opengl is initialized... uuuuuhhhh

Share this post


Link to post
Share on other sites

  • Advertisement