How can i do, for put an Image like Background?
I can load my image tga, but i dont know mesh the background and the texture like a color.
Thanks a lot.
How can i do, for put an Image like Background?
I can load my image tga, but i dont know mesh the background and the texture like a color.
Thanks a lot.
Just draw a large textured quad.
http://www.opengl.org/sdk/docs/man/
Read docs or a tutorial on texture mapping for details, but it boils down to:
GL_QUADS
glTexCoord 1 0
glVertex 1 -1
glTexCoord 1 1
glVertex 1 1
glTexCoord 0 1
glVertex -1 1
glTexCoord 0 0
glVertex -1 -1
glPopMatrix(GL_PROJECTION);
glPopMatrix(GL_PROJECTION);
One beginner pitfall is that the default texture filtering parameter needs mipmaps, which is a good thing for both quality and performance, but if your forget that you have to generate mipmaps, your texture will only appear white.
To fix this, there are several ways, choose one (roughly sorted from best to worst) :
1-) Modern OpenGL :
call this right after glTexImage2D :
glGenerateMipmap(GL_TEXTURE_2D);
2-) classic GL :
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );
3-) generate yourself each mipmap level, and feed each trough glTexImage2D.
4-) … or disable mipmaps, but this is a shame