For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

wxWidgets

za's picture
Forums: 

Hiall,
been trying the past 2 days to run OCC with a wxWidgets/Linux front.
The wxWindows thread in this forum was very helpful (though 1 year old). But I got stuck :(

Essentially, as far I can tell, I can't seem to get the Linux equivalent of the win32:
aWNTWindow = new WNT_Window(graphicDevice, (HWND*)frame->GetHandle());

my try:
aWindow = new Xw_Window(graphicDevice, frame->GetHandle());

makes g++ compile with
error: invalid conversion from `GtkWidget*' to `long unsigned int'

And if I try something like
aWindow = new Xw_Window(graphicDevice);
I get things like
*Xw_Error_3/1*Bad EXT_WINDOW Address 0 from Xw_get_window_size routine

Well, I have a little experience with wxWidgets (on linux mostly),
but this is beyond my skill toolset, so far.
Any hints appreciated.

Anyone aware of a working wxWidgets(linux)+OCC example published somewhere? On the wx site or here would have been a good spot, but I came out emply, so far.

Regards,
Vio

Patrik Müller's picture

Hi vio,

I have (still) no experience with wxWidgets on Linux, but this is from a n OCC QT demo, perhaps it could help you:

Handle(Xw_Window) hWnd =
new Xw_Window( Handle(Graphic3d_GraphicDevice)::
DownCast( myContext->CurrentViewer()->Device() ),
(int) hi, (int) lo, Xw_WQ_SAMEQUALITY, Quantity_NOC_BLACK );

if you have success it would be nice if you could send me some feedback for adding this to my wx-Application.

HTH,

Patrik

za's picture

Hi Patrick,
Yeah, I've also stumbled on that piece of code, but couldn't put it to much use. Couldn't trace '::DownCast()' in the sources (so far).

Thanks for your reply, though.
Yeah, if I get somewhere useful with my attempts, maybe I'll make a wiki about it on the wx site. Well, it's kind of a pitty: OCC seems such a wonderful piece of code (biggest piece of c++ I've ever seen so far). But the documentation really sucks (no offense). At least from what I've seen so far. Or, to put it better: there is ample place for improvement.
Ok, just some newbie's opinion :)
Cheers,
Vio

Advil's picture

I see that on OCC don't exists a real documentation of this topics. But i continue interesting on take a look on OCC in wxWidges, then i think that is a good start point for this race, take a look to wxvtk (http://wxvtk.sourceforge.net/) code. In this moment a reading this and think that in a few day i obtain a little windows of wxWidgets with OCC.

Patrik Müller's picture

Hi Advil,

perhaps this could help. But wxVTK uses for UNIX GTK and the GLCanvas while OCC has its own OpenGL context. Do you think there will be problems?
But it would be nice building a wxWidgets based OCC framework!

Greets,

Patrik

Advil's picture

Hi Patrik

After a lot of time, and after a lot of confutions at last i have some conclutions !

i think that you don't understand how OCC works. OpenCascade don't create its own OpenGL context, it use a windows that has a GL context activated. If you see the simple tutorial MakeBottle (that come with OCC intalletion) on view.cxx file, you can see that for the X11 case it creates a window using Xlib and it assings a GL context to this window throw GLX. After this it takes its XID (throw Qt winId() method) and create a Xw_window that wrap this X11 window to be used in the rest of opencascade calls !.

Then with this knowlage i began to work on my wxWindows widget. But on this process, it was clear to me that i need to study GTK++. A lot of work only to do a widget on wxWindows, then i decide to work directly on Gtk++, or better on Gtkmm (its C++ wrapper).

On this moment using Gtkmm, GtkGlExt , GtkGlExtmm, i wrote a widget class GtkOpenCascade3d, that only show a OCC shape on a window.

http://edwin.iband.net/opencascade/gtkmmocascade.tar.bz2

Patrik Müller's picture

Hi Advil,

nice to hear. As said I have no experience for using OCC outside Windows! So thanks for the help. I will take a look at the source.

Greets,

Patrik

za's picture

Hi Advil, Patrik,
Yeah, I know about wxvtk, works on my box too :) Regarding OCC+wx, I still haven't managed to make it work on wxWidgets on linux, unfortunately. Actually, I gave up on that project some time ago, focussed instead on another package called Blender, trying to make it do CAD too (actually, Blender is an impressive 3D drawing/animation app). Quite impressive, and mostly, it's by no means as "fat" as OCC, so I can "grasp it a little better. And, (candy, candy !!!) the community is *way* more fun and helpful than OCC's (unfortunately). Just go to #blendercoders channel on irc.freenode.net ... and enjoy the difference. Anyway, if any of you manage to run OCC on wx (linux), maybe send me a hint too!
Cheers, vio