OpenGL 4.0 in wxwidgets 3.0.4 Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
NoeMurr
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Mar 31, 2018 2:26 pm

OpenGL 4.0 in wxwidgets 3.0.4

Post by NoeMurr »

Hi all,

I'm trying to create an wxGLCanvas with openGL 4.0 openGL context in wxwidgets 3.0.4.
I create the canvas with the following attributes:

Code: Select all

int attr[] = {
        WX_GL_MAJOR_VERSION, 4,
        WX_GL_MINOR_VERSION, 3,
        0
};
but when I run the function:

Code: Select all

	glGetString(GL_VERSION);
it says that I'm using a 2.1 openGL version.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: OpenGL 4.0 in wxwidgets 3.0.4

Post by ONEEYEMAN »

Hi,
You should upgrade to the latest (3.1.1) version of the library.
When you do you will get an extra sample in the samples/opengl folder which will show you how to work with the latest OpenGL.

Thank you.
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: OpenGL 4.0 in wxwidgets 3.0.4

Post by Manolo »

As ONEEYEMAN told, the best is that you upgrade to wx 3.1

Anyhow, wx 3.0 branch allows some OpenGL context features. The really important is that you (almost for sure) want a "OpenGL Core Profile" context (as opposed to compatibility with old "fixed pipeline" context). For this, you need to tell so at context parameters.

Then your parameters list should be:

Code: Select all

int attr[] = {
        WX_GL_CORE_PROFILE,
        WX_GL_MAJOR_VERSION, 4,
        WX_GL_MINOR_VERSION, 0,
        0
};
which include defaults parameters RGBA, Z-depth 16 bits, and double buffering.

Using attributes list is also allowed in wx 3.1, but it's strongly encouraged to use wxGLAttributes and wxGLContextAttrs which also allow more context options.
NoeMurr
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Mar 31, 2018 2:26 pm

Re: OpenGL 4.0 in wxwidgets 3.0.4

Post by NoeMurr »

Adding WX_GL_CORE_PROFILE to my attributes allows me to get OpenGL 4.1, so thanks Manolo.

ONEEYEMAN you said that I should pass to wx 3.1.1, but this version is not marked as stable yet.
So is wx 3.1.1 reliable?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: OpenGL 4.0 in wxwidgets 3.0.4

Post by ONEEYEMAN »

Hi,
It is reliable.
The stability means that there is a guarantee that both the API and the ABI compatibility will not be broken between different stable releases. That's all.

Thank you.
Post Reply