Jump to content
  • Advertisement
Sign in to follow this  
Xero-X2

Problems with Nvidia Cubemap

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

On my ATI 9800 I get this nice normalization cubemap On a geforce 6800 LE I get code used to generate cubemap


//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 );


Any ideas why this would happen?

Share this post


Link to post
Share on other sites
Advertisement
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

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!