opengl c++: glBlendEquationOES was not declared in this scope error - c++

I assume I am forgeting to include something, but it is odd because i am using other opengl functions. How do I find out what I am not including?

Looks like glBlendEquationOES is only an extension for OpenGLES1.1
In version 2.0 it's a core function, just called glBlendEquation.

Related

Which extension contains glProgramParameteriARB?

According to the documentation glProgramParameteriARB is a part of ARB_geometry_shader4. I have a graphics card which doesn't support ARB_geometry_shader4:
glxinfo | grep ARB_geometry_shader4
When I call glXGetProcAddress((const GLubyte*)glProgramParameteriARB) I get a function address and everything works fine. Does it mean that the documentation has a bug ? How can I find an extension which contains glProgramParameteriARB ?
glXGetProcAddress can be called without having a current OpenGL context (unlike wglGetProcAddress). As such, the function pointers it returns are independent of the current context. Because of that, it will return valid function pointers for any OpenGL function. It uses delayed binding for this kind of stuff.
If you want to know whether you can use a function pointer, check the extension strings, not whether you get a valid pointer.

Use the glDrawBuffer and glReadBuffer functions in Qt

I would like to use the glDrawBuffer and glReadBuffer functions in Qt using Qt Creator. I tried to do this:
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
This code would not compile, it gave me linking errors like this one:
main.obj:-1: error: LNK2019: unresolved external symbol __imp__glDrawBuffer#4 referenced in function "public: void __thiscall Simple3DWidget::OpenGLWindow::render(void)" (?render#OpenGLWindow#Simple3DWidget##QAEXXZ)
This error basically means that the functions were declared in an included header file but not correctly linked.
After searching for this issue on the web, I found out that I have to use the QOpenGLFunctions_3_1 class. I tried both these codes:
QOpenGLFunctions_3_1 m_openGL31Functions;
m_openGL31Functions.glDrawBuffer(GL_NONE);
m_openGL31Functions.glReadBuffer(GL_NONE);
and:
QOpenGLFunctions_3_1().glDrawBuffer(GL_NONE);
QOpenGLFunctions_3_1().glReadBuffer(GL_NONE);
Both these codes compile correctly, but when I run the program, in both cases, the program crashed and gave me the following error:
Access violation reading location 0x00000090
The strange thing is that I usually get this error when I assign the wrong value to a pointer, but none of these codes contain pointers (or maybe the functions contain pointers which generate this error, in which case there could be a bug in Qt's QOpenGLFunctions_3_1 class?).
What is the correct way of using the glDrawBuffer and glReadBuffer functions in Qt?
This error basically means that the functions were declared in an included header file but not correctly linked.
Correct. You have to link against OpenGL. opengl32.lib on Windows, libGL.so on *nix/Linux, -framework OpenGL on MacOS.
but none of these codes contain pointers (or maybe the functions contain pointers which generate this error, in which case there could be a bug in Qt's QOpenGLFunctions_3_1 class?).
Yes, they do. The OpenGL interface for anything that goes beyond a certain version is loaded at runtime into function pointers. This is what the QOpenGLFunctions class does. Before properly loading these pointers, they are invalid – in fact, depending on the OpenGL version your're using some may be valid and others not; that's why Qt puts the OpenGL version into the class name.
Answer the following questions:
Does the program create a OpenGL context to use?
Is the QOpenGLFunctions_… instance initialized with the context being made active on the calling thread?
Did initialization of the QOpenGLFunctions_… instance succeed?
If you'd answered any of these questions with "no" or "I don't know", that's where your problem is.

glEnableClientState was not declared in OpenGL v4.5

I am using OpenGL version 4.5.0 and getting this error:
error: ‘glEnableClientState’ was not declared in this scope
I have read that glEnableClientState is deprecated in this version, but I need to write code compatible with this method, as this is home assignment from class and they require us to write using this method. Is there any way could I get this working in OpenGL 4.5.0?
Including this has had no effect:
glutInitContextVersion (3,3);
glutInitContextProfile (GLUT_COMPATIBILITY_PROFILE);
glutInitContextProfile (GLUT_CORE_PROFILE);
That's the opposite of what you need to do. If you need compatibility OpenGL features, then you have to use GLUT_COMPATIBILITY_PROFILE.
However:
error: ‘glEnableClientState’ was not declared in this scope
That suggests that the OpenGL loading library you're using doesn't even declare this function. Which means you need to move to one that can expose compatibility profile OpenGL functions.
glEnableVertexAttribArray and glVertexAttribPointer are "modern" replacement for glEnableClientState/glVertexPointer. The new generic variant has been available since GL 2.0.

"glUniform1fARB"?

What dose glUniform1fARB do?
is there any detailed online reference materials?
What about this google (OpenGL reference) result?
Note that the base name for such methods is glUniform, so look for that. 1f means one float parameter, ARB means the method is common but not part of core OpenGL as of some version. I'm not sure in which exact version the function was promoted, but I assume it was something around 3.0, and thus you'd now just use glUniform1f.
Edit: The spec sais promotion happend in 2.0: "glUniform is available only if the GL version is 2.0 or greater."

Problem using accessors in V8

I'm writing a wrapper class around the V8 engine so that eventually I'll be able to do something like this
script->createClass("Test");
script->getClass("Test")->addFunction("funct1",testfunct1);
script->getClass("Test")->addVariable("x",setter,getter);
So far I can create classes and add functions to them and it works perfectly, however I have encountered a problem with adding variables.
My class template is stored as such
Persistent<Object> classInstance;
and I try to add an Accessor like this:
this->classInstance->SetAccessor(String::New(variableName),setter,getter);
Compiling this code gives me the error that v8::Object doesn't have a SetAccessor function (though I've seen doxygen documentation that says otherwise).
So my question is: How can I fix this? Is it possible to cast an Object to an ObjectTemplate?
SetAccessor on Object is available as of V8 2.2.12, which was released May 2010. (Before that, it was indeed only available on ObjectTemplate.) You should probably update your copy of V8.