Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Help Me Find a Solution


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Jethro_T   Members   -  Reputation: 168

Like
0Likes
Like

Posted 20 July 2014 - 09:56 PM

I'm trying to figure out the best way to render some per-pixel destructible terrain.  Right now I load my map image into a series of textures (tiles) and keep the raw texture data stored in memory.  When the terrain is destroyed, I simply update my copy of the pixel data and use glTexSubImage2D to update the corresponding textures on the GPU.  Of course this is terrible because I'm wasting memory keeping a copy of the images around.  I'm using OpenGL ES 2.0 so I can't use glGetTexImage to grab the texels from the GPU, update them, then re-upload them.

 

I think a good solution would be to create and store a bitmask with the dimensions of the map image, with a single bit per pixel and simply store either a 0 or 1 depending on if the pixel has been destroyed or not.  If I do that, I need some sort of method to combine the textures with this bitmask to decide which pixels need to be rendered.  Is there some way I can accomplish this using blending or by uploading my mask to a pixel shader and rendering only the texels that have their mask bit set to 1?

 

Cheers to whoever can help me figure something out.


Edited by Jethro_T, 20 July 2014 - 09:57 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS