Ramesh Akula
Ramesh Akula

Reputation: 5740

How to set background Image for OpenGL in Android?

I am new to OpenGL. How to set background image for OpenGL. Actually when I am rendering the square texture and normal square (means which is including with colors). Texture also change its color...

Upvotes: 0

Views: 2830

Answers (1)

Christian Rau
Christian Rau

Reputation: 45948

I don't completely understand your question, but there is no background image in OpenGL. If you want to have an image as background of your rendering, just draw a textured square covering the whole screen before drawing everything else.

In case you have depth buffering enabled, you should also make sure your background image doesn't write to the depth buffer, so that the other things you render after it are actually rendered on top of the background. This can either be done by rendering it at the far plane so it gets the maximum depth of 1 or by just disabling depht writes using

glDepthMask(GL_FALSE);

and of course enabling it again (using glDepthMask(GL_TRUE)) after it is drawn.

But of course OpenGL is no scene or image management system and has no notion of any persistent scene or images and forgets about anything after it has been drawn. This means, like everything else you have to draw this background image each frame before the other scene objects are drawn.

Upvotes: 2

Related Questions