mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0023067: OpenGl package API needed by UserDraw feature is not exported
Windows: Exporting non-inline methods that provide info about the current state of OCCT renderer. Minor tweak: fixing incomplete handle/dynamic type for OpenGl_Resource vuserdraw command added to test UserDraw basic operation Separate source file ViewerTest_OpenGlCommands.cxx added for commands testing low-level TKOpenGl functionality
This commit is contained in:
parent
409cc8d1dc
commit
3946774d9e
@ -92,6 +92,7 @@ OpenGl_TextureBox.hxx
|
||||
OpenGl_ImageBox.cxx
|
||||
OpenGl_ImageBox.hxx
|
||||
OpenGl_Resource.hxx
|
||||
OpenGl_Resource.cxx
|
||||
OpenGl_ResourceVBO.hxx
|
||||
OpenGl_ResourceVBO.cxx
|
||||
OpenGl_ResourceTexture.hxx
|
||||
|
23
src/OpenGl/OpenGl_Resource.cxx
Normal file
23
src/OpenGl/OpenGl_Resource.cxx
Normal file
@ -0,0 +1,23 @@
|
||||
// Created on: 2012-04-04
|
||||
// Created by: Sergey ANIKIN
|
||||
// Copyright (c) 2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <OpenGl_Resource.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_Resource, MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Resource, MMgt_TShared)
|
@ -47,16 +47,6 @@ public:
|
||||
//! Constructor
|
||||
OpenGl_Resource(GLuint theId) : myId(theId) { }
|
||||
|
||||
//! Copy constructor
|
||||
OpenGl_Resource(const OpenGl_Resource& theBase) : myId(theBase.myId) { }
|
||||
|
||||
//! Copy operation
|
||||
OpenGl_Resource& operator= (const OpenGl_Resource& theBase)
|
||||
{
|
||||
this->myId = theBase.myId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
virtual ~OpenGl_Resource() {}
|
||||
|
||||
@ -73,6 +63,10 @@ protected:
|
||||
|
||||
GLuint myId; // Id of OpenGl memory resource
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(OpenGl_Resource) // Type definition
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(OpenGl_Resource,MMgt_TShared)
|
||||
|
@ -72,7 +72,7 @@ void OpenGl_ResourceCleaner::AppendContext(GLCONTEXT theContext, Standard_Boolea
|
||||
// memory resource
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean OpenGl_ResourceCleaner::AddResource(GLCONTEXT theContext, Handle_OpenGl_Resource theResource)
|
||||
Standard_Boolean OpenGl_ResourceCleaner::AddResource(GLCONTEXT theContext, const Handle(OpenGl_Resource)& theResource)
|
||||
{
|
||||
// if context found in the shared list
|
||||
if (mySharedContexts.Contains(theContext))
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
//! Tell the OpenGl_ResourceCleaner to clean up the OpenGl memory resource
|
||||
//! which has been created by the specified OpenGl context;
|
||||
//! The context should be in the OpenGl_ResourceCleaner control list.
|
||||
Standard_Boolean AddResource(GLCONTEXT theContext, Handle_OpenGl_Resource theResource);
|
||||
Standard_EXPORT Standard_Boolean AddResource(GLCONTEXT theContext, const Handle(OpenGl_Resource)& theResource);
|
||||
|
||||
//! Cancel clean procedure for all the resources added to the OpenGl_ResourceCleaner.
|
||||
void Clear();
|
||||
@ -83,7 +83,7 @@ public:
|
||||
GLCONTEXT GetSharedContext() const;
|
||||
|
||||
//! Get the global instance of OpenGl_ResourceCleaner
|
||||
static OpenGl_ResourceCleaner* GetInstance();
|
||||
Standard_EXPORT static OpenGl_ResourceCleaner* GetInstance();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -21,25 +21,8 @@
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_ResourceTexture.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceTexture
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
OpenGl_ResourceTexture::OpenGl_ResourceTexture (GLuint theId)
|
||||
: OpenGl_Resource (theId)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceTexture
|
||||
//purpose : Copy constructor
|
||||
//=======================================================================
|
||||
OpenGl_ResourceTexture::OpenGl_ResourceTexture (const OpenGl_ResourceTexture& theResource)
|
||||
: OpenGl_Resource (theResource)
|
||||
{
|
||||
//
|
||||
}
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_ResourceTexture, OpenGl_Resource)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ResourceTexture, OpenGl_Resource)
|
||||
|
||||
//=======================================================================
|
||||
//function : Clean
|
||||
|
@ -34,20 +34,23 @@ class OpenGl_ResourceTexture : public OpenGl_Resource
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
OpenGl_ResourceTexture(GLuint theId);
|
||||
|
||||
//! Copy constructor
|
||||
OpenGl_ResourceTexture(const OpenGl_ResourceTexture& theResource);
|
||||
OpenGl_ResourceTexture(GLuint theId) : OpenGl_Resource (theId) {}
|
||||
|
||||
//! Destructor
|
||||
~OpenGl_ResourceTexture() { }
|
||||
virtual ~OpenGl_ResourceTexture() { }
|
||||
|
||||
protected:
|
||||
|
||||
//! Clean procedure for texture resource;
|
||||
//! Should be called by the OpenGl_ResourceCleaner
|
||||
virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
|
||||
Standard_EXPORT virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(OpenGl_ResourceTexture) // Type definition
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(OpenGl_ResourceTexture,OpenGl_Resource)
|
||||
|
||||
#endif
|
||||
|
@ -22,25 +22,8 @@
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceVBO
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
OpenGl_ResourceVBO::OpenGl_ResourceVBO (GLuint theId)
|
||||
: OpenGl_Resource (theId)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGl_ResourceVBO
|
||||
//purpose : Copy constructor
|
||||
//=======================================================================
|
||||
OpenGl_ResourceVBO::OpenGl_ResourceVBO (const OpenGl_ResourceVBO& theResource)
|
||||
: OpenGl_Resource (theResource)
|
||||
{
|
||||
//
|
||||
}
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_ResourceVBO, OpenGl_Resource)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ResourceVBO, OpenGl_Resource)
|
||||
|
||||
//=======================================================================
|
||||
//function : Clean
|
||||
|
@ -34,20 +34,23 @@ class OpenGl_ResourceVBO : public OpenGl_Resource
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
OpenGl_ResourceVBO(GLuint theId);
|
||||
|
||||
//! Copy constructor
|
||||
OpenGl_ResourceVBO(const OpenGl_ResourceVBO& theResource);
|
||||
OpenGl_ResourceVBO(GLuint theId) : OpenGl_Resource (theId) {}
|
||||
|
||||
//! Destructor
|
||||
~OpenGl_ResourceVBO() { }
|
||||
virtual ~OpenGl_ResourceVBO() { }
|
||||
|
||||
protected:
|
||||
|
||||
//! Clean procedure for VBO resource;
|
||||
//! Should be called by the OpenGl_ResourceCleaner
|
||||
virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
|
||||
Standard_EXPORT virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(OpenGl_ResourceVBO) // Type definition
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(OpenGl_ResourceVBO,OpenGl_Resource)
|
||||
|
||||
#endif
|
||||
|
@ -152,10 +152,11 @@ public:
|
||||
|
||||
void SetTextParam (const OpenGl_TextParam* theParam) { TextParam_set = theParam; }
|
||||
|
||||
const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply);
|
||||
const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply);
|
||||
const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
|
||||
const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply);
|
||||
//// THESE METHODS ARE EXPORTED AS THEY PROVIDE STATE INFO TO USERDRAW
|
||||
Standard_EXPORT const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply);
|
||||
Standard_EXPORT const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply);
|
||||
Standard_EXPORT const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
|
||||
Standard_EXPORT const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply);
|
||||
|
||||
//! Clear the applied aspect state.
|
||||
void ResetAppliedAspect();
|
||||
|
@ -5,3 +5,4 @@ ViewerTest_RelationCommands.cxx
|
||||
ViewerTest_ObjectCommands.cxx
|
||||
ViewerTest_FilletCommands.cxx
|
||||
ViewerTest_VoxelCommands.cxx
|
||||
ViewerTest_OpenGlCommands.cxx
|
||||
|
@ -125,6 +125,7 @@ is
|
||||
ObjectCommands(theCommands :in out Interpretor from Draw);
|
||||
FilletCommands(theCommands :in out Interpretor from Draw);
|
||||
VoxelCommands(theCommands :in out Interpretor from Draw);
|
||||
OpenGlCommands(theCommands :in out Interpretor from Draw);
|
||||
|
||||
GetMousePosition(xpix,ypix: out Integer from Standard);
|
||||
|
||||
|
@ -3438,6 +3438,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
||||
ViewerTest::ObjectCommands(theCommands);
|
||||
ViewerTest::FilletCommands(theCommands);
|
||||
ViewerTest::VoxelCommands(theCommands);
|
||||
ViewerTest::OpenGlCommands(theCommands);
|
||||
|
||||
const char *group = "AIS_Display";
|
||||
|
||||
|
260
src/ViewerTest/ViewerTest_OpenGlCommands.cxx
Normal file
260
src/ViewerTest/ViewerTest_OpenGlCommands.cxx
Normal file
@ -0,0 +1,260 @@
|
||||
// Created on: 2012-04-09
|
||||
// Created by: Sergey ANIKIN
|
||||
// Copyright (c) 2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ViewerTest.hxx>
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <OpenGl_ArbVBO.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Callback.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
#include <OpenGl_ExtFBO.hxx>
|
||||
#include <OpenGl_GlCore20.hxx>
|
||||
#include <OpenGl_ResourceCleaner.hxx>
|
||||
#include <OpenGl_ResourceTexture.hxx>
|
||||
#include <OpenGl_ResourceVBO.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Select3D_SensitiveCurve.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
|
||||
const Handle(AIS_InteractiveObject)& theAISObj,
|
||||
Standard_Boolean theReplaceIfExists = Standard_True);
|
||||
|
||||
//=======================================================================
|
||||
//function : VUserDraw
|
||||
//purpose : Checks availability and operation of UserDraw feature
|
||||
//=======================================================================
|
||||
DEFINE_STANDARD_HANDLE(VUserDrawObj, AIS_InteractiveObject)
|
||||
|
||||
class VUserDrawObj : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
// CASCADE RTTI
|
||||
DEFINE_STANDARD_RTTI(VUserDrawObj);
|
||||
|
||||
VUserDrawObj()
|
||||
{
|
||||
myCoords[0] = -10.;
|
||||
myCoords[1] = -20.;
|
||||
myCoords[2] = -30.;
|
||||
myCoords[3] = 10.;
|
||||
myCoords[4] = 20.;
|
||||
myCoords[5] = 30.;
|
||||
}
|
||||
|
||||
public:
|
||||
class Element : public OpenGl_Element
|
||||
{
|
||||
private:
|
||||
Handle(VUserDrawObj) myIObj;
|
||||
|
||||
public:
|
||||
Element (const Handle(VUserDrawObj)& theIObj,
|
||||
CALL_DEF_BOUNDS* theBounds)
|
||||
: myIObj( theIObj )
|
||||
{
|
||||
if (!myIObj.IsNull())
|
||||
myIObj->GetBounds(theBounds);
|
||||
}
|
||||
|
||||
virtual ~Element ()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
if (!myIObj.IsNull())
|
||||
myIObj->Render(theWorkspace);
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
};
|
||||
|
||||
private:
|
||||
// Virtual methods implementation
|
||||
void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
// Called by VUserDrawElement
|
||||
void Render(const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
void GetBounds(CALL_DEF_BOUNDS* theBounds);
|
||||
|
||||
GLfloat myCoords[6];
|
||||
|
||||
friend class Element;
|
||||
};
|
||||
IMPLEMENT_STANDARD_HANDLE(VUserDrawObj, AIS_InteractiveObject)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(VUserDrawObj, AIS_InteractiveObject)
|
||||
|
||||
void VUserDrawObj::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
|
||||
Handle(Graphic3d_Group) aGrp = Prs3d_Root::CurrentGroup(thePresentation);
|
||||
aGrp->UserDraw(this, Standard_True, Standard_True);
|
||||
}
|
||||
|
||||
void VUserDrawObj::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5);
|
||||
aPnts->SetValue(1, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
|
||||
aPnts->SetValue(2, gp_Pnt(myCoords[3], myCoords[4], myCoords[2]));
|
||||
aPnts->SetValue(3, gp_Pnt(myCoords[3], myCoords[4], myCoords[5]));
|
||||
aPnts->SetValue(4, gp_Pnt(myCoords[0], myCoords[1], myCoords[5]));
|
||||
aPnts->SetValue(5, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
|
||||
Handle(Select3D_SensitiveCurve) aSensitive = new Select3D_SensitiveCurve(anEntityOwner, aPnts);
|
||||
theSelection->Add(aSensitive);
|
||||
}
|
||||
|
||||
void VUserDrawObj::GetBounds(CALL_DEF_BOUNDS* theBounds)
|
||||
{
|
||||
if (theBounds)
|
||||
{
|
||||
theBounds->XMin = myCoords[0];
|
||||
theBounds->YMin = myCoords[1];
|
||||
theBounds->ZMin = myCoords[2];
|
||||
theBounds->XMax = myCoords[3];
|
||||
theBounds->YMax = myCoords[4];
|
||||
theBounds->ZMax = myCoords[5];
|
||||
}
|
||||
}
|
||||
|
||||
void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
// To test linking against OpenGl_Workspace and all aspect classes
|
||||
const OpenGl_AspectLine* aLA = theWorkspace->AspectLine(0);
|
||||
const OpenGl_AspectFace* aFA = theWorkspace->AspectFace(0);
|
||||
aFA->Context();
|
||||
const OpenGl_AspectMarker* aMA = theWorkspace->AspectMarker(0);
|
||||
aMA->Type();
|
||||
const OpenGl_AspectText* aTA = theWorkspace->AspectText(0);
|
||||
aTA->Font();
|
||||
TEL_COLOUR aColor = theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ?
|
||||
*(theWorkspace->HighlightColor) : aLA->Color();
|
||||
|
||||
// To test OpenGl_Window
|
||||
Handle(OpenGl_Context) aCtx = theWorkspace->GetGlContext();
|
||||
GLCONTEXT aGlContext = theWorkspace->GetGContext();
|
||||
|
||||
// To link against OpenGl_Context and extensions
|
||||
GLuint aVboId = -1, aTexId = -1;
|
||||
if (aCtx->arbVBO)
|
||||
aCtx->arbVBO->glGenBuffersARB(1, &aVboId);
|
||||
glGenTextures(1, &aTexId);
|
||||
|
||||
// To link against OpenGl_ResourceCleaner, OpenGl_ResourceVBO, OpenGl_ResourceTexture
|
||||
OpenGl_ResourceCleaner* aResCleaner = OpenGl_ResourceCleaner::GetInstance();
|
||||
if (aVboId != (GLuint)-1)
|
||||
aResCleaner->AddResource(aGlContext, new OpenGl_ResourceVBO(aVboId));
|
||||
if (aTexId != (GLuint)-1)
|
||||
aResCleaner->AddResource(aGlContext, new OpenGl_ResourceTexture(aTexId));
|
||||
|
||||
// Finally draw something to make sure UserDraw really works
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_LIGHTING);
|
||||
glColor4fv(aColor.rgb);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex3f(myCoords[0], myCoords[1], myCoords[2]);
|
||||
glVertex3f(myCoords[3], myCoords[4], myCoords[2]);
|
||||
glVertex3f(myCoords[3], myCoords[4], myCoords[5]);
|
||||
glVertex3f(myCoords[0], myCoords[1], myCoords[5]);
|
||||
glEnd();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
|
||||
OpenGl_Element* VUserDrawCallback(const CALL_DEF_USERDRAW * theUserDraw)
|
||||
{
|
||||
Handle(VUserDrawObj) anIObj = (VUserDrawObj*)theUserDraw->Data;
|
||||
if (anIObj.IsNull())
|
||||
{
|
||||
std::cout << "VUserDrawCallback error: null object passed, the custom scene element will not be rendered" << std::endl;
|
||||
}
|
||||
|
||||
return new VUserDrawObj::Element(anIObj, theUserDraw->Bounds);
|
||||
}
|
||||
|
||||
static Standard_Integer VUserDraw (Draw_Interpretor& di,
|
||||
Standard_Integer argc,
|
||||
const char ** argv)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||
if (aContext.IsNull())
|
||||
{
|
||||
di << argv[0] << "Call 'vinit' before!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc > 2)
|
||||
{
|
||||
di << argv[0] << "Wrong number of arguments, only the object name expected\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aName (argv[1]);
|
||||
VDisplayAISObject(aName, Handle(AIS_InteractiveObject)());
|
||||
|
||||
// register the custom element factory function
|
||||
::UserDrawCallback() = VUserDrawCallback;
|
||||
|
||||
Handle(VUserDrawObj) anIObj = new VUserDrawObj();
|
||||
VDisplayAISObject(aName, anIObj);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenGlCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ViewerTest::OpenGlCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
const char* aGroup ="Commands for low-level TKOpenGl features";
|
||||
|
||||
theCommands.Add("vuserdraw",
|
||||
"vuserdraw : name - simulates drawing with help of UserDraw",
|
||||
__FILE__, VUserDraw, aGroup);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user