1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0023226: Extend OpenGl_Context to store map of shared GPU resources

OpenGl_Resource was slightly corrected and OpenGl_Element was extended
with Release method to manage GPU resources.

OpenGl_PrimitiveArray now uses new OpenGl_VertexBuffer class (requires OpenGL 1.5+).
Strange workarounds for feedback mode were removed.

OpenGl_Context now provides access to shared GPU resources
and manages resources queue for delayed release
(replaces functionality of removed OpenGl_ResourceCleaner).
Loaded GL_ARB_texture_buffer_object and GL_ARB_draw_instanced extensions.

Global maps of views, workspaces and structures
were moved to OpenGl_GraphicDriver members.
UserDrawCallback() function moved to OpenGl_GraphicDriver methods.

Aspect_GraphicCallbackStruct now holds handle of OpenGl_Context
instead of system-dependent pointers to GL context definition.

New classes NCollection_Vec2, NCollection_Vec3 and NCollection_Vec4
implements interface to low-level data (points, vertices, colors) in GLSL-style.
Removed EnableVBO argument from vdrawparray Draw Harness command
Corrected compilation errors
Fixed wrong argument in Index VBO initialization
Fixed several cases of incorrect memory management in TKV3d

Visual3d_ViewManager::Remove()
Destroy structures before last view removed for correct GPU resources management.

Graphic3d_Structure::GraphicClear()
Remove groups to avoid usage of dead OpenGl_Group pointers.

V3d_View::Remove()
Fixed mistake in #0000280 patch.
Small correction
Fixed OCC280 test command

Replace removed view within created one in ViewerTest EventManager.
ViewerTest, do not create unused 3D view

In current design NIS_View always created and used for both - NIS objects and AIS objects.
This commit is contained in:
kgv
2012-07-13 15:51:16 +04:00
parent 400933675f
commit 5e27df788d
74 changed files with 3005 additions and 1593 deletions

View File

@@ -32,6 +32,7 @@
#include <DrawTrSurf.hxx>
#include <AIS_InteractiveContext.hxx>
#include <ViewerTest.hxx>
#include <ViewerTest_EventManager.hxx>
#include <AIS_Shape.hxx>
#include <TopoDS_Shape.hxx>
@@ -570,26 +571,31 @@ static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, con
HLR = 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
Handle(V3d_View) anOldView = ViewerTest::CurrentView();
Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
if(atoi(argv[2])) {
aViewer->SetDefaultSurfaceDetail(V3d_TEX_ALL);
if (atoi (argv[2]))
{
aViewer->SetDefaultSurfaceDetail (V3d_TEX_ALL);
}
aViewer->SetDefaultTypeOfView(V3d_PERSPECTIVE);
aViewer->SetDefaultTypeOfView (V3d_PERSPECTIVE);
Handle(Aspect_Window) asp = aView->Window();
aViewer->SetViewOff(aView);
aView->Remove();
Handle(Aspect_Window) asp = anOldView->Window();
aViewer->SetViewOff (anOldView);
anOldView->Remove();
anOldView.Nullify();
Handle(V3d_View) aNewView = aViewer->CreateView();
ViewerTest::CurrentView(aNewView);
ViewerTest::CurrentView (aNewView);
aNewView->SetWindow(asp);
aNewView->SetWindow (asp);
if (!asp->IsMapped()) asp->Map();
aNewView->Update();
// replace view in event manager
ViewerTest::UnsetEventManager();
ViewerTest::SetEventManager (new ViewerTest_EventManager (aNewView, ViewerTest::GetAISContext()));
if (HLR == 1) {
di << "HLR" << "\n";
aNewView->SetDegenerateModeOff();
@@ -2001,7 +2007,7 @@ static Standard_Integer OCC1642 (Draw_Interpretor& di, Standard_Integer argc, co
DBRep::Set(argv[4],face);
advWA->SetFace(face);
float precision_to_ana = 0.0001;
Standard_Real precision_to_ana = 0.0001;
advWA->SetPrecision(precision_to_ana);
TopTools_IndexedMapOfShape M;