Creating Open Cascade Technology Xw_Window

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
rsb
I live to help wx-kind
I live to help wx-kind
Posts: 166
Joined: Fri May 29, 2015 7:26 pm

Creating Open Cascade Technology Xw_Window

Post by rsb »

Hello,
Has there been any work done with Open Cascade Technology libraries?

We're using OCCT to display 3D models. It works fine on Windows but it's crashing on Linux in the Xw_Window constructor. (See below).

Just wondering if anyone has tried to do something like this. I'm not having any success at all.

Thanks.

Here's some sample code:

Code: Select all

    static Handle(Aspect_DisplayConnection) displayConnection;
    if( displayConnection.IsNull() )
        displayConnection = new Aspect_DisplayConnection();
    ......
    WXWidget handle = (WXWidget) this->GetHandle() ;
    if( handle == NULL )
        return ;
    // Aspect window creation
#ifdef _LINUX_TARGET
    m_Window = new Xw_Window(displayConnection, (Aspect_Handle) handle);
    // m_Window = new Xw_Window(displayConnection, "3D Window", 0, 0, 400, 600); <--- This works but doesn't link to the wxPanel.
#else
    m_Window = new WNT_Window((Aspect_Handle) handle);
#endif
    m_view->SetWindow(m_Window, nullptr);

    if( !m_Window->IsMapped() )
    {
        m_Window->Map();
    }
    m_view->MustBeResized();
wxWidgets Version: 3.1.0
OS: Red Hat Linux
User avatar
doublemax
Moderator
Moderator
Posts: 16586
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Creating Open Cascade Technology Xw_Window

Post by doublemax »

Under GTK this->GetHandle() returns a "GtkWidget *". Are you sure this is castable to an "Aspect_Handle"?
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5420
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Creating Open Cascade Technology Xw_Window

Post by ONEEYEMAN »

Hi,
I don't see any backtrace?
Could you please post one?

Thank you.
rsb
I live to help wx-kind
I live to help wx-kind
Posts: 166
Joined: Fri May 29, 2015 7:26 pm

Re: Creating Open Cascade Technology Xw_Window

Post by rsb »

Hi,
Found a solution. Needed to get the ID of the window using the GtkWidget.

Thanks for your help. It set me on the right track.

Code: Select all

#ifdef _LINUX_TARGET
    Window Xwin = gdk_x11_drawable_get_xid(gtk_widget_get_window(handle));
    m_Window = new Xw_Window(displayConnection, (Aspect_Drawable) Xwin);
#else
    m_Window = new WNT_Window((Aspect_Handle) handle);
#endif
Post Reply