Jump to content
  • Advertisement
Sign in to follow this  
luca76

OpenGL How to use a bitmap as the background image

This topic is 3739 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

Hi, i am working with Opengl ES (opengl for embedded systems) and there is a problem with bitmaps. I cannot use directly bitmaps in order to use one of them as the background image. There are two way to do this: 1] use two triangles that are perpendicular to the camera and cover the screen, disable lighting and perspective correction, use orthonormal projection and use the bitmap you want as a texture, render the two triangles, render the scene and swap the buffers.... 2] do all the rendering on a surface, copy the surface on a bitmap, manually copy every non black pixel of that bitmap on the background bitmap and finally visualize the background bitmap Consider the fact that the background bitmap change at every frame and that the frame per seconds cannot be > 15. The system does not have hardware acceleration (is a phone). I use the method 2], wich is slow (14/15 fps) but not so slow as the method 1] (7/8 fps) (but i am not sure that i have coded the method 1] correctly). Furthermore, every frame i have to scan the background bitmap pixel by pixel for other types of calculations. The question is: can the method 1] be faster than the method 2] and how can i implement the method 1]? I would like to be sure that the correspondence is 1:1: a pixel of the background bitmap (the texture) is mapped to a pixel of the backbuffer. Thank you, Luca

Share this post


Link to post
Share on other sites
Advertisement
Are you using glOrtho or gluPerspective as your main rendering mode? If you are using the latter, then switch back to glOrtho and render the background image as a single textured quad. And for the changing texture image use glTexSubImage2D to update the data with your new data.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!