Ok, short question
how do u use ortho. I found something on it at www.gametutorials.com but i havnt managed to get it to work:
here is my code:
void OrthoMode(int left, int top, int right, int bottom)
{
// Switch to our projection matrix so that we can change it to ortho mode, not perspective.
glMatrixMode(GL_PROJECTION);
// Push on a new matrix so that we can just pop it off to go back to perspective mode
glPushMatrix();
// Reset the current matrix to our identify matrix
glLoadIdentity();
//Pass in our 2D ortho screen coordinates.like so (left, right, bottom, top). The last
// 2 parameters are the near and far planes.
glOrtho( left, right, bottom, top, -1, 1 );
// Switch to model view so that we can render the scope image
glMatrixMode(GL_MODELVIEW);
// Initialize the current model view matrix with the identity matrix
glLoadIdentity();
}
void PerspectiveMode() // Set Up A Perspective View
{
// Enter into our projection matrix mode
glMatrixMode( GL_PROJECTION );
// Pop off the last matrix pushed on when in projection mode (Get rid of ortho mode)
glPopMatrix();
// Go back to our model view matrix like normal
glMatrixMode( GL_MODELVIEW );
// We should be in the normal 3D perspective mode now
}
void DrawRadar()
{
OrthoMode(0, 600, 800, 0);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glColor3f(0.5,0.5,1.0);
glVertex2f(-0.2,0.2);
glVertex2f(0.2,0.2);
glVertex2f(0.2,-0.2);
glVertex2f(-0.2,-0.2);
glEnd();
glBegin(GL_POINTS);
glColor3f(1.0,0.0,0);
glVertex2f(g_Camera.m_vPosition.x/10,g_Camera.m_vPosition.z/10);
glEnd();
glColor3f(1.0,1.0,1.0);
glEnable(GL_TEXTURE_2D);
PerspectiveMode();
}
and my drawGLScene() code:
int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing
{
POINT pt;
GetCursorPos(&pt);
GLfloat tiery = (float)(400 - pt.x)/35;
GLfloat tierx = (float)(300 - pt.y)/35;
crossx = (float)(pt.x/800);
crossy = (float)(pt.y/800);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer // Done Drawing The Triangle
glLoadIdentity();
glEnable(GL_LIGHT1);
glTranslatef(0, -0.3, tiez);
glRotatef(tiery,0,1,0);
glRotatef(tierx,1,0,0);
TieFighter();
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glNormal3f(0.0f,0.0f,0.0f);
glVertex3f(crossx,crossy,-6);
glVertex3f(crossx-0.03,crossy-0.03,-6);
glVertex3f(crossx+0.03,crossy-0.03,-6);
glColor3f(1,1,1);
glEnd();
glPushMatrix();
glTranslatef(-0.1, 0, -0.01);
DrawParticles(TexID[1],1.0f,1.0f,1.0f,50.0,0.03);
glTranslatef(0.2, 0, 0);
DrawParticles(TexID[1],1.0f,1.0f,1.0f,50.0,0.03);
glPopMatrix();
//I DRAW RADAR HERE
glPushMatrix();
glLoadIdentity();
DrawRadar();
glPopMatrix();
// // //
gluLookAt(g_Camera.m_vPosition.x, g_Camera.m_vPosition.y, g_Camera.m_vPosition.z,
g_Camera.m_vView.x, g_Camera.m_vView.y, g_Camera.m_vView.z,
g_Camera.m_vUpVector.x, g_Camera.m_vUpVector.y, g_Camera.m_vUpVector.z);
//........ETC
when i try it out, there is no radar, everything is like it was before.
Anyone have an idea?
-----------------
"Here lies a toppled God,
His fall was not a small one,
We but built his pedastle,
A narrow, and a tall one"
Frank Herbert (Dune:Messiah)
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)