OpenGL - ARB extension - opengl

I am using MacBook Pro (13-inch, Mid 2010) and I work with OpenGL. I noticed, some of functions miss in library. I found specifications on the internet about my hardware and it says: "support OpenGL 3.3". It was strange so I printed my OpenGL version and IT IS 2.1, NO 3.3!. (Then I found, newest MacBooks (2014) have the same OpenGL version 2.1, WTF)
Then I almost jumped from window. (JK)
I googled something about 2.1 with some extension ARB, but there is no documentation, no usage, nobody uses it. Can anybody explain me please, what is that? How to use it? What is the difference?
I read (If I understand well), instead of new OpenGL 3.X, there is ARB extension which is similar or something. I hope, if they write to the specification it supports version 3.3, ARB should be the same (the same functions at least).
I would be glad, if somebody explains me what is going on.
Question:
I have problem with multisample texture for FBO drawing. It can be created by function glTexImage2DMultisample with parameter GL_TEXTURE_2D_MULTISAMPLE. It is from version 3.2 or grater.
So what should I use, or is it possible to do it with ARB?
I found GL_ARB_multisample in library. What is that? Any usage? All functions I found on the internet are missing. There are some definitions like GL_MULTISAMPLE_ARB in header. I tried to enable it by glEnable (GL_MULTISAMPLE is defined too), it doesn't work.
Please help me. :(
Edit:
If you know different way to solve this, I would be happy.
Original question: OpenGL - FBO and alpha blending

You must switch OpenGL context from Legacy to Core profile. Core profile requires some changes in your code. You must migrate your code and shaders, because it's new version of OpenGL and GLSL. Check official video, how to migrate and rewrite functions to validate code for new version. Apple Developer Site - OpenGL (The video on the right side).
The important thing, you must do, is add #import <OpenGL/gl3.h> and all functions will be visible for use.
To get it to work, and debug shaders it's necessary set up NSOpenGLPixelFormat. Add NSOpenGLPFAOpenGLProfile key with NSOpenGLProfileVersion3_2Core value to NSOpenGLPixelFormatAttribute array:
NSOpenGLPixelFormatAttribute attribs[] = {
// ...
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
// ...
};
This helps you to debug your code.
Thanks a lot for help and I hope, this helps you.

Related

Setting the OpenGL version to 2.0 appears to do nothing, as 3.3+ features still work

Someone was asking me for a test with OpenGL 2.x since they have hardware that supports only up to OpenGL 2.1.
I figured I'd try it out by setting the window hints in GLFW to use the major/minor version of 2 and 0.
Problem is I'm still using #version 330 in my shaders, and it works. However, it would not let me use the hints of GL version 2 when I was leaving on a Core profile (by accident). This seems to indicate that my version choice is doing something, but not what I expect.
I want to restrict myself to 2.1 to see if my application would run, and if it doesn't, then see what I can change to make it work. Problem is I don't have any 2.1 hardware since my computers are all 2015 or later.
Is there a way I can emulate 2.1 (on Windows) somehow and have it crash/die if I try using features it doesn't support? Apparently the hints I'm using are not helping.
As far as I know the major/minor version flags don't set the version of your OpenGL context but the required feature set. So if you set the flags to 3.3 for example you will usually get a 4.5 or 4.6 context as those version are typically the latest OpenGL versions your GPU supports that is compatible with OpenGL 3.3. Getting a OpenGL 2.1 Core context should be impossible as the defining feature of the core context is that it doesn't support some OpenGL 1.0-2.1 functionality. So this isn't really surprising.
I think your best option here is to use headers that only contain OpenGL 2.1 functions. GLAD for examples allows you to specify which version you want to generate headers for.

OpenGL version and programming

I am using VS2010 and freeGlut2.8.1, it seems that the openGL version on computer is 4, (also I am new to openGL) I have kept reading the many of the openGL features of earlier version are no longer used in recent version and the pipeline has changed ... , how come I am coding, using the tutorials on openGL red book which is for version 1 and every thing is working ok???
You shouldn't be using a deprecated version of OpenGL while serious about programming on it. Since glut is old and its design rather rusty, I suggest using a recent windowing API that allows you to program with OpenGL 3.3+. Examples of such windowing APIs include SDL, SFML, GLFW to name a few. Also, the red book on OpenGL although is useful in understanding how OpenGL works doesn't implement it in the most up-to-date manner. There are plenty of other books out there like OpenGL SuperBible or Shader Cookbook that can get you started.
You should have a look at modern OpenGL tutorials
IMHO using glbegin / glend pairs allows one to see the big picture. But their usage is never encouraged any more.

Accessing Modern OpenGL functions from Qt creator

I am using Open GL 3.0
I am trying to update this example to modern OpenGL :
http://qt-project.org/doc/qt-4.8/opengl-hellogl-es.html
I am also looking at this example:
http://qt-project.org/doc/qt-5/qtopengl-cube-example.html
I am looking at the OpenGL ES examples, because they compiled and rendered easily on my machine, and the OpenGL ES 2 example uses some programmable pipelining.
I want to use the pipeline functions referenced in this tutorial:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/
For instance glGenBuffers()
However, this does not seem to come up in open Qt. If I try to compile a program that uses glGenBuffers, or glBindBuffer.
Why can I use some Open GL functions but not others?
Looking at the second example (OpenGL ES2) There is a type "QGLShaderProgram" which seems to wrap some of the shading functions, but I am at loss as to how to follow even a simple open GL tutorial with full access to the rendering functions.
For instance, the openGL tutorial references at least half a dozen functions I can't seem to use. I would be fine with this, but I can't seem to find where the Qt folks have explained what functions are wrapped, or covered up, or are absent.
Could I be missing an include or something?
I am including #QGLWidget and #QtOpenGL
See below for my answer to your question. However, it seems likely you are looking for a simpler OpenGL example with Qt like the triangle one you linked to. I also made an introductory post here where you can learn the basics of how Qt and OpenGL work together before you start an example.
First of all use Qt 5.5 now. It is configured with the -opengl dynamic option by default which might solve your problem. If you don't have -opengl desktop configure option set in your pre 5.5 build of Qt then you won't have access to modern OpenGL functions other than the subset of OpenGL ES 2 that is supported by all the platforms Qt supports.
Second, don't use the QGL* functions or classes as they are old/deprecated now. They were replaced by the QOpenGL* functions and classes.
As for includes, you will need a QOpenGLFunctions or QOpenGLFunctions_3_0 to know for sure which set of functions you are getting. You will also need any other classes like QOpenGLBuffer QOpenGLVertexArrayObject... or just include QtGui as that is where all the OpenGL functions and classes are now.

Tesselation in Go-GL

I'm trying to tesselate a simple triangle using the Golang OpenGL bindings
The library doesn't claim support for the tesselation shaders, but I looked through the source code, and adding the correct bindings didn't seem terribly tricky. So I branched it and tried adding the correct constants in gl_defs.go.
The bindings still compile just fine and so does my program, it's when I actually try to use the new bindings that things go strange. The program goes from displaying a nicely circling triangle to a black screen whenever I actually try to include the tesselation shaders.
I'm following along with the OpenGL Superbible (6th edition) and using their shaders for this project, so I don't image I'm using broken shaders (they don't spit out an error log, anyway). But in case the shaders themselves could be at fault, they can be found in the setupProgram() function here.
I'm pretty sure my graphics card supports tesselation because printing the openGL version returns 4.4.0 NVIDIA 331.38
.
So my questions:
Is there any reason adding go bindings for tesselation wouldn't work? The bindings seem quite straightforward.
Am I adding the new bindings incorrectly?
If it should work, why is it not working for me?
What am I doing wrong here?
Steps that might be worth taking:
Your driver and video card may support tessellation shaders, but the GL context that your binding is returning for you might be for an earlier version of OpenGL. Try glGetString​(GL_VERSION​) and see what you get.
Are you calling glGetError basically everywhere and actually checking its values? Does this binding provide error return values? If so, are you checking those?

Where to get OpenGL 2.0 for windows 7 64bit

I've been looking for OpenGL version 2.0 or higher, but I haven't found anything I could use so far. There is no download section on the official website and google finds mostly stuff like OpenGL Viewer or OpenGL Screen Saver, but I am looking for OpenGL to develop games/graphics/vizualizations ( precisely version 2.0, but I know that higher versions are also compatible with 2.0 then they are also OK ). Could someone please give me a source, which I could get appropriate OpenGL for my project from? I've managed only to download one, but it didn't work, because it was created for 32bit OS, and I use 64bit windows 7. Does anyone know how to handle this problem as well?
this is my graphic card : NVIDIA GeForce 9600M GS
You don't have to download an SDK to use OpenGL in 64-bit applications on Windows. All you need is a 64-bit capable compiler, and the Windows Platform SDK (which comes bundled with Microsoft Visual Studio).
But there is a catch: Microsoft's OpenGL implementation hasn't been updated since OpenGL 1.1, and to use functionality from later versions OpenGL, you need to use OpenGL-extensions. Luckily, some nice people has made GLEW, a library that does the extension-work for you and allows you to simply compile OpenGL 2.0 (and later, as GLEW is updated) source code for Windows. Perhaps this is what you're looking for?
kusma is completely right, but maybe you'll need more precise directions.
First you'll need OpenGL libraries. These will be given with your Visual Studio / mingw / whatever installation.
Then you'll need to create an OpenGL window. You can do it with windows functions, but it is a nightmare. You should go for something like GLFW.
Then you'll need something to deal with openGL extensions ( as kusma said, you don't want OpenGL 1.1 only ). Use GLEW.
You will also need some math stuff : create a vector ( on the C++ side ), compute your projection matrix... GLM can do that for you.
Last but not least, you may want to use Cg for your shaders (but you can use GLSL instead, which is "built-in" in OpenGL)
Here's the OpenGL SDK site. LINK Is this what you are looking for?
The easy way to tell is if your using glBegin/glEnd statements you using old context methods (good for quick demos and prototyping, bad if your looking to do something that needs to look professional). When you start dealing with opengl topics that cover buffers and hint to VBO- vertex buffer objects and FBOs - Frame buffer objects your in the area of more modern opengl methods. If you want to get up to speed in the shortest amount of time, start with buffers and keep working your way forward. Just remember when your dealing with device contexts (methods to create your windows) if you stick with OGL 2.1 or lower your limiting yourself ( Think roughly DirectX9/early DirectX10) . Your video card handles DirectX10 and OpenGL 3. Best bet start there. Check out NVidia's developer site, http://developer.nvidia.com/ And, take a look at http://opengl.org site check out the forums - http://www.opengl.org/discussion_boards, the guys there are helpful (be careful not to re-post old questions).
Also check out http://swiftless.com - its a good start - and he labels his tutorials by ogl versions.