PDA

View Full Version : GL, 16bit, 32bit,


ChrisD
2002.08.02, 11:37 AM
1. How do I set the GL context to be 16 bit?

2. How do I set the GL context to be 32?

3. How do I set textures to be 16 bit or 32bit?


Ok does the context buffer simplt match the current screen depth?

Mars_999
2002.08.02, 05:57 PM
AFAIK, however you setup your RC to OpenGL sets up your bit depth. I use SDL so I tell SDL to run in 32bit mode and OpenGL is good to go. Not sure what API your using? Cocoa or Carbon? If they are either of those two I can't help you. =)

OneSadCookie
2002.08.02, 07:59 PM
When you request a pixel format, you can pass an option for color depth, choosing either 16 or 32-bit. I'm pretty sure you'll match the screen resolution anyway, though, regardless of what you say...

You can upload textures in 16-bit using GL_RGBA_1_5_5_5_REV_EXT as your format. I don't know if this is useful or not, though, since it seems likely that GL will downsample your textures to 16-bit for you if you've got a 16-bit context.

ChrisD
2002.08.02, 11:50 PM
Originally posted by Mars_999
AFAIK, however you setup your RC to OpenGL sets up your bit depth. I use SDL so I tell SDL to run in 32bit mode and OpenGL is good to go. Not sure what API your using? Cocoa or Carbon? If they are either of those two I can't help you. =)

Im using AGL....
This is the Apple GL extension lib.
See the AGL PDF with the apple GL SDK.

I think this would be used only with carbon since
cocoa has its own classes for setting up GL.

ChrisD
2002.08.02, 11:55 PM
Originally posted by OneSadCookie
When you request a pixel format, you can pass an option for color depth, choosing either 16 or 32-bit. I'm pretty sure you'll match the screen resolution anyway, though, regardless of what you say...

You can upload textures in 16-bit using GL_RGBA_1_5_5_5_REV_EXT as your format. I don't know if this is useful or not, though, since it seems likely that GL will downsample your textures to 16-bit for you if you've got a 16-bit context.

Pixel format....
I tired this short of thing....

// OpenGL compliant HWA renderer
GLint attrib[] = { AGL_RGBA, AGL_ACCELERATED, AGL_DOUBLEBUFFER, AGL_DEPTH_SIZE, 16, AGL_PIXEL_SIZE, 16, AGL_NONE };

Is this what you mean...

I can't tell if GL is giving 16 bit or not.

Maybe I can ask it what it gave me?

inio
2002.08.03, 12:15 AM
Originally posted by ChrisD
I can't tell if GL is giving 16 bit or not.

Maybe I can ask it what it gave me?

AFAIK, OpenGL gives you whatever the current screen depth is. If you want a 16bpp environment, you have to switch the screen to 16bpp. I believe Apple's SetupGL (http://developer.apple.com/samplecode/Sample_Code/Graphics_3D/Carbon_SetupGL.htm) sample code does this.

OneSadCookie
2002.08.03, 12:53 AM
You can indeed query the pixel format for its exact spec. Just look in agl.h, all that stuff's there and obvious.

I think maybe you want COLOR_SIZE rather than PIXEL_SIZE? Not quite sure...