Jump to content
  • Advertisement
Sign in to follow this  
A_SN

Texture frequently updated from array

This topic is 3317 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

Here's what I'm trying to do : I have a fairly large bitmap of arbitrary dimensions in an array (under the form uint32_t *array) that is frequently updated (up to 60 times a second) and that I'm trying to display flat on the screen (like an in-game minimap if you will). Since unlike a regular texture it's updated very often and its dimensions aren't a power of two the proper efficient way to do it should be quite unlike creating a regular texture, am I right? So what would be the appropriate way to do it? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
How about DrawPixels? You also can use PixelZoom (not sure if that name is correct) to change the output size of the bitmap when displaying it.

Share this post


Link to post
Share on other sites
Quote:
Original post by A_SN
Here's what I'm trying to do : I have a fairly large bitmap of arbitrary dimensions in an array (under the form uint32_t *array) that is frequently updated (up to 60 times a second) and that I'm trying to display flat on the screen (like an in-game minimap if you will).

Since unlike a regular texture it's updated very often and its dimensions aren't a power of two the proper efficient way to do it should be quite unlike creating a regular texture, am I right? So what would be the appropriate way to do it?
All modern cards support the ARB_texture_non_power_of_two extension, which allows you to create arbitrary shaped textures. Previous generation cards support ARB_texture_rectangle, which is a more limited extension along the same lines.

If you have one of these extensions available, it should be as simple as creating the texture once, and then updating the texture data whenever necessary with glTexSubImage2D().

Share this post


Link to post
Share on other sites
Quote:
Original post by surfi
How about DrawPixels? You also can use PixelZoom (not sure if that name is correct) to change the output size of the bitmap when displaying it.


Thanks a lot! Just tried that and it works great.

Share this post


Link to post
Share on other sites
Quote:
Original post by A_SN
Quote:
Original post by surfi
How about DrawPixels? You also can use PixelZoom (not sure if that name is correct) to change the output size of the bitmap when displaying it.
Thanks a lot! Just tried that and it works great.
Be aware that glDrawPixels will often be slower than the texture upload method, and support under recent drivers can be a little iffy.

Share this post


Link to post
Share on other sites
Ack, there's a problem with glDrawPixels, it displays my bitmap upside down.. Any way to make OpenGL flip it? glPixelZoom is useless since it rotates around the 0 coordinates.

EDIT: Nevermind, worked it out.

Quote:
Original post by swiftcoder
Quote:
Original post by A_SN
Quote:
Original post by surfi
How about DrawPixels? You also can use PixelZoom (not sure if that name is correct) to change the output size of the bitmap when displaying it.
Thanks a lot! Just tried that and it works great.
Be aware that glDrawPixels will often be slower than the texture upload method, and support under recent drivers can be a little iffy.


I can see that glDrawPixels isn't so fast in full screen. So far I haven't had any luck with glTexSubImage2D though, all I could get was a blue square...

Share this post


Link to post
Share on other sites
Quote:
Original post by A_SN
I can see that glDrawPixels isn't so fast in full screen. So far I haven't had any luck with glTexSubImage2D though, all I could get was a blue square...
Make sure you created the texture (using glTexImage2D) first - glTexSubImage2D only updates an existing texture.

Share this post


Link to post
Share on other sites
If you need even more speed you can transfer texture using a PBO, that way you might get DMA transfer from CPU to GPU.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by A_SN
I can see that glDrawPixels isn't so fast in full screen. So far I haven't had any luck with glTexSubImage2D though, all I could get was a blue square...
Make sure you created the texture (using glTexImage2D) first - glTexSubImage2D only updates an existing texture.


Quote:
Original post by mrr
If you need even more speed you can transfer texture using a PBO, that way you might get DMA transfer from CPU to GPU.


Using glDrawPixels is unpractically slow on my 10 year old Power Mac G4 450 MHz with an ATI Rage 128 AGP, I get like 5 FPS on a 1000x700 window, would any of those alternatives make it any faster for such old machines with slow GPUs?

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!