Setup VisualC++ to use OpenGL 4.1? - c++

I'm trying to setup VC++ to compile code with OpenGL 4.1 functionality. I downloaded the 3 header files from from opengl.org; put them in the correct paths and include them - but keep getting errors like this:
error C3861: 'wglSwapIntervalEXT': identifier not found
I have the latest video drivers. OpenGL says the problem is MS includes only version 1.1 with their compiler when though the vendor/driver supports 4.1.

One of the big pains of using OpenGL on Windows is that the Windows SDK only ships with OpenGL 1.1. There's probably a really good technical (and non-political) reason for this, but the fact remains, if you want to do anything with OpenGL on Windows, you're on your own.
What you need then, is something to bring the Windows SDK up to current standards (OpenGL 4.1 as I write this.) When I was originally trying to solve this problem (around the time of OpenGL 3.0), I came across GLee http://elf-stone.com/glee.php which is a cool library which makes the full OpenGL spec available easily. I didn't like their license, so I decided to write my own extension loader.
I don't think anyone should ever have to do this again, so I've made mine public domain, do with it as you will. I'd like to hear if you use it in something, but that's not a requirement.
http://www.onemanmmo.com/index.php?cmd=newsitem&comment=news.1.28.0

Related

How to set up mac for graphics programming to use openGL?

I am a new to programming and also to this platform so i apologize if
my question is not proper or seems stupid but i need help .None of the
resources on internet have been useful to me . If possible please
provide step by step instrction to set up mac for graphics
programming. thank you in advance.
I am a new to programming and i am trying to learn graphics programming .Till now i write c/c++ code in a text editor and compile and execute them to see the output in shell . I searched the web for setting up mac for opengl projects but none of them come close to clearing my doubts . Here are the doubts/questions :
my computer: macOS-Mojave :macbook pro mid 2012 (intel hd graphics 4000) supports openGL 4.1 according to apple website
1. do i have to download some files to use openGL ? or is it just a an api implemented by the computer hardware manufacturer(here apple in my case ).
2. according to recent news apple deprecated openGL. And i don't know which version of openGL is on my macbook . is there a way to find out ?None of the answers listed have worked for me.
3.Can i compile openGL code through terminal like i have been doing till now or do i have to use xcode ?
1. do i have to download some files to use openGL?
So far, not yet. Everything required ships with the compilers by default. You just add -framework OpenGL to your compiler invocations and are good to go.
2. according to recent news apple deprecated OpenGL. And i don't know which version of openGL is on my macbook. is there a way to find out? None of the answers listed have worked for me.
You're mixing two different concepts here:
The deprecation of OpenGL in the macOS platform means, that OpenGL will disappear from that OS altogether, irrespective of what OpenGL version actually is supported. Eventually you'll have to either move to Metal, or use some wrapper like MoltenGL (which implements OpenGL on top of Metal) or MoltenVK (which implements Vulkan on top of Metal).
With macOS the highest OpenGL version supported is determined entirely by the version of macOS installed. That is different from other OS, where a mere driver update may give you a higher OpenGL version, as long as the installed graphics hardware meets the requirements of that higher OpenGL version.
3. Can i compile openGL code through terminal like i have been doing till now or do i have to use xcode?
Yes. And there's no difference between compiling from the command line, and through Xcode, because Xcode is just doing the very same command calls as you'd do through the terminal.

Setting up modern OpenGL with Visual Studio 2013

I have been coding OpenGL for a while now using Java and LWJGL. However recently I decided that I would switch from Java to C++.
I managed to set up OpenGL with Visual Studio 2013, and had some fun with that. However I am used to using modern OpenGL (shaders, vbo's, vao's etc...), and I believe what I am looking for is OpenGL ES.
I have been using the GLFW library to create a window with OpenGL context, so how do I do this with OpenGL ES.
I tried adding the #define GLFW_INCLUDE_ES31 line to above the glfw3.h include, however then it cannot find the GLES3/gl31.h header file. I don't know how to obtain this file on my computer, because the GL/gl.h file was just on my computer by default.
Am I supposed to download it?
Apparently OpenGL ES is aimed at smartphones or less powerful devices, so I was wrong in thinking I wanted to use OpenGL ES. In that case, how can I use these newer functions within Visual Studio, and C++. At the moment I only seem to have access to OpenGL 1.1 functions.
You are lacking a loader (GLEW for example)
"just" add it to your project and you will be able to use the GL_ functions again

Qt C++ Library for Windows and OpenGL

I am trying to experiment with the Qt library on Windows. On their downloads page, I notice that the binaries built using VS2012 are available in two forms, with and without OpenGL. What exactly is the difference between the two? In the OpenGL version, do they have some special API implemented using OpenGL or does all of Qt rendering depend on OpenGL? Also, is there a version of Qt that uses DirectX?
#Raman: The opengl variant is using the desktop opengl version just like with Qt4.
The non-opengl variant is using angle, and you need to have that installed alongside the DirectX SDK to get it working. Angle is an adapter between the directx and the opengles API. Only the latter is support directly by Qt, but unfortunately directx drivers tend to work better on Windows than the opengl(es) ones. There are no plans to support a directx backend inside Qt, so we leave with Google's Angle work in that regard.
As for providing some extra bit, there was a discussion about it recently on the mailing list, that this decision should not be build time, but more like run time. However, no one has stood up just yet to make that work. Hopefully, that will change soon. It is causing confusion for the end users just like, so do not feel alone. ;-)
Hope this explanation helps.
DirectX is supported via the ANGLE based library.
Note that this has changed and as of Qt 5.5 the prebuilt binaries you can download from the Qt website are configured with the -opengl dynamic option. This is what #lpapp above was talking about. Qt defaults to choosing either native OpenGL drivers or ANGLE at run time now.
Qt internally uses OpenGL to render unless you specify otherwise now. You can also render custom OpenGL content using Qt's QOpenGLxxx functions and classes.
For a simple introduction to Qt and OpenGL that covers this and more click here.

Where to download opengl sdk (v. 3 or v. 4)?

Wikipedia says that OpenGl V4.x is the latest. However my Visual Studio 2012 just offers the following version
#define GL_VERSION_1_1 1
So my questions:
Which version is the most common that I should use? E.g. version 2.x because there are many tutorials, it is backward compatible etc.? I may have to mention that I normally prefer to write in C++, so is any version of Opengl e.g. offering namespaces? Are there huge differences between OpenGl 2,3 and 4?
And where can I get the Libs+Header files e.g. for OpenGl 4?
And where can I get the Libs+Header files e.g. for OpenGl 4?
You don't. OpenGL uses the so called "extension mechanism" to load functionality that's beyond the system ABI version. There exist third party libraries that do the extension loading and provide a header with the extended functionality.
Most popular is GLEW, which has its homepage at http://glew.sourceforge.net ; be warned though that right now of writing this GLEW is not up to date with OpenGL-3 and later core profiles. You must use compatibility profiles with GLEW or things get unstable.
AFAIK, the most popular GL development library is GLEW:
http://glew.sourceforge.net
There is no official OpenGL SDK. If you want to use newer functions you have to use a third party library such as GLEW or GLFW.

Where to get an up-to-date OpenGL32.lib?

this one drives me crazy. I've been searching for two days but cant find any answer.
I want to develop some things with OpenGL 3 (or newer) with Visual Studio 2010 / C++.
The header and libraries provided by Microsoft are way too old to support OpenGL 3, so I'm trying to find newer versions. I easily found the header file in the OpenGL registry (http://www.opengl.org/registry/) but I cant find the OpenGL32.lib anywhere. How am I supposed to link a program without it?
There isn't a newer OpenGL library for windows, and there won't be. They decided to stop at OpenGL 1.1 and even call it a legacy graphics.
However, you can use load opengl function, and that is how people get access to the latest opengl features.
You can also use GLEW library to get access to the opengl functions.