MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #30516 All Revisions ] Back to Issue ]
Summary 0030516: Visualization - Pointer to an OpenGl_Structure is deleted and accessed later after PrsMgr_Presentation::Highlight()
Revision 2019-03-20 12:06 by tizmaylo
Steps To Reproduce #include <AIS_Trihedron.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Geom_Axis2Placement.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <WNT_Window.hxx>


#pragma comment (lib , "TKernel.lib")
#pragma comment (lib , "TKG3d.lib")
#pragma comment (lib , "TKMath.lib")
#pragma comment (lib , "TKOpenGl.lib")
#pragma comment (lib , "TKPrim.lib")
#pragma comment (lib , "TKService.lib")
#pragma comment (lib , "TKTopAlgo.lib")
#pragma comment (lib , "TKV3d.lib")

Handle( V3d_Viewer ) myViewerEx;
void TestOpenCascade( HWND wnd )
{
    Handle( Graphic3d_GraphicDriver ) defaultGraphicDriver = new OpenGl_GraphicDriver( new Aspect_DisplayConnection() );
    Handle( V3d_Viewer ) myViewer = new V3d_Viewer( defaultGraphicDriver );
    myViewerEx = myViewer;
    Handle( AIS_InteractiveContext ) myContext = new AIS_InteractiveContext( myViewer );
    Handle( V3d_View ) myView = myViewer->CreateView();
    Handle( WNT_Window ) hWNTWnd = new WNT_Window( reinterpret_cast<HWND>(wnd) );
    myView->SetWindow( hWNTWnd );

    myView->SetAutoZFitMode( Standard_True );
    myView->MustBeResized();
    
    Handle( AIS_Trihedron ) myTrihedron = new AIS_Trihedron( new Geom_Axis2Placement( gp::XOY() ) );
    
    myContext->Display( myTrihedron, Standard_False );
    myContext->Deactivate( myTrihedron );//Deactivate selection of trihedron

    TopoDS_Shape aBoxShape = BRepPrimAPI_MakeBox( 100, 100, 100 );
    Handle( AIS_Shape ) myAIS = new AIS_Shape( aBoxShape );
    myContext->Display( myAIS, Standard_True );
    myContext->SetDisplayMode( myAIS, AIS_Shaded, Standard_True );
    myContext->HilightWithColor( myAIS, myContext->HighlightStyle( Prs3d_TypeOfHighlight_Dynamic ), Standard_True );
    myContext->Remove( myAIS, Standard_True );
};
Revision 2019-03-20 11:56 by tizmaylo
Steps To Reproduce Not required
Revision 2019-02-23 05:43 by daidalos77
Steps To Reproduce #include <AIS_Trihedron.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Geom_Axis2Placement.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <WNT_Window.hxx>


#pragma comment (lib , "TKernel.lib")
#pragma comment (lib , "TKG3d.lib")
#pragma comment (lib , "TKMath.lib")
#pragma comment (lib , "TKOpenGl.lib")
#pragma comment (lib , "TKPrim.lib")
#pragma comment (lib , "TKService.lib")
#pragma comment (lib , "TKTopAlgo.lib")
#pragma comment (lib , "TKV3d.lib")

Handle( V3d_Viewer ) myViewerEx;
void TestOpenCascade( HWND wnd )
{
    Handle( Graphic3d_GraphicDriver ) defaultGraphicDriver = new OpenGl_GraphicDriver( new Aspect_DisplayConnection() );
    Handle( V3d_Viewer ) myViewer = new V3d_Viewer( defaultGraphicDriver );
    myViewerEx = myViewer;
    Handle( AIS_InteractiveContext ) myContext = new AIS_InteractiveContext( myViewer );
    Handle( V3d_View ) myView = myViewer->CreateView();
    Handle( WNT_Window ) hWNTWnd = new WNT_Window( reinterpret_cast<HWND>(wnd) );
    myView->SetWindow( hWNTWnd );

    myView->SetAutoZFitMode( Standard_True );
    myView->MustBeResized();
    
    Handle( AIS_Trihedron ) myTrihedron = new AIS_Trihedron( new Geom_Axis2Placement( gp::XOY() ) );
    
    myContext->Display( myTrihedron, Standard_False );
    myContext->Deactivate( myTrihedron );//Deactivate selection of trihedron

    TopoDS_Shape aBoxShape = BRepPrimAPI_MakeBox( 100, 100, 100 );
    Handle( AIS_Shape ) myAIS = new AIS_Shape( aBoxShape );
    myContext->Display( myAIS, Standard_True );
    myContext->SetDisplayMode( myAIS, AIS_Shaded, Standard_True );
    myContext->HilightWithColor( myAIS, myContext->HighlightStyle( Prs3d_TypeOfHighlight_Dynamic ), Standard_True );
    myContext->Remove( myAIS, Standard_True );
};


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker