
radeon 9000 pro... my cpu is a peice of trash though, which I''m expecting would explain the frame rate...
| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |
glBegin(GL_POLYGON);glVertex3f(1024, 20, 1024);glVertex3f(1024, 20, 0);glVertex3f(0, 20, 0);glVertex3f(0, 20, 1024);glEnd();
glViewport(0, 0, 512, 512); glPushMatrix(); glScalef(1.0f, -1.0f, 1.0f);
glViewport(0, 0, 512, 512); glPushMatrix(); glTranslatef(0, 40.0f, 0); glScalef(1.0f, -1.0f, 1.0f);
//Water constructor:WATER(GLsizei dimention = 128) { vertices = NULL; Dimen = dimention; //A bit of texture initialization glBindTexture( GL_TEXTURE_2D, reflexture); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, Dimen, Dimen, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); }//------------------------------------------------------------------////- void WATER::Render(void) ------------------------------////------------------------------------------------------------------////- Renders the water plane ----------------------------------------////------------------------------------------------------------------//void WATER::Render(void (*Reflect)(void)){ //Setup texture coordinate equations static GLfloat lsPlaneS[] = {1.0f, 0, 0, 0}; static GLfloat lsPlaneT[] = {0, 1.0f, 0, 0}; static GLfloat lsPlaneR[] = {0, 0, 1.0f, 0}; static GLfloat lsPlaneQ[] = {0, 0, 0, 1.0f}; //Do a bit of reflection //If there is a render funcition if(Reflect) { //Get the old viewport GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); //Generate a new viewport //For the reflected texture glFrontFace(GL_CW); glViewport(0,0,Dimen,Dimen); //Draw the reflection glPushMatrix(); glLoadIdentity(); Reflect(); //Set up scene glPopMatrix(); glFlush(); //Grab the texture glBindTexture( GL_TEXTURE_2D, reflexture); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0 , 0, 0, 0, Dimen, Dimen); //Get ready to draw the scene glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glViewport(viewport[0],viewport[1],viewport[2],viewport[3]); //And back to counter clockwise normals glFrontFace(GL_CCW); //Set up the texture generation glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, lsPlaneS); glTexGenfv(GL_T, GL_EYE_PLANE, lsPlaneT); glTexGenfv(GL_R, GL_EYE_PLANE, lsPlaneR); glTexGenfv(GL_Q, GL_EYE_PLANE, lsPlaneQ); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); glEnable(GL_TEXTURE_GEN_Q); glMatrixMode(GL_TEXTURE); glPushMatrix(); glLoadIdentity(); glTranslatef(0.5f, 0.5f, 0.0f); glScalef(0.5f, 0.5f, 1.0f); gluPerspective(45.0f, (GLfloat)((viewport[2] - viewport[0])/(viewport[1] - viewport[3])), 0.1f, 100.0f ); } float x; float y; for(y=1; y<heightMapHeight-1; y++) { glBegin(GL_TRIANGLE_STRIP); //Render the row as a triangle strip for(x=0; x<heightMapWidth-1; x++) { //glTexCoord2f(0.0f , 0.0f ); glNormal3fv(vertices[(int)((y*heightMapHeight)+x)].v); glVertex3fv(vertices[(int)((y*heightMapHeight)+x)].v); //glTexCoord2f(1.0f , 0.0f ); glNormal3fv(vertices[(int)((y*heightMapHeight)+(x+1))].v); glVertex3fv(vertices[(int)((y*heightMapHeight)+(x+1))].v); //glTexCoord2f(0.0f , 1.0f ); glNormal3fv(vertices[(int)(((y+1)*heightMapHeight)+x)].v); glVertex3fv(vertices[(int)(((y+1)*heightMapHeight)+x)].v); //glTexCoord2f(1.0f , 1.0f ); glNormal3fv(vertices[(int)(((y+1)*heightMapHeight)+(x+1))].v); glVertex3fv(vertices[(int)(((y+1)*heightMapHeight)+(x+1))].v); } glEnd(); } //Restore defaults if(Reflect) { glPopMatrix(); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_R); glDisable(GL_TEXTURE_GEN_Q); }}
glTexGenfv(GL_S, GL_EYE_PLANE, lsPlaneS);glTexGenfv(GL_T, GL_EYE_PLANE, lsPlaneT);glTexGenfv(GL_R, GL_EYE_PLANE, lsPlaneR);glTexGenfv(GL_Q, GL_EYE_PLANE, lsPlaneQ);
glPushMatrix();glLoadIdentity();glTexGenfv(GL_S, GL_EYE_PLANE, lsPlaneS);glTexGenfv(GL_T, GL_EYE_PLANE, lsPlaneT);glTexGenfv(GL_R, GL_EYE_PLANE, lsPlaneR);glTexGenfv(GL_Q, GL_EYE_PLANE, lsPlaneQ);glPopMatrix();