my problem is the following:
i have an animated object (in my case something like a water surface with expanding waves).
Now i wanted to put a background image from a *.bmp file. After having some trouble with writing a function that can cope with the file and return useful data i can ‘paint’ the image in glOrtho2D() projection 'mode’to the framebuffer with glDrawPixels(). Of course only without animation. When i try to do the same with animation and 3D-Projection (means something like calling glDrawPixel 30 times a second and painting the background before rendering the 3D Objects)the program becomes incredible slow or hangs completely up.
I dont know anything about Texture mapping yet. Can you give me some advice how to take a 1,2 MB image and to use it for painting background in reasonable speed.
Use texture mapping
Here are the steps :
1/ at init time, load your .bmp file somwhere in memory in a suitable layout (I assume you managed to do this since you use glDrawPixels)
2/ at init time create a texture object, and initialize it with the data loaded from the bmp (look at glTexImage2D)
3/ for every frame :
clear color buffer & depth buffer
disable depth buffer writing
enable 2D texture
bind your texture
draw a quad that covers the window with proper texture coords
disable 2D texture
enable depth buffer writing
draw your scene as usual