Jump to content
  • Advertisement
Sign in to follow this  
dimensionX

OpenGL 16 bit fixed-point pbuffer

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

To create a 8 bit fixed point pbuffer:- int piAttribs[] = {WGL_SUPPORT_OPENGL_ARB, GL_TRUE, WGL_DRAW_TO_PBUFFER_ARB, GL_TRUE, WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV, GL_TRUE, WGL_RED_BITS_ARB, 8, WGL_GREEN_BITS_ARB, 8, WGL_BLUE_BITS_ARB, 8, WGL_AUX_BUFFERS_ARB, 2, 0}; float pfAttribs[] = {0.0, 0.0}; int pFormat = 0; unsigned int npFormats; if(!wglChoosePixelFormatARB(hOldDC, piAttribs, pfAttribs, 1, &pFormat, &npFormats)) { cerr << "Error: Could not find a suitable pixel format" << endl; exit(1); } int pbAttribs[] = {WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_RECTANGLE_NV, WGL_TEXTURE_FORMAT_ARB, WGL_TEXTURE_RGB_ARB, WGL_PBUFFER_LARGEST_ARB, 0, 0}; pBuffer = wglCreatePbufferARB(hOldDC, pFormat, org.cols, org.rows, pbAttribs); if(!pBuffer) { cerr << "Error: wglCreatePbufferARB failed" << endl; exit(1); } It creates the pbuffer without any problems. I can even create a 8/16/32 bit floating point pbuffer without any problem. But, when I try to create a 16/32-bit fixed point pbuffer, it returns with "Error: wglCreatePbufferARB failed" How to get around this problem. I am using NVIDIA QuadroFX 3400.

Share this post


Link to post
Share on other sites
Advertisement
You don't.

If you use non-floating point, you can get a 32-bit framebuffer as max, that is 8 bits for each color + 8 bits for alpha.

So, if you really need more, use floating point.

(this is all from experience with my card, check supported pixelformats to see what your card can do)

Share this post


Link to post
Share on other sites
Thanks!

NVIDIA QuadroFX 3400 supports floating point pbuffers in hardware but QuadroFX 3000G doesn't. When I try to run the fp32 pbuffer code on QuadroFX 3400, it is pretty fast but when I run the same code on QuadroFX 3000G, it takes about 1 minute to render into the fp32 pbuffer. I think it tries to emulate in software. This why I want to create a 16/32-bit fixed-point pbuffer. I guess this is not possible either.

Anyone who knows a solution this please post it here.

Share this post


Link to post
Share on other sites
You could use a 24 or 32 bit fixed point pbuffer and use shaders to pack the value into the different channels. _the_phantom_ (I believe it was him) has posted code for packing and unpacking in glsl shaders before, so search around for that. If you have never used shaders before, there are lots of tutorials around the net to help get you started.

Share this post


Link to post
Share on other sites
I din't understand what ur trying to say.

I particularly want to create a 16/32-bit per channel pbuffer not an 8-nit per channel pbuffer.

Also I am just curious how people are doing bitwise operations inside any (Cg, GLSL) shaders. I guess the specification says, bitwise operations are not supported on the GPU's. I would be very interested to know how this is done.

Share this post


Link to post
Share on other sites
Quote:
Original post by dimensionX
I din't understand what ur trying to say.

I particularly want to create a 16/32-bit per channel pbuffer not an 8-nit per channel pbuffer.
Oh okay, I misunderstood and thought you only needed to pass one float. For doing that you can do the packing into a 4-channel fixed point pbuffer trick.

Quote:
Original post by dimensionX
Also I am just curious how people are doing bitwise operations inside any (Cg, GLSL) shaders. I guess the specification says, bitwise operations are not supported on the GPU's. I would be very interested to know how this is done.
It's just done with a vector multiplication and appropriate packing variables, so no need for bit fiddling. Let me look and try to find it...

EDIT: Here's the post with the packing/unpacking shaders.

EDIT2: Perhaps you could use multiple render targets rendering to different aux buffers on a fixed-point pbuffer with the packing shaders. But if it's a card that doesn't support floating point pbuffers, maybe it wouldn't support multiple render targets either. Oh well, it's the best I can think of for right now. Good luck!

[Edited by - Kalidor on April 26, 2005 3:21:54 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!