Debugger
12-30-2006, 04:19 AM
Hi, all
I have a piece of code which using function glBlendEquation, but I can't compile this program successfully, the compiler said glBlendEquation was not declared, so I think maybe my header files became older, such as gl.h, glu.h..., or that it is due to something else?
where can i get the latest one ?
BTW:I am using WINXP-SP2&VS2005
here is my code:
#include <windows.h>
#include <GL/glut.h>
void init(void)
{
glClearColor(1.0, 1.0, 0.0, 0.0) ;
glBlendFunc(GL_ONE, GL_ONE) ;
glEnable(GL_BLEND) ;
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT) ;
glColor3f(0.0, 0.0, 1.0) ;
glRectf(-0.5, -0.5, 0.5, 0.5) ;
glFlush() ;
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h) ;
glMatrixMode(GL_PROJECTION) ;
glLoadIdentity() ;
if(w<=h)
glOrtho(-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0) ;
else
glOrtho(-1.5*(GLfloat)w/(GLfloat)h,
1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0) ;
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity() ;
}
void keyboard(unsigned char key, int x, int y)
{
switch(key)
{
case 'a':
case 'A':
glBlendEquation(GL_FUNC_ADD) ;
break ;
case 's':
case 'S':
glBlendEquation(GL_FUNC_SUBTRACT) ;
break ;
case 'r':
case 'R':
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT) ;
case 'm':
case 'M':
glBlendEquation(GL_MIN) ;
break ;
case 'x':
case 'X':
glBlendEquation(GL_MAX) ;
break ;
case 27:
exit(0) ;
break ;
}
glutPostRedisplay() ;
}
int main(int argc, char **argv)
{
glutInit(&argc, argv) ;
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB) ;
glutInitWindowSize(200, 200) ;
glutCreateWindow(argv[0]) ;
init() ;
glutReshapeFunc(reshape) ;
glutKeyboardFunc(keyboard) ;
glutDisplayFunc(display) ;
glutMainLoop() ;
return 0 ;
}
I have a piece of code which using function glBlendEquation, but I can't compile this program successfully, the compiler said glBlendEquation was not declared, so I think maybe my header files became older, such as gl.h, glu.h..., or that it is due to something else?
where can i get the latest one ?
BTW:I am using WINXP-SP2&VS2005
here is my code:
#include <windows.h>
#include <GL/glut.h>
void init(void)
{
glClearColor(1.0, 1.0, 0.0, 0.0) ;
glBlendFunc(GL_ONE, GL_ONE) ;
glEnable(GL_BLEND) ;
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT) ;
glColor3f(0.0, 0.0, 1.0) ;
glRectf(-0.5, -0.5, 0.5, 0.5) ;
glFlush() ;
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h) ;
glMatrixMode(GL_PROJECTION) ;
glLoadIdentity() ;
if(w<=h)
glOrtho(-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0) ;
else
glOrtho(-1.5*(GLfloat)w/(GLfloat)h,
1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0) ;
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity() ;
}
void keyboard(unsigned char key, int x, int y)
{
switch(key)
{
case 'a':
case 'A':
glBlendEquation(GL_FUNC_ADD) ;
break ;
case 's':
case 'S':
glBlendEquation(GL_FUNC_SUBTRACT) ;
break ;
case 'r':
case 'R':
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT) ;
case 'm':
case 'M':
glBlendEquation(GL_MIN) ;
break ;
case 'x':
case 'X':
glBlendEquation(GL_MAX) ;
break ;
case 27:
exit(0) ;
break ;
}
glutPostRedisplay() ;
}
int main(int argc, char **argv)
{
glutInit(&argc, argv) ;
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB) ;
glutInitWindowSize(200, 200) ;
glutCreateWindow(argv[0]) ;
init() ;
glutReshapeFunc(reshape) ;
glutKeyboardFunc(keyboard) ;
glutDisplayFunc(display) ;
glutMainLoop() ;
return 0 ;
}