#include <GL/glew.h>
#include <GL/glut.h>
void Crosshair(){
//...
}
void Wall1(){
//..
}
void Wall2(){
//..
}
void Mouse_Actions(int x,int y){
//..
}
void Visible(){
glClearColor(0.0,0.0,0.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
Crosshair();
Mouse_Actions();
Wall1();
Wall2;
glTranslatef(0.0,0.0,-5.0);
glFlush();
}
void Settings(int width,int height){
glViewport(0,0,(GLsizei)with,(GLsizei)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(105,(float)width/(float)height,1.0,100.0);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc,char *argv[]){
glutInit(&argc,argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(50,150);
glutCreateWindow("Try Crosshair On The Walls");
glutInitDisplayMode(0);
glutDisplayFunc(Visible);
glutIdleFunc(Visible);
glutReshapeFunc(Settings);
gluPassiveMotionFunc(Mouse_Actions);
glutMainLoop();
}
I can fix my crosshair.But my crosshair is staying behind my walls.How can i take my crosshair front my walls?