Jump to content
  • Advertisement
Sign in to follow this  
ShmeeBegek

Copying a 2-bit image to the depth buffer

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

Hello, I have a peculiar situation which I thought that I would run by whoever might read this. I need to copy a 2 bit bitmap into the depth buffer, and up until now I have been converting to floats and using glDrawPixels to draw it to the depth buffer. This is quite inefficient although it has been adequate, but now I would like to get the algorithm working a bit faster. It's a shame that it has to be two bits of course... otherwise I could just use glBitmap, perhaps there is a way to set the pixel transfer mode to add values and call glBitmap twice? All ideas are appreciated, Thanks, ~SPH

Share this post


Link to post
Share on other sites
Advertisement
2bits thus either 0 or 1.
one way would be clear the screen so its all 0's and then enable alpha testing gl_graeter than 0.0, and then draw your texture (countaining the 2bit data, perhaps u need to change this to 8bit by simply multiplying every number ^8 ) on the screen

Share this post


Link to post
Share on other sites
Just for clarification:
1 bit = 0 to 1
2 bit = 0 to 3

Thus, an image with only two colors would be 1 bit, whereas an images with greater than 2 and less than 4 would be 2 bit.

Share this post


Link to post
Share on other sites

To zedzeek:

That would be a good method if I had a 1-bit Bitmap, but as I said my bitmap is 2 bits. Two to the second power is 4, there are 4 possibilities (0 to 3).

To bytecoder:

Was this a response to zedzeek? Seems like you were correcting him on 2 bits meaning 0 or 1 as well.

Thanks for all help, ~SPH

Share this post


Link to post
Share on other sites
sorry about that
post the small piece of code where u convert it

also u might wanna look at uploading it into a already existing texture and drawing that to the screen

Share this post


Link to post
Share on other sites

That's what I do right now, draw it (very slowly) and then copy it to a texture, then for future drawing I simply put that texture up to the screen. Perhaps this cannot be easily avoided (without the use of Shaders, which I need to avoid in this project)?

Thanks, ~SPH

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!