Win32 vs wxGLCanvas! 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
blackfrag150
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Apr 01, 2018 4:28 pm

Win32 vs wxGLCanvas!

Post by blackfrag150 »

I want to make a small Map Editor as a start and later on,if it goes well,turn it into something larger like a game engine!
But so far i have seen two approaches to implementing OpenGL in wxWidgets app:
1.Win32 or Windows API,
2.By inheriting wxGLCanvas and ...
Which one should i go for in my app and why?
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Win32 vs wxGLCanvas!

Post by doublemax »

1.Win32 or Windows API
Where did you see that?

I think for a wxWidgets application it's only natural to use wxGLCanvas.
Use the source, Luke!
blackfrag150
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Apr 01, 2018 4:28 pm

Re: Win32 vs wxGLCanvas!

Post by blackfrag150 »

I have heard that wxGLCanvas is quite laggy and people recommend creating another window for handling OpenGL,which of course will be a child
of wxWidgets app!
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Win32 vs wxGLCanvas!

Post by doublemax »

I have heard that wxGLCanvas is quite laggy
wxGLCanvas is a very small wrapper around the native windows, i can't imagine that it produces noticeable overhead.

But if you only need Win32 and don't intend to run your program on other platforms, go ahead and use a native Win32 window.
Use the source, Luke!
blackfrag150
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Apr 01, 2018 4:28 pm

Re: Win32 vs wxGLCanvas!

Post by blackfrag150 »

Well i am thinking of making it Cross Platform but it is not priority!
So you are saying that wxGLCanvas is just a small Win32 OpenGL wrapper then i guess i am fine!
blackfrag150
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Apr 01, 2018 4:28 pm

Re: Win32 vs wxGLCanvas!

Post by blackfrag150 »

What would be the difference between implementing OpenGL in wxGLCanvas and Win32,will there be any performance issues on one or other...?
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Win32 vs wxGLCanvas!

Post by doublemax »

As i've no experience with OpenGL myself, i can't say anything about this. I suggest you make some performance tests with the opengl samples that come with wxWidgets. The "pyramid" sample is the newest and the only one that uses shaders, the others use legacy OpenGL.
Use the source, Luke!
Manolo
Can't get richer than this
Can't get richer than this
Posts: 828
Joined: Mon Apr 30, 2012 11:07 pm

Re: Win32 vs wxGLCanvas!

Post by Manolo »

wxWidgets relation with OpenGL consists only in creating and handling a gl-context. The rest of OpenGL commands are outside of wxWidgets scope. This means that wxWidgets does not provide OpenGL API wrappers.You must retrieve function-pointers for OGL commands, for example by using glew or, with more work, as pyramid sample does.

While it was true that wxWidgets was late to allow a modern Core Profile context (OpenGL > 3.1) this is not the case since wxWidgets 3.0. Since wxWidgets 3.1 you can set OpenGL 4.6 context properties and also future properties that wx is not aware of.

Creating a gl-context is very platform dependant. If you want to avoid wxGLCanvas and wxGLContext, then go for it. But I strongly recomend not to do it (except for academic, learning purposes).

There's absolutely no performance issue in using wxWidgets wxGLCanvas and wxGLContext. If you find rendering issues it's surely from your code, not from wx's one.
Last edited by Manolo on Mon Apr 02, 2018 4:03 pm, edited 1 time in total.
blackfrag150
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Apr 01, 2018 4:28 pm

Re: Win32 vs wxGLCanvas!

Post by blackfrag150 »

That is what i needed,thanks man!
Post Reply