Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with creating a float pbuffer with CGL/AGL



Hi,
I have been trying to get a float pbuffer working on my powerbook (radeon
9600). I can create a pbuffer in either CGL or AGL without any problems,
but they seem to be clamped between 0 and 1. They also are not full
precision floats, even though the created pixel format is 128 bit and
does
use float pixels. The values read back are not however fractions of 255,
which indicates they are some kind of fixed floating point values.
The simplest test was to do a glClear with negative color values or values
>1. In linux i get the correct values from a readback if i create the
context
and the pbuffer using the glx commands for it, but in OSX they are
clamped.

Is it possible to get non-clamped values from a pbuffer in OSX?

Here's the code i use to create the buffers with CGL. The agl versiosn is
almost identical.

CGLPBufferObj _hPBuffer;
CGLContextObj _hPBContext;
long int _hPBscreen;

void activatePBuffer(){
    CGLSetCurrentContext(_hPBContext);
    CGLSetPBuffer(_hPBContext, _hPBuffer, 0, 0, _hPBscreen);
}

void createPBuffer(int width, int height){
	CGLPixelFormatAttribute		attribs[32];
	GLint		ind = 0;
    ATTR_ADD(kCGLPFAAllRenderers);
    ATTR_ADD(kCGLPFAColorFloat);
    ATTR_ADDV(kCGLPFAColorSize, 128);
    ATTR_ADD(kCGLPFAAccelerated);
    ATTR_ADD(kCGLPFANoRecovery);
    ATTR_ADD(kCGLPFAPBuffer);
    ATTR_ADD(AGL_NONE);
    long int nScreens=0;
    CGLPixelFormatObj pix;
    CGLChoosePixelFormat( attribs, &pix, &nScreens );
    CGLCreateContext( pix, NULL , &_hPBContext);
    CGLError err = CGLCreatePBuffer(width, height,
GL_TEXTURE_RECTANGLE_ARB, GL_RGBA, 0, &_hPBuffer);
    printf("Failed to create pbuffer? %i\n", err);
    CGLGetVirtualScreen(_hPBContext, &_hPBscreen);
}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.