How to use a bitmap as the background image

Started by
0 comments, last by MARS_999 15 years, 9 months ago
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
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.

This topic is closed to new replies.

Advertisement