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.
What kind of error do you mean ? does the application crasch or what ?
What OS are you using, this function is not part of the basic 1.1 OpenGL, I think it came in 1.2 or so, you need correct drivers for your hardware.
So if you are running a software only 1.1 OpenGL or something like that the function is not available.
Use glGetString( GL_VERSION) after you have set up the rendering context to get version number.
Mikael
Originally posted by mikael_aronsson:
[b]What kind of error do you mean ? does the application crasch or what ?
What OS are you using, this function is not part of the basic 1.1 OpenGL, I think it came in 1.2 or so, you need correct drivers for your hardware.
So if you are running a software only 1.1 OpenGL or something like that the function is not available.
Use glGetString( GL_VERSION) after you have set up the rendering context to get version number.
Mikael[/b]
The OS is WinXP SP2.
The error is when I run the program a dialog shows up. I am not using the English version OS, so I cannot get what exactly the error says in English. It is like “there is something wrong with your program and it wiil be terminated” something.
And I checked the GL_VERSION on my machine, I got 2.0.0
So this couldn’t be a hardware nor diver problem.
Any other reason?