neverland
01-11-2006, 08:32 PM
Hello All
I am reading "The Red Book" 4th edition. In chapter 6 the book introduces a blend function called glBlendEquation.
I wrote a program using it. The code was successfully compiled, but an error occured when I ran it.
#include <Windows.h>
#include <gl/glew.h>
#include <gl/glut.h>
void init()
{
glClearColor(1.0, 1.0, 0.0, 0.0);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glBlendEquation(GL_FUNC_ADD); // this line causes a run-time error!
glRectf(-0.5, -0.5, 0.5, 0.5);
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("Blend Equation");
init();
glutDisplayFunc(display);
glutMainLoop();
}anything wrong?
P.S. My graphics card is Geforce FX5700 which dose support GL_ARB_imaging extension.
I am reading "The Red Book" 4th edition. In chapter 6 the book introduces a blend function called glBlendEquation.
I wrote a program using it. The code was successfully compiled, but an error occured when I ran it.
#include <Windows.h>
#include <gl/glew.h>
#include <gl/glut.h>
void init()
{
glClearColor(1.0, 1.0, 0.0, 0.0);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glBlendEquation(GL_FUNC_ADD); // this line causes a run-time error!
glRectf(-0.5, -0.5, 0.5, 0.5);
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("Blend Equation");
init();
glutDisplayFunc(display);
glutMainLoop();
}anything wrong?
P.S. My graphics card is Geforce FX5700 which dose support GL_ARB_imaging extension.