wxWidgets & openGL

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
CarstenT
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Dec 19, 2013 7:06 pm

wxWidgets & openGL

Post by CarstenT » Thu Feb 07, 2019 2:57 pm

Hi All,
I've puzzled with openGL in terms of creating some useful 'content-creation'. This went fairly well using my own GUI. Not surprisingly the GUI stuff is becoming a burden .. it's just there to support this one job. So, I'm looking at wxWidgets to take over. I've done GUI on ms-windows and this type of programming is not new to me. I need some solid information on how to take it on. Say: I assume that wx uses openGL, .. as such I also know that wx must be using a main-thread, the main-thread that my 'private' opengl setup needs to use .. I need to know more about the wxcanvas & wxcontext classes that is present in the 'manuals' to interfinger my and wx's openGL functionality. I use GLFW to handle GLEW .. but, wx must already have engaged something equivalent in its background? Get the gist of my blindness?
It does not help much, that I'm using opengl 3. core profile (using GLFW3) and the parlance of modern openGL. My Code::Blocks is using wx 3.01 and the opengl sample there refer to a GLFW (prior to GLFW3) that does not seem to be downloadable. etc. .

For short .. does there exist any place where I can go look up the general problem-complex?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3163
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets & openGL

Post by ONEEYEMAN » Thu Feb 07, 2019 3:42 pm

Hi,
Did you look at the OpenGL samples?

Thank you.

[EDIT]
I believe OpenGL3 sample is called "pyramid" and if not available - you should just grab the source code from Git HEAD and check it.
[/EDIT]

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 664
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxWidgets & openGL

Post by Manolo » Thu Feb 07, 2019 5:06 pm

If you use wxWidgets then you don't need GLFW, as they will fight for window and context handling.

GLEW is a lib for retrieving function pointers to gl-commands. You can use precompiled files, or you can add them (2 or 3 files) to your app and compile them normally.

Which are your problems, so far?. I know first time to OpenGL Core is a bit hard, because you need several things working at once (context, VAO, VBO, shaders) instead of going step by step.

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 664
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxWidgets & openGL

Post by Manolo » Fri Feb 08, 2019 2:17 am

Take a look at my post FAQ: wxWidgets and OpenGL
viewtopic.php?f=27&t=45552

CarstenT
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Dec 19, 2013 7:06 pm

Re: wxWidgets & openGL

Post by CarstenT » Fri Feb 08, 2019 11:01 am

Manolo .. GREAT!
oneeyeman .. the opengl-samples: wasn't that where I found a ref to glfw .. naa, it must have been the glext.h Manolo mentions.
I've read the code, but I don't recall to have met anything but 'old-style' gl, if any. That's usually where I stop reading. I'll have to go home and read more to narrow down the specifics. It'll be somewhere in the initiation-code. My own code seems so far away .. 'do initiation once and enjoy it forever'.
And, no, the opengl sample didn't compile. Unfortunately the 'wx-manual' information seems scant. My setup is slightly off the ordinary path: I installed code::blocks first and wx later. I think I noticed a setup.h file in the sample .. that could apply to MSYS (that I have not used and have not present..) etc. There's a lot of uncertainties in my setup and samples misses a lot of features that should have been present.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3163
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets & openGL

Post by ONEEYEMAN » Fri Feb 08, 2019 3:39 pm

Hi,
The {OpenGL} samples are located in wxWidgets/samples{/opengl}.

While cube, isosurf and penguin are to show the basic usage of OpenGL and how to use it, the pyramid sample is there to show the modern/current OpenGL 3.0 usage.

Compile and run all of them (especially if you are new to OpenGL world.

Also, you mentioned that the samples are not buildable and yopur setup is somehow weird. I can assure you there is nothing wrong with installing wx after C::B. Those 2 are completely independent and can be installed in any way possible.

Now, saying that - what sample did you try to build and what error did you receive? Also, what compiler did you use and how did you build wxWidgets?

I'm also presume you are working under Windows, correct?

Thank you.

CarstenT
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Dec 19, 2013 7:06 pm

Re: wxWidgets & openGL

Post by CarstenT » Mon Feb 11, 2019 1:31 pm

hi oneeyeman
I ran mingw from the win command.exe .. on the parent-folder that compiles all samples, one by one. Any errors drowned.
I cleaned once and went back to compile the single none-working samples in their folders and .. don't recall the errors. I assume that I missed some arguments to the mingGW command. I'm stalled that the compilation demands same arguments as the main wx compilation .. hm.. that doesn't exclude additionals, or?

I read the code of the samples and recognized some of what I've been looking for. My own initiation-code are some years old, and I've been slightly confused by my own conceptualisations. Just read the glfw and glew initiation. It cannot be simpler. I assume that I can call this initiation from wx_main() (I recall that I've seen such func somewhere) .. could it interfere with wx-initiation? Anyway, the samples are running ver 3.0-> .. so, I can erect my own program-objects there (shaders,uniforms, the lot), within a new wx-context/canvas.

Yes, I work under windows. Doing cross-compilation is probably a step too far for an amateur in matters that complexes up like this. It's just so nice not to use ms-tools.

Thanks

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3163
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets & openGL

Post by ONEEYEMAN » Mon Feb 11, 2019 3:44 pm

Hi,
Can you just go inside wxWidgets/samples/opengl/pyramid and try to compile this sample?

Thank you.

CarstenT
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Dec 19, 2013 7:06 pm

Re: wxWidgets & openGL

Post by CarstenT » Wed Feb 13, 2019 6:47 pm

hi ONEEYEMAN
I compled the opengl sample again and it works perfectly.
I probably expected one .exe, and there is three as you know.
I ran the drawing-sample. That the one that throws the "no such file" on
drawing\config.gcc
Anyway, the door should be open now

thanks to all of you

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 664
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxWidgets & openGL

Post by Manolo » Thu Feb 14, 2019 1:21 am

I compled the opengl sample again and it works perfectly.
I probably expected one .exe, and there is three as you know.
What? There are four OGL samples. You can compile one by one (entering in each sub-dir) or all at once from samples\opengl
I ran the drawing-sample. That the one that throws the "no such file" on
drawing\config.gcc
There's no drawing\config.gcc in MS port. "config.gcc" may exist in Linux port.

The drawing sample shows you how to draw with only OS functions, no OpenGL at all. Don't try to mix OS-OGL drawings in the same window. While it can be "simulated" (OGL render and then get the image and use it as background), normally you don't need this mix.

At this moment I still don't know what problems you meet.

CarstenT
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Dec 19, 2013 7:06 pm

Re: wxWidgets & openGL

Post by CarstenT » Thu Feb 14, 2019 3:58 pm

Hi Manolo
I recall having used some of the tools of the drawing sample. Probably before I cleaned all and tried compiling single samples. I'll not consider it a problem. My experience in minGW compiling is low .. Next step is making code::blocks use the wx, but I cannot use much attention at it right now

btw. I've got a few details from my 'own' gui that might interest wx. Going to wx means that it most likely never will see light of day again anywhere. I know that this might not be the right place, but there is
1) a screen-splitter, an intuitive way (binary tree) to compose a window. Easy access to resize()
2) part of a file-tree with a nifty hide on close when you click.
The ingenuity of my code has to be seen as 'large work' following a first disastrous attempt ;o)

Post Reply