| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hi,
We’re using GL_NV_texture_shader3 extension to perform some kind of color conversion based on profiles. The original code was taken from somewhere on the internet. On most cards it works well but on some cards the results is a totally white view port.
The cards that do not work are 8600M and 8800GT.
The code looks something like this:
static boost::shared_array<char> s_lastColorMapData;
// s_conversionTextures hold two texture objects (view port and color conversion map)
if (colorTransformChanged) {
// Code to update the color map data in s_lastColorMapData if needed
// setup 3d texture with color transform data
glEnable(GL_TEXTURE_3D);
glActiveTextureARB (GL_TEXTURE1_ARB);
glBindTexture (GL_TEXTURE_3D, s_conversionTextures[1]);
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexImage3D(GL_TEXTURE_3D, 0, components, gridSize, gridSize, gridSize, 0, format, type, s_lastColorMapData .get());
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
}
// set up textures for drawing
glActiveTextureARB (GL_TEXTURE0_ARB);
glBindTexture (GL_TEXTURE_3D, s_conversionTextures[1]); // tex[1] already contains viewport image obtained with readPixels
glEnable (GL_TEXTURE_2D);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
::glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glActiveTextureARB (GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_3D);
glBindTexture (GL_TEXTURE_3D, s_conversionTextures[1]);
// setup shader
glEnable (GL_TEXTURE_SHADER_NV);
glTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_DEPENDENT_RGB_TEXTURE_3D_NV);
glTexEnvi (GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glActiveTextureARB (GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
glTexEnvi (GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
DrawVP(); // This code draws a single quad the size of the viewport stretching both textures on it.
// disable shader
glDisable(GL_TEXTURE_SHADER_NV);
Are we doing something wrong here, or is there a bug in the drivers?
Thanks
Yaron Tadmor
_______________________________________________ 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
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.