OpenGL canvas and frames

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
AUser
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

OpenGL canvas and frames

Post by AUser » Sat Jul 01, 2006 12:39 am

Hello,

i have been experimenting with using openGL in wxWindows and i successfully was able to implement a single openGL window in a frame, however if i try to add any other controls to the window the openGL window dissappears leaving just the frame and control!

i would like to make a frame with an openGL window with several controls (listboxes buttons textboxes and so forth), but i want to do it in one frame, is there some example source for this, or does anyone know what could cause this problem?

Thanks

ciammarica
Knows some wx things
Knows some wx things
Posts: 29
Joined: Tue Jul 04, 2006 6:49 am

Post by ciammarica » Tue Jul 04, 2006 8:07 am

i've implemented an OpenGL Editor program with wxWidgets for University Thesis, if you want i can send it to you

ciammarica
Knows some wx things
Knows some wx things
Posts: 29
Joined: Tue Jul 04, 2006 6:49 am

Post by ciammarica » Wed Jul 05, 2006 8:48 am

Here you can find the portion of my program's source code where i use wxGLCanvas for my OpenGL Editor.
In the zip file you'll find the executable for Windows XP too. To use it you must copy and paste "glut32.dll" in your Windows/System folder.

http://mio.discoremoto.alice.it/piumina

Hope this will be useful!

AUser
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

Post by AUser » Fri Jul 07, 2006 7:37 am

Thankyou very much, i will have a read through your code.

What were you using to build it?


(im using gcc & makefiles on my Linux box and Macbook Pro)

Thanks

ciammarica
Knows some wx things
Knows some wx things
Posts: 29
Joined: Tue Jul 04, 2006 6:49 am

Post by ciammarica » Fri Jul 07, 2006 9:14 am

I've used DevC++ 4.9.9.2, wxWindows 2.4.2, GLUT libraries for 3D objects and tinyXML to manage saving/restoring of project.
But the code is cross-platform, so it should work everywhere.

uj
Knows some wx things
Knows some wx things
Posts: 37
Joined: Mon Sep 13, 2004 7:05 am

Post by uj » Fri Jul 07, 2006 12:23 pm

You may want to check out these two more highlevel OpenGL based packades which are supposed to work with wxWidgets,

http://g3d-cpp.sourceforge.net/

http://www.openscenegraph.org/

AUser
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

Post by AUser » Fri Jul 14, 2006 6:54 am

Thanks for the links ppl

I think there may be a bug in wxMac2.6.3...

i have looked in the wx source code and found the following entry in the constructor for wxGLContext in the carbon implementation

m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetTopLevelWindowRef()));


im not an expert carbon programmer, so the GetTopLevel thing looks very suspciously like it grabs the window handle for the parent frame. This would explain the problem that i have been having, as any attempt to pass a child frame would result in getting the parent frame reference.

Can anyone verify this? If someone doesnt shoot me down in flames in the next few days ill submit a bug.


edit: fixed cocoa/carbon typo

joddys
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Jun 12, 2006 10:37 pm

Learnig openGL

Post by joddys » Fri Jul 14, 2006 10:08 pm

I'm lucky to find this topic here in the forum!

Could someone here help me on my way to begin using opengl? We must admit it's not an easy step learning c++ an begin using OpenGL!

Also, about OSG, does it worth using it?

Thanks a lot for any reply!

Xangis
Earned some good credits
Earned some good credits
Posts: 122
Joined: Fri Apr 14, 2006 9:49 pm
Location: Beaverton, OR
Contact:

Post by Xangis » Sat Jul 15, 2006 2:30 am

I'm not sure if this will help, but in general most of the time you won't want to use the frame directly, but rather create a wxPanel, attach it to the wxFrame, and create the wxGLCanvas on the panel rather than the frame. Doing things directly on a frame can give funny results in some operating systems.

AUser
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

Post by AUser » Mon Jul 24, 2006 6:59 am

When i did that then nothing shows up under macOS, havent tried on my linux box

Post Reply