[gameprogrammer] [OpenGL] ahhh!!!! no fog boys!!!
- From: "Yasser Gonzalez Soto" <yassergs@xxxxxxxxxxxxxxx>
- To: "gameprogrammerlist" <gameprogrammer@xxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 12:59:06 +0200
Sorry for a silly topic name. This is my trouble:
#include <GL\gl.h>
#include <GL\glu.h>
#include <GL\glut.h>
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(1.0);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
}
void MakeFog()
{
GLfloat fog_color[4]={2.0,0.0,1.0,0.5};
glEnable(GL_FOG);
glFogfv(GL_FOG_COLOR,fog_color);
glFogf(GL_FOG_START,0.2);
glFogf(GL_FOG_END,50.0);
glFogi(GL_FOG_MODE,GL_LINEAR);
}
void display()
{
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0,0.0,-2.5);
MakeFog();
glBegin(GL_TRIANGLES);
glColor3f(1.0,2.0,0.2);
glVertex3f(0.0,-1.0,0.0);
glVertex3f(-1.0,1.0,0.0);
glVertex3f(1.0,1.0,0.0);
glEnd();
glFlush();
glutSwapBuffers();
}
void resize(int w, int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0f,(GLfloat)w/(GLfloat)h,1.0,50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void keyboard(unsigned char k, int x, int y)
{
if(k==27)
{
exit(0);
}
}
int main(int argc, char *argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);
glutInitWindowPosition(10,10);
glutInitWindowSize(600,600);
glutCreateWindow("Un poco de niebla");
init();
glutDisplayFunc(display);
glutReshapeFunc(resize);
glutMainLoop();
return 0;
}
NO FOG, NO FOG AT ALL
PLease Help.
WE'LL SEE YA AROUND
--
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
For all your IT requirements visit: http://www.transtec.co.uk
Other related posts:
- » [gameprogrammer] [OpenGL] ahhh!!!! no fog boys!!!