#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();
}
a problem about glBlendEquation function
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.
code:
anything wrong?
glBlendEquation () is not part of the core OpenGL functions. You should check for GL_ARB_imaging extension before using it. I guess your hardware doesn't support that extension.
Quote:Original post by Skeleton_V@T
glBlendEquation () is not part of the core OpenGL functions. You should check for GL_ARB_imaging extension before using it. I guess your hardware doesn't support that extension.
My graphics card is Geforce FX5700 which dose support GL_ARB_imaging extension.
And I've updated OpenGL driver to 2.0.
Any other reason?
ive never used glew but i think u need to call a function before u can use it to setup the extension points (ie just including the header aint enuf) eg
init_glew();
glBlendEquation is part of gl1.2 i think + gffx supports it in hardware
also GL_FUNC_ADD is just normal blending use GL_LOGIC_OP for some different blending methods ( coincidently i was playing around with today)
init_glew();
glBlendEquation is part of gl1.2 i think + gffx supports it in hardware
also GL_FUNC_ADD is just normal blending use GL_LOGIC_OP for some different blending methods ( coincidently i was playing around with today)
Quote:Original post by zedzeek
ive never used glew but i think u need to call a function before u can use it to setup the extension points (ie just including the header aint enuf) eg
init_glew();
glBlendEquation is part of gl1.2 i think + gffx supports it in hardware
also GL_FUNC_ADD is just normal blending use GL_LOGIC_OP for some different blending methods ( coincidently i was playing around with today)
I couldn't find glBlendEquation ni gl.h, so I googled.
And I found the GLEW library which includes glBlendEquation, but I don't know how to use it.
If I don't use GLEW library, is there any other method could let me use the extensions in OpenGL 1.2 or later?
You may try OpenGL Easy Extension (a.k.a GLee) library. Before using any OpenGL extensions, you check for it's availability roughly like this:
To use GLee in your project, you need to include GLee.h, put it's header and library files into default Include and Lib directories, and that's all.
if (GLEE_ARB_multitexture) //is multitexture support available?{ glMultiTexCoord2fARB(...); //safe to use multitexture}
To use GLee in your project, you need to include GLee.h, put it's header and library files into default Include and Lib directories, and that's all.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement