//Varibles
UINT * Tex;
int RES;
void Render();
int ViewPort[4];
glGetIntegerv( GL_VIEWPORT, ViewPort );
glGenTextures( 1, Tex );
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
glViewport( 0, 0, RES + 2, RES + 2 ); // Reset The Current Viewport
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
gluPerspective( 90.0f, 1, 0.1f, 150.0f );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt( 00, 00, 00, 0, 0, -1, 0, -1, 0 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glLoadIdentity();
gluLookAt( 00, 00, 00, -1, 0, 0, 0, -1, 0 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glLoadIdentity();
gluLookAt( 00, 00, 00, 0, 0, 1, 0, -1, 0 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glLoadIdentity();
gluLookAt( 00, 00, 00, 1, 0, 0, 0, -1, 0 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glLoadIdentity();
gluLookAt( 00, 00, 00, 0, 1, 0, 0, 0, 1 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glLoadIdentity();
gluLookAt( 00, 00, 00, 0, -1, 0, 0, 0, -1 );
Render();
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, * Tex );
glCopyTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, GL_RGB, 1, 1, RES, RES, 0 );
glMatrixMode( GL_PROJECTION );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glViewport( ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3] ); // Reset The Current Viewport
glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, 0 );
Problems with Nvidia Cubemap
On my ATI 9800 I get this nice normalization cubemap
On a geforce 6800 LE I get
code used to generate cubemap
Any ideas why this would happen?
dont know if this is the cause but
try adding a slight offset to the lookat parameter eg
float off = 0.0001;
gluLookAt( off,off,off, 0, 0, -1, 0, -1, 0 );
to see why, create your own lookat function and step through it with the debugger
try adding a slight offset to the lookat parameter eg
float off = 0.0001;
gluLookAt( off,off,off, 0, 0, -1, 0, -1, 0 );
to see why, create your own lookat function and step through it with the debugger
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement