Archived

This topic is now archived and is closed to further replies.

GreyWolfSftwre

Unusual runtime occurrance...grrr

Recommended Posts

!!!Nevermind, I found the problem!!! I am currently working on a program, and have experienced some unusual output. The following code is the display code for my program. I have run the code multiple times, and though squareFace.LookAt( ... ) evaluates to true, the square told to display within the if statement is not displayed. This would lead me to believe that there is a problem with that code, BUT if I change the position of the camera (camPos), so that yrot == 0, squareFace.LookAt( ... ) still will evaluate to true when it should, but the square IS displayed. WTF!? This is so annoying, why the frell is it not displaying my square? bool firstTime = true; int DrawGLScene() { glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); int rows = thSector.heights.numrows(), cols = thSector.heights.numcols(); if ( firstTime ) { xpos = 12.5; ypos = 2.5; zpos = 10; yrot = -45; xrot = 0; firstTime = false; } glRotated( xrot, 1.0f, 0.0f, 0.0f ); glRotated( yrot, 0.0f, 1.0f, 0.0f ); glRotated( zrot, 0.0f, 0.0f, 1.0f ); glTranslated(-xpos,-ypos,-zpos); camPos = Position( xpos, ypos, zpos ); // squareFace glColor3f( 0.0f, 1.0f, 0.0f ); glBegin( GL_QUADS ); glVertex3d( 0, 0, 0 ); glVertex3d( 5, 0, 0 ); glVertex3d( 5, 5, 0 ); glVertex3d( 0, 5, 0 ); glEnd(); // True/False LookAt indicator glColor3f( 0.0f, 0.0f, 0.0f ); if ( squareFace.LookAt( camPos, xrot, yrot ) ) { glBegin( GL_QUADS ); glVertex3d( -2, -2, 0 ); glVertex3d( 7, -2, 0 ); glVertex3d( 7, 7, 0 ); glVertex3d( -2, 7, 0 ); glEnd(); } // Terrain glColor3f( 1.0f, 1.0f, 1.0f ); glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin( GL_QUADS ); for ( int i = 0; i < rows-1; i++ ) { for ( int j = 0; j < cols-1; j++ ) { glTexCoord2f(0.0f, 0.0f); glVertex3d( 5*i, thSector.heights[j], 5*j ); glTexCoord2f(1.0f, 0.0f); glVertex3d( 5*(i+1), thSector.heights[i+1][j], 5*j ); glTexCoord2f(1.0f, 1.0f); glVertex3d( 5*(i+1), thSector.heights[i+1][j+1], 5*(j+1) ); glTexCoord2f(0.0f, 1.0f); glVertex3d( 5*i, thSector.heights[i][j+1], 5*(j+1) ); } } glEnd(); return true; } !!!Nevermind, I found the problem!!! ~Phoenix [edited by - GreyWolfSftwre on November 14, 2003 7:10:20 PM]

Share this post


Link to post
Share on other sites