Sign in to follow this  
nick--

OpenGL - drawing directly to buffer?

Recommended Posts

Hi, I m trying to build a base framework for a 2d-scrolling game i plan to make, I would like to have a background image in that will not be built of tiles , a plain image. Now loading this into opengl as many small textures and drawing them seems silly to me as it is only 1 image after all (the image should be pretty big.. at least 4000x4000 if not more). Is it possible to directly access the buffers of opengl and just copy the bitmap directly into memory? (thus saving the whole texture generation + object management for each of the 'squares') Thanks in advance

Share this post


Link to post
Share on other sites
Quote:
Original post by Bob Janova
the maximum texture size is 256×256.


That's not true. To determine the maximum texture size, you need to use glGet*() with GL_MAX_TEXTURE_SIZE. The value it gives you is the maximum square texture size (if it returns 1024, then you can use a 1024x1024 texture). If you're not using a square texture, then you have to get the dimensions another way. See this for more info.

[EDIT]
Incase you can't find the part I'm talking about, it's the second paragraph under the 'Description' heading.

Share this post


Link to post
Share on other sites
glDrawPixels will probably be *slow*. Better just draw a screen-filling textured quad. The maximum texture size is nowhere near as little as 256x256 on even somewhat modern-resembling cards; for example, my GeForce 6600GT supports texture sizes up to 4096x4096. And if the limit is too low, you can always split the huge image into smaller parts.

Share this post


Link to post
Share on other sites
Basically, with enough VRAM, textures can be any size, given their dimensions are powers of 2.

What you can do:
Have 2 Render passes, first one in orthogonal view, drawing one screen-filling quad bound to the background image's texture.
Then, in the second pass, render your other stuff in projected view.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this