Jump to content
  • Advertisement
Sign in to follow this  
nick--

OpenGL - drawing directly to buffer?

This topic is 4480 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 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
Advertisement
For just a background image that is not projected, you can use glDrawPixels().

If your large picture is projected (i.e. on a surface within your 3D world) you have to make textures for it, and the maximum texture size is 256×256.

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
Okay, so perhaps my knowledge is a little outdated :P. On my card, a couple of years ago when I was testing this crap, textures larger than 256×256 wouldn't load.

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!