iDevGames Forums
2D images - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2D images (/thread-6409.html)

2D images - djohnson - Jul 24, 2004 03:03 PM

Ok, I am trying to create a simple background image in a window. How would I go about doing this if the image of 640 x 480? I have tried texture mapping, but no luck there unless it is a direct multiple of 64 x 64... If you know of a good tutorial that does not go into 3D like nehe, please share! Thanks.

2D images - OneSadCookie - Jul 24, 2004 04:41 PM

multiple of 64 is irrelevant, it's power-of-two that's important.

You have two options here. One is to put your 640x480 image into the bottom left of a 1024x512 texture, and just draw the bit you care about. The other is to use the EXT_texture_rectangle extension, which allows non-power-of-two textures (but won't work on the Rage 128).

2D images - djohnson - Jul 24, 2004 04:57 PM

Ortho view is what I think I need. I am reading up on tutorial 21 on nehe. Some how I missed it the first time I was going through the tutorials.... Thanks for the help.

2D images - djohnson - Jul 24, 2004 09:46 PM

For now I will use a 512 x 512 background. In order to scroll the background, I can have 2 textures and then move 2 quads and alternate between the images... Here is what I figured out how to do tonight:

Display the 512 x 512 background in a same sized window.
Display another quad on top of the background.
Allow L,R,U,D arrow keys to move the top quad and detect the walls.
Fire a missle from the current position of the 2nd quad and stop when it hits the top.

Pretty good for one night of really trying out OpenGL.

2D images - kelvin - Jul 24, 2004 11:25 PM

For a static background there's always the option to do glBitmap with no constraint on size other than the max unpack line width (usually 1024 for rage128 and 2048 for newer cards).