Drop Graphic3d_GraphicDriver::Begin() and ::End() methods.
Initialization is performed within driver constructor.
Drop dummy argument for Graphic3d_GraphicDriver constructor with library name.
Display connection now should be set instead
Drop Graphic3d::InitGraphicDriver() function and Graphic3d.hxx header.
Application code should explicitly link against TKOpenGl toolkit and instantiate OpenGl_GraphicDriver class.
Drop MetaGraphicDriverFactory implementation within TKOpenGl.
//for OCC graphic
#include <Aspect_DisplayConnection.hxx>
#include <WNT_Window.hxx>
-#include <Graphic3d.hxx>
-#include <Graphic3d_GraphicDRiver.hxx>
#include <OpenGl_GraphicDriver.hxx>
//for object display
#include <V3d_Viewer.hxx>
myView() = myAISContext()->CurrentViewer()->CreateView();
if (myGraphicDriver().IsNull())
{
- Handle(Aspect_DisplayConnection) aDisplayConnection;
- myGraphicDriver() = Graphic3d::InitGraphicDriver (aDisplayConnection);
+ myGraphicDriver() = new OpenGl_GraphicDriver (Handle(Aspect_DisplayConnection)());
}
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (theWnd.ToPointer()));
myView()->SetWindow(aWNTWindow);
NCollection_Haft<Handle_V3d_Viewer> myViewer;
NCollection_Haft<Handle_V3d_View> myView;
NCollection_Haft<Handle_AIS_InteractiveContext> myAISContext;
- NCollection_Haft<Handle_Graphic3d_GraphicDriver> myGraphicDriver;
+ NCollection_Haft<Handle_OpenGl_GraphicDriver> myGraphicDriver;
};
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Point.hxx>
-#include <Graphic3d.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Graphic3d.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <AIS_InteractiveObject.hxx>
-#include <Graphic3d.hxx>
#include <Graphic3d_NameOfMaterial.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <TCollection_AsciiString.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Aspect_DisplayConnection.hxx>
-#include <Graphic3d.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx>
end SortType;
- ----------------------------
- -- Category: Package methods
- ----------------------------
-
- InitGraphicDriver (theDisplayConnection: DisplayConnection_Handle from Aspect)
- returns GraphicDriver from Graphic3d
- raises DriverDefinitionError from Aspect;
- ---Purpose: Initialize graphic driver and returns Handle to it.
-
-
-
end Graphic3d;
+++ /dev/null
-// Copyright (c) 2013-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Graphic3d.ixx>
-
-#include <Aspect_DisplayConnection.hxx>
-#include <Aspect_DriverDefinitionError.hxx>
-#include <OSD_Environment.hxx>
-
-//=======================================================================
-//function : InitGraphicDriver
-//purpose :
-//=======================================================================
-Handle(Graphic3d_GraphicDriver) Graphic3d::InitGraphicDriver (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
-{
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
- if (theDisplayConnection.IsNull())
- {
- Aspect_DriverDefinitionError::Raise ("Null display connection.");
- }
-#endif
-
- TCollection_AsciiString aGraphicLibName;
-
- // Setting the library name. Depends on the platform.
-#if defined(_WIN32) || defined(__WIN32__)
- aGraphicLibName = "TKOpenGl.dll";
-#elif defined(__hpux) || defined(HPUX)
- aGraphicLibName = "libTKOpenGl.sl";
-#elif defined(__APPLE__)
- aGraphicLibName = "libTKOpenGl.dylib";
-#else
- aGraphicLibName = "libTKOpenGl.so";
-#endif
-
- // Loading the library.
- OSD_SharedLibrary aSharedLibrary (aGraphicLibName.ToCString());
- if (!aSharedLibrary.DlOpen (OSD_RTLD_LAZY))
- {
- Aspect_DriverDefinitionError::Raise (aSharedLibrary.DlError());
- }
-
- // Retrieving factory function pointer.
- typedef Handle(Graphic3d_GraphicDriver) (*GraphicDriverFactoryPointer) (Standard_CString);
- GraphicDriverFactoryPointer aGraphicDriverConstructor = (GraphicDriverFactoryPointer )aSharedLibrary.DlSymb ("MetaGraphicDriverFactory");
- if (aGraphicDriverConstructor == NULL)
- {
- Aspect_DriverDefinitionError::Raise (aSharedLibrary.DlError());
- }
-
- // Creating driver instance.
- Handle(Graphic3d_GraphicDriver) aGraphicDriver = aGraphicDriverConstructor (aSharedLibrary.Name());
-
- // Management of traces.
- OSD_Environment aTraceEnv ("CSF_GraphicTrace");
- TCollection_AsciiString aTrace = aTraceEnv.Value();
- if (aTrace.IsIntegerValue())
- {
- aGraphicDriver->SetTrace (aTrace.IntegerValue());
- }
-
- // Starting graphic driver.
- if (!aGraphicDriver->Begin (theDisplayConnection))
- {
- Aspect_DriverDefinitionError::Raise ("Cannot connect to graphic library.");
- }
-
- return aGraphicDriver;
-}
uses
- SharedLibrary from OSD,
-
Array1OfInteger from TColStd,
Array1OfReal from TColStd,
Array2OfReal from TColStd,
TransformError from Graphic3d
is
- Initialize ( AShrName : CString from Standard )
- returns GraphicDriver from Graphic3d;
- ---Level: Public
- ---Purpose: Initialises the Driver
-
- -------------------------
- -- Category: Init methods
- -------------------------
-
- Begin (me: mutable;
- theDisplayConnection: DisplayConnection_Handle from Aspect)
- returns Boolean from Standard
- is deferred;
- ---Purpose: Starts graphic driver with given connection
-
- End ( me : mutable )
- is deferred;
- ---Purpose: call_togl_end
+ Initialize (theDisp : DisplayConnection_Handle from Aspect)
+ returns GraphicDriver from Graphic3d;
+ ---Level: Public
+ ---Purpose: Initialises the Driver
----------------------------
-- Category: Inquire methods
returns Integer from Standard
is static;
- --ListOfAvalableFontNames( me;
- -- lst: out NListOfHAsciiString from Graphic3d )
- -- returns Boolean from Standard
- -- is deferred;
- -- Purpose: Initialize list of names of avalable system fonts
- -- returns Standard_False if fails
- -- ABD Integration support of system fonts (using FTGL and FreeType)
-
GetDisplayConnection (me)
returns DisplayConnection_Handle from Aspect;
---C++: return const &
fields
MyTraceLevel : Integer from Standard is protected;
- MySharedLibrary : SharedLibrary from OSD is protected;
myDisplayConnection: DisplayConnection_Handle from Aspect is protected;
myDeviceLostFlag : Boolean from Standard is protected;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// 11/97 ; CAL : retrait de la dependance avec math
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex, Phigs et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
#include <Graphic3d_GraphicDriver.ixx>
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Constructors
-
-Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Standard_CString AShrName) {
-
- SetTrace (0);
- MySharedLibrary.SetName (AShrName);
- myDeviceLostFlag = Standard_False;
-
- //if (! MySharedLibrary.DlOpen (OSD_RTLD_LAZY))
- //Aspect_DriverDefinitionError::Raise (MySharedLibrary.DlError ());
-
+Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
+: MyTraceLevel (0),
+ myDisplayConnection (theDisp),
+ myDeviceLostFlag (Standard_False)
+{
+ //
}
//-Internal methods, in order
namespace
{
static const Handle(OpenGl_Context) TheNullGlCtx;
-};
-
-// Pour eviter de "mangler" MetaGraphicDriverFactory, le nom de la
-// fonction qui cree un Graphic3d_GraphicDriver.
-// En effet, ce nom est recherche par la methode DlSymb de la
-// classe OSD_SharedLibrary dans la methode SetGraphicDriver de la
-// classe Graphic3d_GraphicDevice
-extern "C" {
-#if defined(_MSC_VER) // disable MS VC++ warning on C-style function returning C++ object
- #pragma warning(push)
- #pragma warning(disable:4190)
-#endif
- Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory (const Standard_CString theShrName)
- {
- Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (theShrName);
- return aDriver;
- }
-#if defined(_MSC_VER)
- #pragma warning(pop)
-#endif
-}
-
-// =======================================================================
-// function : OpenGl_GraphicDriver
-// purpose :
-// =======================================================================
-OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
-: Graphic3d_GraphicDriver ("TKOpenGl"),
- myCaps (new OpenGl_Caps()),
- myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
- myMapOfWS (1, NCollection_BaseAllocator::CommonBaseAllocator()),
- myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator()),
- myUserDrawCallback (NULL),
- myTempText (new OpenGl_Text())
-{
- Begin (theDisplayConnection);
}
// =======================================================================
// function : OpenGl_GraphicDriver
// purpose :
// =======================================================================
-OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString theShrName)
-: Graphic3d_GraphicDriver (theShrName),
+OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
+: Graphic3d_GraphicDriver (theDisp),
myCaps (new OpenGl_Caps()),
myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
myMapOfWS (1, NCollection_BaseAllocator::CommonBaseAllocator()),
myUserDrawCallback (NULL),
myTempText (new OpenGl_Text())
{
- //
-}
-
-// =======================================================================
-// function : Begin
-// purpose :
-// =======================================================================
-Standard_Boolean OpenGl_GraphicDriver::Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
-{
- myDisplayConnection = theDisplayConnection;
+#if (!defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
if (myDisplayConnection.IsNull())
{
- #if (!defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
//Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_GraphicDriver: cannot connect to X server!");
- return Standard_False;
- #else
- return Standard_True;
- #endif
+ return;
}
-#if (!defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
Display* aDisplay = myDisplayConnection->GetDisplay();
Bool toSync = ::getenv ("CSF_GraphicSync") != NULL
|| ::getenv ("CALL_SYNCHRO_X") != NULL;
#endif
}
#endif
- return Standard_True;
-}
-
-// =======================================================================
-// function : End
-// purpose :
-// =======================================================================
-void OpenGl_GraphicDriver::End()
-{
- // deprecated method
- ///myDisplayConnection.Nullify();
}
// =======================================================================
public:
//! Constructor
- Standard_EXPORT OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
-
- //! Constructor
- Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName = "TKOpenGl");
- Standard_EXPORT Standard_Boolean Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
- Standard_EXPORT void End ();
+ Standard_EXPORT OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp);
Standard_EXPORT Standard_Integer InquireLightLimit ();
Standard_EXPORT Standard_Integer InquireViewLimit ();
#include <AIS_InteractiveContext.hxx>
#include <Aspect_Window.hxx>
#include <Aspect_DisplayConnection.hxx>
-#include <Graphic3d.hxx>
#include <DBRep.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Image_Diff.hxx>
#include <Aspect_DisplayConnection.hxx>
-#include <Graphic3d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>