0024847: CLang warnings -Wdeprecated-writable-strings in OpenGl_Display
authorkgv <kgv@opencascade.com>
Wed, 30 Apr 2014 09:38:50 +0000 (13:38 +0400)
committerapn <apn@opencascade.com>
Wed, 30 Apr 2014 09:39:53 +0000 (13:39 +0400)
Remove obsolete properties, remove OpenGl_Display class.
Fix compilation on Linux

26 files changed:
src/InterfaceGraphic/FILES
src/InterfaceGraphic/InterfaceGraphic_Palette.c [deleted file]
src/InterfaceGraphic/InterfaceGraphic_WNT.hxx
src/OpenGl/FILES
src/OpenGl/Handle_OpenGl_Display.hxx [deleted file]
src/OpenGl/OpenGl_Display.cxx [deleted file]
src/OpenGl/OpenGl_Display.hxx [deleted file]
src/OpenGl/OpenGl_Display_2.cxx [deleted file]
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_GraphicDriver.hxx
src/OpenGl/OpenGl_GraphicDriver_1.cxx [deleted file]
src/OpenGl/OpenGl_GraphicDriver_2.cxx [deleted file]
src/OpenGl/OpenGl_GraphicDriver_7.cxx
src/OpenGl/OpenGl_GraphicDriver_Layer.cxx
src/OpenGl/OpenGl_LineAttributes.cxx [new file with mode: 0644]
src/OpenGl/OpenGl_LineAttributes.hxx [new file with mode: 0644]
src/OpenGl/OpenGl_View.cxx
src/OpenGl/OpenGl_View.hxx
src/OpenGl/OpenGl_View_2.cxx
src/OpenGl/OpenGl_Window.cxx
src/OpenGl/OpenGl_Window.hxx
src/OpenGl/OpenGl_Window_1.mm
src/OpenGl/OpenGl_Workspace.cxx
src/OpenGl/OpenGl_Workspace.hxx
src/OpenGl/OpenGl_Workspace_2.cxx
src/OpenGl/OpenGl_Workspace_5.cxx

index d398999..ea3fe2c 100755 (executable)
@@ -8,6 +8,5 @@ InterfaceGraphic_Cocoa.hxx
 InterfaceGraphic_XWD.hxx
 InterfaceGraphic_wntio.hxx
 InterfaceGraphic_cPrintf.cxx
 InterfaceGraphic_XWD.hxx
 InterfaceGraphic_wntio.hxx
 InterfaceGraphic_cPrintf.cxx
-InterfaceGraphic_Palette.c
 InterfaceGraphic_telem.hxx
 InterfaceGraphic_tgl_all.hxx
 InterfaceGraphic_telem.hxx
 InterfaceGraphic_tgl_all.hxx
diff --git a/src/InterfaceGraphic/InterfaceGraphic_Palette.c b/src/InterfaceGraphic/InterfaceGraphic_Palette.c
deleted file mode 100644 (file)
index 380b19b..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- Copyright (c) 1991-1999 Matra Datavision
- Copyright (c) 1999-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.
-*/
-
-#ifndef WNT
-
-int _a_horreur_du_vide_a_la_compilation;
-
-#else 
-
-#define STRICT
-#include <windows.h>
-
-#pragma comment( lib, "user32.lib" )
-#pragma comment( lib, "gdi32.lib"  )
-
-#if WINVER >= 0x0400
-# define NB_STATIC_COLORS ( COLOR_INFOBK - COLOR_SCROLLBAR + 1 )
-#else
-# define NB_STATIC_COLORS ( COLOR_BTNHIGHLIGHT - COLOR_SCROLLBAR + 1 )
-#endif  /* WINVER . . . */
-
-#define BLACK RGB(   0,   0,   0 )
-#define WHITE RGB( 255, 255, 255 )
-
-static int s_sysPalIdx[ NB_STATIC_COLORS ] = {
-
-            COLOR_SCROLLBAR, 
-            COLOR_BACKGROUND,
-            COLOR_ACTIVECAPTION,
-            COLOR_INACTIVECAPTION,
-            COLOR_MENU,
-            COLOR_WINDOW,
-            COLOR_WINDOWFRAME,
-            COLOR_MENUTEXT,
-            COLOR_WINDOWTEXT,
-            COLOR_CAPTIONTEXT,
-            COLOR_ACTIVEBORDER,
-            COLOR_INACTIVEBORDER,
-            COLOR_APPWORKSPACE,
-            COLOR_HIGHLIGHT,
-            COLOR_HIGHLIGHTTEXT,
-            COLOR_BTNFACE,
-            COLOR_BTNSHADOW,
-            COLOR_GRAYTEXT,
-            COLOR_BTNTEXT,
-            COLOR_INACTIVECAPTIONTEXT,
-            COLOR_BTNHIGHLIGHT
-#if WINVER >= 0x0400
-            ,COLOR_3DDKSHADOW,
-             COLOR_3DLIGHT,
-             COLOR_INFOTEXT,
-             COLOR_INFOBK
-#endif  /* WINVER . . . */
-};
-
-static COLORREF s_sysPalBW[ NB_STATIC_COLORS ] = {
-
-                 WHITE,  /* COLOR_SCROLLBAR           */
-                 BLACK,  /* COLOR_BACKGROUND          */
-                 BLACK,  /* COLOR_ACTIVECAPTION       */
-                 WHITE,  /* COLOR_INACTIVECAPTION     */
-                 WHITE,  /* COLOR_MENU                */
-                 WHITE,  /* COLOR_WINDOW              */
-                 BLACK,  /* COLOR_WINDOWFRAME         */
-                 BLACK,  /* COLOR_MENUTEXT            */
-                 BLACK,  /* COLOR_WINDOWTEXT          */
-                 WHITE,  /* COLOR_CAPTIONTEXT         */
-                 WHITE,  /* COLOR_ACTIVEBORDER        */
-                 WHITE,  /* COLOR_INACTIVEBORDER      */
-                 WHITE,  /* COLOR_APPWORKSPACE        */
-                 BLACK,  /* COLOR_HIGHLIGHT           */
-                 WHITE,  /* COLOR_HIGHLIGHTTEXT       */
-                 WHITE,  /* COLOR_BTNFACE             */
-                 BLACK,  /* COLOR_BTNSHADOW           */
-                 BLACK,  /* COLOR_GRAYTEXT            */
-                 BLACK,  /* COLOR_BTNTEXT             */
-                 BLACK,  /* COLOR_INACTIVECAPTIONTEXT */
-                 BLACK   /* COLOR_BTNHIGHLIGHT        */
-#if WINVER >= 0x0400
-                 ,BLACK,  /* BLACKCOLOR_3DDKSHADOW    */
-                  BLACK,  /* COLOR_3DLIGHT            */
-                  BLACK,  /* COLOR_INFOTEXT           */
-                  BLACK   /* COLOR_INFOBK             */
-#endif  /* WINVER . . . */
-};
-
-static BOOL     s_sysUse;
-static COLORREF s_sysPal[ NB_STATIC_COLORS ];
-
-__declspec( dllexport ) long InterfaceGraphic_RealizePalette ( HDC hdc, HPALETTE hPal, BOOL fBkg, BOOL fUseStatic ) {
-
- int i;
- long retVal = 0;
-
- if ( fUseStatic ) {
-
-  if ( !s_sysUse )
-   
-   for ( i = 0; i < NB_STATIC_COLORS; ++i ) s_sysPal[ i ] = GetSysColor ( s_sysPalIdx[ i ] );
-
-  SetSystemPaletteUse ( hdc, fBkg ? SYSPAL_STATIC : SYSPAL_NOSTATIC );
-
-  if (  UnrealizeObject ( hPal ) && SelectPalette ( hdc, hPal, fBkg )  ) retVal = RealizePalette ( hdc );
-
-  if ( fBkg ) {
-   SetSysColors ( NB_STATIC_COLORS, s_sysPalIdx, s_sysPal );
-   s_sysUse = FALSE;
-  } else {
-  
-   SetSysColors ( NB_STATIC_COLORS, s_sysPalIdx, s_sysPalBW );
-   s_sysUse = TRUE;
-  
-  }  // end else
-#pragma warning(push)
-#pragma warning(disable:4306) /* level 4 warning on cast of int to HWND in HWND_BROADCAST macro */
-  PostMessage ( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0 );
-#pragma warning(pop)
-
- } else {
-  SelectPalette ( hdc, hPal, FALSE );
-  retVal = RealizePalette ( hdc );
- }  // end else
-
- return retVal;
-}  // end RealizePaletteNow
-
-#endif /* WNT */
index d0a544f..4a87947 100644 (file)
@@ -72,15 +72,6 @@ typedef struct font_data {
 
 } FONT_DATA;
 
 
 } FONT_DATA;
 
-#ifdef __cplusplus
-extern "C" {
-#endif  /* __cplusplus */
-
-  __declspec( dllimport ) long InterfaceGraphic_RealizePalette ( HDC, HPALETTE, BOOL, BOOL );
-
-#ifdef __cplusplus
-}
-#endif  /* __cplusplus */
 #endif //WNT
 
 #endif  /* __INTERFACE_GRAPHIC_WNT_HXX */
 #endif //WNT
 
 #endif  /* __INTERFACE_GRAPHIC_WNT_HXX */
index 9b31318..2a8a56d 100755 (executable)
@@ -3,8 +3,6 @@ OpenGl_CMPLRS.edl
 Handle_OpenGl_GraphicDriver.hxx
 OpenGl_GraphicDriver.hxx
 OpenGl_GraphicDriver.cxx
 Handle_OpenGl_GraphicDriver.hxx
 OpenGl_GraphicDriver.hxx
 OpenGl_GraphicDriver.cxx
-OpenGl_GraphicDriver_1.cxx
-OpenGl_GraphicDriver_2.cxx
 OpenGl_GraphicDriver_4.cxx
 OpenGl_GraphicDriver_7.cxx
 OpenGl_GraphicDriver_713.cxx
 OpenGl_GraphicDriver_4.cxx
 OpenGl_GraphicDriver_7.cxx
 OpenGl_GraphicDriver_713.cxx
@@ -54,10 +52,8 @@ OpenGl_NamedStatus.hxx
 OpenGl_TextParam.hxx
 OpenGl_PrinterContext.hxx
 OpenGl_PrinterContext.cxx
 OpenGl_TextParam.hxx
 OpenGl_PrinterContext.hxx
 OpenGl_PrinterContext.cxx
-Handle_OpenGl_Display.hxx
-OpenGl_Display.hxx
-OpenGl_Display.cxx
-OpenGl_Display_2.cxx
+OpenGl_LineAttributes.hxx
+OpenGl_LineAttributes.cxx
 Handle_OpenGl_Window.hxx
 OpenGl_Window.hxx
 OpenGl_Window.cxx
 Handle_OpenGl_Window.hxx
 OpenGl_Window.hxx
 OpenGl_Window.cxx
diff --git a/src/OpenGl/Handle_OpenGl_Display.hxx b/src/OpenGl/Handle_OpenGl_Display.hxx
deleted file mode 100644 (file)
index 971d91d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Created on: 2011-09-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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.
-
-#ifndef _Handle_OpenGl_Display_Header
-#define _Handle_OpenGl_Display_Header
-
-#include <Standard_DefineHandle.hxx>
-#include <Handle_MMgt_TShared.hxx>
-
-class OpenGl_Display;
-
-// Handle definition
-//
-DEFINE_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared)
-
-
-#endif //_Handle_OpenGl_Display_Header
diff --git a/src/OpenGl/OpenGl_Display.cxx b/src/OpenGl/OpenGl_Display.cxx
deleted file mode 100644 (file)
index ba3c8a0..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-// Created on: 2011-09-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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 <OpenGl_GlCore11.hxx>
-
-#include <OpenGl_Display.hxx>
-#include <OpenGl_Context.hxx>
-#include <OpenGl_Light.hxx>
-
-#include <OSD_Environment.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Aspect_GraphicDeviceDefinitionError.hxx>
-
-#if (!defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
-  #include <X11/Xlib.h> // XOpenDisplay()
-#endif
-
-IMPLEMENT_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared)
-IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Display,MMgt_TShared)
-
-namespace
-{
-  #if (defined(_WIN32) || defined(__WIN32__)) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
-    static char* TheDummyDisplay = "DISPLAY";
-  #endif
-
-  static const OpenGl_Facilities myDefaultFacilities = { 1, 1, 1, 1, OpenGLMaxLights, 10000 };
-};
-
-/*----------------------------------------------------------------------*/
-#if (defined(_WIN32) || defined(__WIN32__)) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
-OpenGl_Display::OpenGl_Display (const Handle(Aspect_DisplayConnection)& )
-#else
-OpenGl_Display::OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
-#endif
-: myDisplay(NULL),
-  myFacilities(myDefaultFacilities),
-  myDBuffer(Standard_True),
-  myDither(Standard_True),
-  myBackDither(Standard_False),
-  mySymPerspective(Standard_False),
-  myOffsetFactor(1.F),
-  myOffsetUnits(0.F),
-  myAntiAliasingMode(3),
-  myLinestyleBase(0),
-  myPatternBase(0)
-{
-#if (defined(_WIN32) || defined(__WIN32__)) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
-  myDisplay = TheDummyDisplay;
-#else
-  myDisplay = theDisplayConnection->GetDisplay();
-#endif
-
-  Init();
-}
-
-/*----------------------------------------------------------------------*/
-
-OpenGl_Display::~OpenGl_Display ()
-{
-  ReleaseAttributes (NULL);
-  myDisplay = NULL;
-}
-
-void OpenGl_Display::ReleaseAttributes (const OpenGl_Context* theGlCtx)
-{
-  // Delete line styles
-  if (myLinestyleBase != 0)
-  {
-    if (theGlCtx->IsValid())
-    {
-      glDeleteLists ((GLuint )myLinestyleBase, 5);
-    }
-    myLinestyleBase = 0;
-  }
-  // Delete surface patterns
-  if (myPatternBase != 0)
-  {
-    if (theGlCtx->IsValid())
-    {
-      glDeleteLists ((GLuint )myPatternBase, TEL_HS_USER_DEF_START);
-    }
-    myPatternBase = 0;
-  }
-}
-
-/*----------------------------------------------------------------------*/
-
-void OpenGl_Display::Init()
-{
-  if (myDisplay != NULL)
-  {
-  #if (!defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
-    XSynchronize ((Display* )myDisplay, (getenv("CALL_SYNCHRO_X") != NULL) ? 1 : 0);
-
-    if (getenv("CSF_GraphicSync") != NULL)
-      XSynchronize ((Display* )myDisplay, 1);
-
-    // does the server know about OpenGL & GLX?
-    int aDummy;
-    if (!XQueryExtension ((Display* )myDisplay, "GLX", &aDummy, &aDummy, &aDummy))
-    {
-    #ifdef DEBUG
-      std::cerr << "This system doesn't appear to support OpenGL\n";
-    #endif
-    }
-  #endif
-  }
-  else
-  {
-    TCollection_AsciiString msg("OpenGl_Display::Init");
-  #if (!defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
-    msg += " : Cannot connect to X server ";
-    msg += XDisplayName ((char*) NULL);
-  #endif
-    Aspect_GraphicDeviceDefinitionError::Raise(msg.ToCString());
-  }
-
-  if (getenv("CALL_OPENGL_NO_DBF") != NULL)
-    myDBuffer = Standard_False;
-
-  if (getenv("CALL_OPENGL_NO_DITHER") != NULL)
-    myDither = Standard_False;
-
-  if (getenv("CALL_OPENGL_NO_BACKDITHER") != NULL)
-    myBackDither = Standard_False;
-
-  /* OCC18942: Test if symmetric perspective projection should be turned on */
-  if (getenv("CSF_SYM_PERSPECTIVE") != NULL)
-    mySymPerspective = Standard_True;
-
-  const char* pvalue = getenv("CALL_OPENGL_POLYGON_OFFSET");
-  if (pvalue)
-  {
-    float v1, v2;
-    const int n = sscanf(pvalue, "%f %f", &v1, &v2);
-    if (n > 0) myOffsetFactor = v1;
-    if (n > 1) myOffsetUnits  = v2;
-  }
-
-  pvalue = getenv("CALL_OPENGL_ANTIALIASING_MODE");
-  if (pvalue)
-  {
-    int v;
-    if ( sscanf(pvalue,"%d",&v) > 0 ) myAntiAliasingMode = v;
-  }
-}
diff --git a/src/OpenGl/OpenGl_Display.hxx b/src/OpenGl/OpenGl_Display.hxx
deleted file mode 100644 (file)
index 0590168..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// Created on: 2011-09-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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.
-
-#ifndef _OpenGl_Display_Header
-#define _OpenGl_Display_Header
-
-#include <Handle_OpenGl_Display.hxx>
-#include <MMgt_TShared.hxx>
-
-#include <Aspect_Display.hxx>
-#include <Aspect_DisplayConnection.hxx>
-#include <Aspect_TypeOfLine.hxx>
-#include <Aspect_TypeOfMarker.hxx>
-
-#include <Font_FontAspect.hxx>
-
-#include <InterfaceGraphic_telem.hxx>
-
-#include <Handle_OpenGl_Window.hxx>
-
-struct OpenGl_Facilities
-{
-  int AntiAliasing;
-  int DepthCueing;
-  int DoubleBuffer;
-  int ZBuffer;
-  int MaxLights;
-  int MaxViews;
-};
-
-class OpenGl_Context;
-
-class OpenGl_Display : public MMgt_TShared
-{
-public:
-
-  OpenGl_Display (const Handle(Aspect_DisplayConnection)& theDisplayConnection);
-  virtual ~OpenGl_Display ();
-
-  Aspect_Display GetDisplay () const { return myDisplay; }
-
-  const OpenGl_Facilities & Facilities () const { return myFacilities; }
-
-  Standard_Boolean DBuffer () const { return myDBuffer; }
-  Standard_Boolean Dither () const { return myDither; }
-  Standard_Boolean BackDither () const { return myBackDither; }
-  Standard_Boolean SymPerspective() const { return mySymPerspective; }
-  Standard_Boolean PolygonOffset (Standard_ShortReal &AFactor, Standard_ShortReal &AUnits) const
-  {
-    AFactor = myOffsetFactor;
-    AUnits = myOffsetUnits;
-    return Standard_True;
-  }
-  Standard_Integer AntiAliasingMode () const { return myAntiAliasingMode; }
-
-  // System attributes
-
-  void InitAttributes();
-  void ReleaseAttributes (const OpenGl_Context* theGlCtx);
-
-  void SetTypeOfLine (const Aspect_TypeOfLine AType) const;
-
-  void SetTypeOfHatch (const int AType) const;
-
-  friend class OpenGl_Window;
-
-  // Type definition
-  //
-  DEFINE_STANDARD_RTTI(OpenGl_Display)
-
- protected:
-
-  void Init ();
-
-  Aspect_Display   myDisplay;
-  OpenGl_Facilities myFacilities;
-
-  Standard_Boolean myDBuffer;
-  Standard_Boolean myDither;
-  Standard_Boolean myBackDither;
-  Standard_Boolean mySymPerspective;
-  Standard_ShortReal myOffsetFactor;
-  Standard_ShortReal myOffsetUnits;
-  Standard_Integer myAntiAliasingMode;
-
-  unsigned int myLinestyleBase;
-  unsigned int myPatternBase;
-
- public:
-  DEFINE_STANDARD_ALLOC
-};
-
-#endif // _OpenGl_Display_Header
diff --git a/src/OpenGl/OpenGl_Display_2.cxx b/src/OpenGl/OpenGl_Display_2.cxx
deleted file mode 100644 (file)
index c820fc8..0000000
+++ /dev/null
@@ -1,571 +0,0 @@
-// Created on: 2011-10-25
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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 <OpenGl_GlCore11.hxx>
-
-#include <OpenGl_Display.hxx>
-
-#ifdef HAVE_CONFIG_H
-  #include <config.h>
-#endif
-
-#ifdef HAVE_GL2PS
-  #include <gl2ps.h>
-#endif
-
-#define  DOT_LS            0xCCCC
-#define  DASH_DOT_LS       0xFF18
-#define  DASH_LS           0xFFC0
-#define  DASH_DDOT_LS      0xFF24
-
-static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] =
-{
-  //TEL_HS_SOLID
-  {
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF,
-    0xFFFFFFFF
-  },
-  //TEL_HS_CROSS
-  {
-    0xFFFFFFFF,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB,
-    0xEEEEEEEE,
-    0xBBBBBBBB
-  },
-  //TEL_HS_CROSS_SPARSE
-  {
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242,
-    0x81818181,
-    0x24242424,
-    0x18181818,
-    0x42424242
-  },
-  //TEL_HS_GRID
-  {
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888,
-    0xFFFFFFFF,
-    0x88888888
-  },
-  //TEL_HS_GRID_SPARSE
-  {
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080,
-    0xFFFFFFFF,
-    0x80808080,
-    0x80808080,
-    0x80808080
-  },
-  //TEL_HS_DIAG_45
-  {
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222,
-    0x88888888,
-    0x22222222
-  },
-  //TEL_HS_DIAG_135
-  {
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444,
-    0x11111111,
-    0x44444444
-  },
-  //TEL_HS_HORIZONTAL
-  {
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000
-  },
-  //TEL_HS_VERTICAL
-  {
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111,
-    0x11111111
-  },
-  //TEL_HS_DIAG_45_SPARSE
-  {
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202,
-    0x80808080,
-    0x20202020,
-    0x08080808,
-    0x02020202
-  },
-  //TEL_HS_DIAG_135_SPARSE
-  {
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040,
-    0x01010101,
-    0x04040404,
-    0x10101010,
-    0x40404040
-  },
-  //TEL_HS_HORIZONTAL_SPARSE
-  {
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000,
-    0xFFFFFFFF,
-    0x00000000,
-    0x00000000,
-    0x00000000
-  },
-  //TEL_HS_VERTICAL_SPARSE
-  {
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010,
-    0x10101010
-  }
-};
-
-/*----------------------------------------------------------------------*/
-
-//TsmInitAttributes
-void OpenGl_Display::InitAttributes ()
-{
-  // Return if already initialized
-  if (myLinestyleBase) return;
-
-  myLinestyleBase = glGenLists(5);
-
-  /* Line */
-
-  glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DASH, GL_COMPILE );
-  glLineStipple(1,  DASH_LS );
-  glEndList();
-
-  glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOT, GL_COMPILE );
-  glLineStipple(1,  DOT_LS );
-  glEndList();
-
-  glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOTDASH, GL_COMPILE );
-  glLineStipple(1,  DASH_DOT_LS );
-  glEndList();
-
-  glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_USERDEFINED, GL_COMPILE );
-  glLineStipple(1,  DASH_DDOT_LS );
-  glEndList();
-
-  /* FSXXX
-  * GL_POLYGON_STIPPLE
-  * need 32x32 stipple patterns
-  */
-  const int nbi = sizeof(myInteriors)/(32*sizeof(unsigned int));
-  myPatternBase = glGenLists(TEL_HS_USER_DEF_START);
-  int i;
-  for( i = 1; i < TEL_HS_USER_DEF_START; i++ )
-  {
-    glNewList( (GLuint)myPatternBase + i, GL_COMPILE );
-       glPolygonStipple((const GLubyte *) (myInteriors[i<nbi? i : 0]));
-    glEndList();
-  }
-
-  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-}
-
-/*----------------------------------------------------------------------*/
-
-void OpenGl_Display::SetTypeOfLine (const Aspect_TypeOfLine AType) const
-{
-  if (AType != Aspect_TOL_SOLID)
-  {
-    glCallList((GLuint)myLinestyleBase+(GLuint)AType);
-    glEnable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
-    gl2psEnable( GL2PS_LINE_STIPPLE );
-#endif
-  }
-  else
-  {
-    glDisable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
-    gl2psDisable( GL2PS_LINE_STIPPLE );
-#endif
-  }
-}
-
-/*----------------------------------------------------------------------*/
-
-void OpenGl_Display::SetTypeOfHatch (const int AType) const
-{
-  if (AType)
-  {
-    glCallList((GLuint)myPatternBase+(GLuint)AType);
-    glEnable( GL_POLYGON_STIPPLE );
-  }
-  else
-    glDisable( GL_POLYGON_STIPPLE );
-}
-
-/*----------------------------------------------------------------------*/
index 879e61f..6990656 100755 (executable)
 #include <OpenGl_Trihedron.hxx>
 #include <OpenGl_Workspace.hxx>
 
 #include <OpenGl_Trihedron.hxx>
 #include <OpenGl_Workspace.hxx>
 
+#include <OSD_Environment.hxx>
 #include <Standard_NotImplemented.hxx>
 
 #include <Standard_NotImplemented.hxx>
 
+#if (!defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
+  #include <X11/Xlib.h> // XOpenDisplay()
+#endif
+
 IMPLEMENT_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
 
 IMPLEMENT_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
 
@@ -91,6 +96,80 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString theShrName)
   //
 }
 
   //
 }
 
+// =======================================================================
+// function : Begin
+// purpose  :
+// =======================================================================
+Standard_Boolean OpenGl_GraphicDriver::Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
+{
+  myDisplayConnection = theDisplayConnection;
+  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
+  }
+
+#if (!defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)))
+  Display* aDisplay = myDisplayConnection->GetDisplay();
+  Bool toSync = ::getenv ("CSF_GraphicSync") != NULL
+             || ::getenv ("CALL_SYNCHRO_X")  != NULL;
+  XSynchronize (aDisplay, toSync);
+
+  // does the server know about OpenGL & GLX?
+  int aDummy;
+  if (!XQueryExtension (aDisplay, "GLX", &aDummy, &aDummy, &aDummy))
+  {
+  #ifdef DEBUG
+    std::cerr << "This system doesn't appear to support OpenGL\n";
+  #endif
+  }
+#endif
+  return Standard_True;
+}
+
+// =======================================================================
+// function : End
+// purpose  :
+// =======================================================================
+void OpenGl_GraphicDriver::End()
+{
+  // deprecated method
+  ///myDisplayConnection.Nullify();
+}
+
+// =======================================================================
+// function : InquireLightLimit
+// purpose  :
+// =======================================================================
+Standard_Integer OpenGl_GraphicDriver::InquireLightLimit()
+{
+  return OpenGLMaxLights;
+}
+
+// =======================================================================
+// function : InquireViewLimit
+// purpose  :
+// =======================================================================
+Standard_Integer OpenGl_GraphicDriver::InquireViewLimit()
+{
+  return 10000;
+}
+
+// =======================================================================
+// function : InquirePlaneLimit
+// purpose  :
+// =======================================================================
+Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit()
+{
+  // NOTE the 2 first planes are reserved for ZClipping
+  const Handle(OpenGl_Context)& aCtx = GetSharedContext();
+  return aCtx.IsNull() ? 0 : Max (aCtx->MaxClipPlanes() - 2, 0);
+}
+
 // =======================================================================
 // function : UserDrawCallback
 // purpose  :
 // =======================================================================
 // function : UserDrawCallback
 // purpose  :
index e8e012f..a82d358 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <Graphic3d_GraphicDriver.hxx>
 #include <Handle_OpenGl_GraphicDriver.hxx>
 
 #include <Graphic3d_GraphicDriver.hxx>
 #include <Handle_OpenGl_GraphicDriver.hxx>
-#include <Handle_OpenGl_Display.hxx>
 #include <OpenGl_Context.hxx>
 #include <OpenGl_PrinterContext.hxx>
 
 #include <OpenGl_Context.hxx>
 #include <OpenGl_PrinterContext.hxx>
 
@@ -322,7 +321,6 @@ public:
 
 private:
 
 
 private:
 
-  Handle(OpenGl_Display)                                          myGlDisplay;
   Handle(OpenGl_Caps)                                             myCaps;
   NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>      myMapOfView;
   NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)> myMapOfWS;
   Handle(OpenGl_Caps)                                             myCaps;
   NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>      myMapOfView;
   NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)> myMapOfWS;
diff --git a/src/OpenGl/OpenGl_GraphicDriver_1.cxx b/src/OpenGl/OpenGl_GraphicDriver_1.cxx
deleted file mode 100644 (file)
index 49f823d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// Created on: 2011-10-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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 <OpenGl_GraphicDriver.hxx>
-
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-
-#include <OpenGl_CView.hxx>
-#include <OpenGl_Display.hxx>
-
-//=======================================================================
-//function : Begin
-//purpose  :
-//=======================================================================
-
-Standard_Boolean OpenGl_GraphicDriver::Begin (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
-{
-  myDisplayConnection = theDisplayConnection;
-  try
-  {
-    myGlDisplay = new OpenGl_Display (myDisplayConnection);
-    return Standard_True;
-  }
-  catch (Standard_Failure)
-  {
-  }
-  return Standard_False;
-}
-
-//=======================================================================
-//function : End
-//purpose  : 
-//=======================================================================
-
-void OpenGl_GraphicDriver::End ()
-{
-  // This is unsafe to realease global object here
-  // because noone guaranteed that only one instance of OpenGl_GraphicDriver is used!
-  // So we disable this destructor here until openglDisplay not moved to  OpenGl_GraphicDriver class definition.
-  ///openglDisplay.Nullify();
-}
diff --git a/src/OpenGl/OpenGl_GraphicDriver_2.cxx b/src/OpenGl/OpenGl_GraphicDriver_2.cxx
deleted file mode 100644 (file)
index cac6e68..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Created on: 2011-10-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-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 <OpenGl_GlCore11.hxx>
-
-#include <OpenGl_GraphicDriver.hxx>
-
-#include <OpenGl_Display.hxx>
-#include <OpenGl_CView.hxx>
-
-Standard_Integer OpenGl_GraphicDriver::InquireLightLimit ()
-{
-  return (myGlDisplay.IsNull() ? 0 : myGlDisplay->Facilities().MaxLights);
-}
-
-Standard_Integer OpenGl_GraphicDriver::InquireViewLimit ()
-{
-  return (myGlDisplay.IsNull() ? 0 : myGlDisplay->Facilities().MaxViews);
-}
-
-Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit ()
-{
-  GLint aMaxPlanes = 0;
-  if (GET_GL_CONTEXT())
-  {
-    glGetIntegerv (GL_MAX_CLIP_PLANES, &aMaxPlanes);
-    aMaxPlanes -= 2; // NOTE the 2 first planes are reserved for ZClipping
-    if (aMaxPlanes < 0)
-      aMaxPlanes = 0;
-  }
-  return aMaxPlanes;
-}
-
index 654f9ee..a7087e3 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <OpenGl_Structure.hxx>
 #include <OpenGl_CView.hxx>
 
 #include <OpenGl_Structure.hxx>
 #include <OpenGl_CView.hxx>
-#include <OpenGl_Display.hxx>
 #include <OpenGl_Text.hxx>
 
 /*----------------------------------------------------------------------*/
 #include <OpenGl_Text.hxx>
 
 /*----------------------------------------------------------------------*/
@@ -402,7 +401,6 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
       aStruct->ReleaseGlResources (aCtx);
     }
     myTempText->Release (aCtx);
       aStruct->ReleaseGlResources (aCtx);
     }
     myTempText->Release (aCtx);
-    myGlDisplay->ReleaseAttributes (aCtx.operator->());
     myDeviceLostFlag = !myMapOfStructure.IsEmpty();
   }
 
     myDeviceLostFlag = !myMapOfStructure.IsEmpty();
   }
 
@@ -463,15 +461,14 @@ void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const St
 
 Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
 {
 
 Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
 {
-  if (myGlDisplay.IsNull()
-   || myMapOfView.IsBound (theCView.ViewId)
+  if (myMapOfView.IsBound (theCView.ViewId)
    || myMapOfWS  .IsBound (theCView.WsId))
   {
     return Standard_False;
   }
 
   Handle(OpenGl_Context)   aShareCtx = GetSharedContext();
    || myMapOfWS  .IsBound (theCView.WsId))
   {
     return Standard_False;
   }
 
   Handle(OpenGl_Context)   aShareCtx = GetSharedContext();
-  Handle(OpenGl_Workspace) aWS       = new OpenGl_Workspace (myGlDisplay, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
+  Handle(OpenGl_Workspace) aWS       = new OpenGl_Workspace (myDisplayConnection, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
   Handle(OpenGl_View)      aView     = new OpenGl_View (theCView.Context, &myStateCounter);
   myMapOfWS  .Bind (theCView.WsId,   aWS);
   myMapOfView.Bind (theCView.ViewId, aView);
   Handle(OpenGl_View)      aView     = new OpenGl_View (theCView.Context, &myStateCounter);
   myMapOfWS  .Bind (theCView.WsId,   aWS);
   myMapOfView.Bind (theCView.ViewId, aView);
index 4d5eb69..999b877 100644 (file)
 
 #include <Font_FontAspect.hxx>
 
 
 #include <Font_FontAspect.hxx>
 
-#include <OpenGl_Display.hxx>
 #include <OpenGl_AspectText.hxx>
 #include <OpenGl_Text.hxx>
 #include <OpenGl_TextParam.hxx>
 #include <OpenGl_AspectText.hxx>
 #include <OpenGl_Text.hxx>
 #include <OpenGl_TextParam.hxx>
+#include <OpenGl_LineAttributes.hxx>
 
 /*----------------------------------------------------------------------*/
 
 
 /*----------------------------------------------------------------------*/
 
@@ -223,19 +223,29 @@ void OpenGl_GraphicDriver::UnsetTransparency ()
   glDisable (GL_BLEND);
 }
 
   glDisable (GL_BLEND);
 }
 
-void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width)
+void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer   theType,
+                                              const Standard_ShortReal theWidth)
 {
 {
-  if (!TheLayerProp.ListId || myGlDisplay.IsNull()) return;
+  const Handle(OpenGl_Context)& aCtx = GetSharedContext();
+  if (!TheLayerProp.ListId
+   || aCtx.IsNull())
+  {
+    return;
+  }
 
 
-  if (TheLayerProp.LineType != Type)
+  if (TheLayerProp.LineType != theType)
   {
   {
-    TheLayerProp.LineType = Type;
-    myGlDisplay->SetTypeOfLine((Aspect_TypeOfLine) Type);
+    Handle(OpenGl_LineAttributes) aLineAttribs;
+    if (aCtx->GetResource ("OpenGl_LineAttributes", aLineAttribs))
+    {
+      TheLayerProp.LineType = theType;
+      aLineAttribs->SetTypeOfLine ((Aspect_TypeOfLine )theType);
+    }
   }
   }
-  if (TheLayerProp.LineWidth != Width)
+  if (TheLayerProp.LineWidth != theWidth)
   {
   {
-    TheLayerProp.LineWidth = Width;
-    glLineWidth ((GLfloatWidth);
+    TheLayerProp.LineWidth = theWidth;
+    glLineWidth ((GLfloat )theWidth);
   }
 }
 
   }
 }
 
diff --git a/src/OpenGl/OpenGl_LineAttributes.cxx b/src/OpenGl/OpenGl_LineAttributes.cxx
new file mode 100644 (file)
index 0000000..58a745e
--- /dev/null
@@ -0,0 +1,620 @@
+// Created on: 2011-10-25
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2011-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 <OpenGl_GlCore11.hxx>
+
+#include <OpenGl_LineAttributes.hxx>
+#include <OpenGl_Context.hxx>
+
+#ifdef HAVE_CONFIG_H
+  #include <config.h>
+#endif
+
+#ifdef HAVE_GL2PS
+  #include <gl2ps.h>
+#endif
+
+#define DOT_LS       0xCCCC
+#define DASH_DOT_LS  0xFF18
+#define DASH_LS      0xFFC0
+#define DASH_DDOT_LS 0xFF24
+
+static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] =
+{
+  //TEL_HS_SOLID
+  {
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF,
+    0xFFFFFFFF
+  },
+  //TEL_HS_CROSS
+  {
+    0xFFFFFFFF,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB,
+    0xEEEEEEEE,
+    0xBBBBBBBB
+  },
+  //TEL_HS_CROSS_SPARSE
+  {
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242,
+    0x81818181,
+    0x24242424,
+    0x18181818,
+    0x42424242
+  },
+  //TEL_HS_GRID
+  {
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888,
+    0xFFFFFFFF,
+    0x88888888
+  },
+  //TEL_HS_GRID_SPARSE
+  {
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080,
+    0xFFFFFFFF,
+    0x80808080,
+    0x80808080,
+    0x80808080
+  },
+  //TEL_HS_DIAG_45
+  {
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222,
+    0x88888888,
+    0x22222222
+  },
+  //TEL_HS_DIAG_135
+  {
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444,
+    0x11111111,
+    0x44444444
+  },
+  //TEL_HS_HORIZONTAL
+  {
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000
+  },
+  //TEL_HS_VERTICAL
+  {
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111,
+    0x11111111
+  },
+  //TEL_HS_DIAG_45_SPARSE
+  {
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202,
+    0x80808080,
+    0x20202020,
+    0x08080808,
+    0x02020202
+  },
+  //TEL_HS_DIAG_135_SPARSE
+  {
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040,
+    0x01010101,
+    0x04040404,
+    0x10101010,
+    0x40404040
+  },
+  //TEL_HS_HORIZONTAL_SPARSE
+  {
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000,
+    0xFFFFFFFF,
+    0x00000000,
+    0x00000000,
+    0x00000000
+  },
+  //TEL_HS_VERTICAL_SPARSE
+  {
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010,
+    0x10101010
+  }
+};
+
+IMPLEMENT_STANDARD_HANDLE (OpenGl_LineAttributes, OpenGl_Resource)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_LineAttributes, OpenGl_Resource)
+
+// =======================================================================
+// function : OpenGl_LineAttributes
+// purpose  :
+// =======================================================================
+OpenGl_LineAttributes::OpenGl_LineAttributes()
+: myLinestyleBase(0),
+  myPatternBase(0)
+{
+  //
+}
+
+// =======================================================================
+// function : ~OpenGl_LineAttributes
+// purpose  :
+// =======================================================================
+OpenGl_LineAttributes::~OpenGl_LineAttributes()
+{
+  Release (NULL);
+}
+
+// =======================================================================
+// function : Release
+// purpose  :
+// =======================================================================
+void OpenGl_LineAttributes::Release (const OpenGl_Context* theGlCtx)
+{
+  // Delete line styles
+  if (myLinestyleBase != 0)
+  {
+    if (theGlCtx->IsValid())
+    {
+      glDeleteLists ((GLuint )myLinestyleBase, 5);
+    }
+    myLinestyleBase = 0;
+  }
+  // Delete surface patterns
+  if (myPatternBase != 0)
+  {
+    if (theGlCtx->IsValid())
+    {
+      glDeleteLists ((GLuint )myPatternBase, TEL_HS_USER_DEF_START);
+    }
+    myPatternBase = 0;
+  }
+}
+
+// =======================================================================
+// function : Init
+// purpose  :
+// =======================================================================
+void OpenGl_LineAttributes::Init (const Handle(OpenGl_Context)& theGlCtx)
+{
+  // Return if already initialized
+  if (myLinestyleBase != 0)
+  {
+    return;
+  }
+
+  myLinestyleBase = theGlCtx->core11->glGenLists (5);
+
+  // Line
+  glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DASH, GL_COMPILE);
+  glLineStipple (1,  DASH_LS);
+  glEndList();
+
+  glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DOT, GL_COMPILE);
+  glLineStipple (1,  DOT_LS);
+  glEndList();
+
+  glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_DOTDASH, GL_COMPILE);
+  glLineStipple (1,  DASH_DOT_LS);
+  glEndList();
+
+  glNewList ((GLuint )myLinestyleBase + (GLuint )Aspect_TOL_USERDEFINED, GL_COMPILE);
+  glLineStipple (1,  DASH_DDOT_LS);
+  glEndList();
+
+  // GL_POLYGON_STIPPLE need 32x32 stipple patterns
+  const int nbi = sizeof(myInteriors) / (32 * sizeof(unsigned int));
+  myPatternBase = glGenLists(TEL_HS_USER_DEF_START);
+  for (int i = 1; i < TEL_HS_USER_DEF_START; i++)
+  {
+    glNewList ((GLuint )myPatternBase + i, GL_COMPILE);
+    glPolygonStipple ((const GLubyte* )myInteriors[i < nbi ? i : 0]);
+    glEndList();
+  }
+}
+
+// =======================================================================
+// function : SetTypeOfLine
+// purpose  :
+// =======================================================================
+void OpenGl_LineAttributes::SetTypeOfLine (const Aspect_TypeOfLine theType) const
+{
+  if (theType != Aspect_TOL_SOLID)
+  {
+    glCallList ((GLuint )myLinestyleBase + (GLuint )theType);
+    glEnable (GL_LINE_STIPPLE);
+  #ifdef HAVE_GL2PS
+    gl2psEnable (GL2PS_LINE_STIPPLE);
+  #endif
+  }
+  else
+  {
+    glDisable (GL_LINE_STIPPLE);
+  #ifdef HAVE_GL2PS
+    gl2psDisable (GL2PS_LINE_STIPPLE);
+  #endif
+  }
+}
+
+// =======================================================================
+// function : SetTypeOfHatch
+// purpose  :
+// =======================================================================
+void OpenGl_LineAttributes::SetTypeOfHatch (const int theType) const
+{
+  if (theType != 0)
+  {
+    glCallList ((GLuint )myPatternBase + (GLuint )theType);
+    glEnable (GL_POLYGON_STIPPLE);
+  }
+  else
+    glDisable (GL_POLYGON_STIPPLE);
+}
diff --git a/src/OpenGl/OpenGl_LineAttributes.hxx b/src/OpenGl/OpenGl_LineAttributes.hxx
new file mode 100644 (file)
index 0000000..06782f6
--- /dev/null
@@ -0,0 +1,55 @@
+// Created on: 2011-09-20
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2011-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.
+
+#ifndef _OpenGl_LineAttributes_Header
+#define _OpenGl_LineAttributes_Header
+
+#include <OpenGl_Resource.hxx>
+
+#include <Aspect_TypeOfLine.hxx>
+#include <Aspect_TypeOfMarker.hxx>
+#include <Font_FontAspect.hxx>
+
+class OpenGl_Context;
+class Handle(OpenGl_Context);
+
+class OpenGl_LineAttributes : public OpenGl_Resource
+{
+public:
+
+  OpenGl_LineAttributes();
+  virtual ~OpenGl_LineAttributes();
+
+  void Init (const Handle(OpenGl_Context)& theGlCtx);
+  virtual void Release (const OpenGl_Context* theGlCtx);
+
+  void SetTypeOfLine (const Aspect_TypeOfLine theType) const;
+
+  void SetTypeOfHatch (const int theType) const;
+
+protected:
+
+  unsigned int myLinestyleBase;
+  unsigned int myPatternBase;
+
+public:
+
+  DEFINE_STANDARD_RTTI(OpenGl_LineAttributes)
+
+};
+
+DEFINE_STANDARD_HANDLE(OpenGl_LineAttributes, OpenGl_Resource)
+
+#endif // _OpenGl_LineAttributes_Header
index d3c006b..100c034 100644 (file)
@@ -16,7 +16,6 @@
 #include <NCollection_Mat4.hxx>
 
 #include <OpenGl_Context.hxx>
 #include <NCollection_Mat4.hxx>
 
 #include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
 #include <OpenGl_GlCore11.hxx>
 #include <OpenGl_GraduatedTrihedron.hxx>
 #include <OpenGl_GraphicDriver.hxx>
 #include <OpenGl_GlCore11.hxx>
 #include <OpenGl_GraduatedTrihedron.hxx>
 #include <OpenGl_GraphicDriver.hxx>
index 6eeaee4..b1cbe18 100644 (file)
 
 #include <OpenGl_LayerList.hxx>
 #include <OpenGl_Light.hxx>
 
 #include <OpenGl_LayerList.hxx>
 #include <OpenGl_Light.hxx>
+#include <OpenGl_LineAttributes.hxx>
 
 #include <Handle_OpenGl_Context.hxx>
 #include <Handle_OpenGl_GraphicDriver.hxx>
 
 #include <Handle_OpenGl_Context.hxx>
 #include <Handle_OpenGl_GraphicDriver.hxx>
-#include <Handle_OpenGl_Display.hxx>
 #include <Handle_OpenGl_Workspace.hxx>
 #include <Handle_OpenGl_View.hxx>
 #include <Handle_OpenGl_Texture.hxx>
 #include <Handle_OpenGl_Workspace.hxx>
 #include <Handle_OpenGl_View.hxx>
 #include <Handle_OpenGl_Texture.hxx>
@@ -223,12 +223,13 @@ protected:
                     const OpenGl_Matrix* theProjection,
                     const OpenGl_Matrix* theOrientation);
 
                     const OpenGl_Matrix* theProjection,
                     const OpenGl_Matrix* theOrientation);
 
-  Handle(OpenGl_Texture) myTextureEnv;
-  Visual3d_TypeOfSurfaceDetail mySurfaceDetail; //WSSurfaceDetail
-  Standard_Integer myBackfacing; //WSBackfacing
+  Handle(OpenGl_LineAttributes) myLineAttribs;
+  Handle(OpenGl_Texture)        myTextureEnv;
+  Visual3d_TypeOfSurfaceDetail  mySurfaceDetail;
+  Standard_Integer              myBackfacing;
 
 
-  OPENGL_BG_TEXTURE myBgTexture; //WSBgTexture
-  OPENGL_BG_GRADIENT myBgGradient; //WSBgGradient
+  OPENGL_BG_TEXTURE  myBgTexture;
+  OPENGL_BG_GRADIENT myBgGradient;
 
   OPENGL_ZCLIP   myZClip;
 
 
   OPENGL_ZCLIP   myZClip;
 
index a7f2962..99b2266 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <OpenGl_AspectLine.hxx>
 #include <OpenGl_Context.hxx>
 
 #include <OpenGl_AspectLine.hxx>
 #include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
 #include <OpenGl_Matrix.hxx>
 #include <OpenGl_Workspace.hxx>
 #include <OpenGl_View.hxx>
 #include <OpenGl_Matrix.hxx>
 #include <OpenGl_Workspace.hxx>
 #include <OpenGl_View.hxx>
@@ -341,13 +340,9 @@ void OpenGl_View::DrawBackground (OpenGl_Workspace& theWorkspace)
     glPopAttrib(); //GL_ENABLE_BIT | GL_TEXTURE_BIT
 
     if (theWorkspace.UseZBuffer())
     glPopAttrib(); //GL_ENABLE_BIT | GL_TEXTURE_BIT
 
     if (theWorkspace.UseZBuffer())
+    {
       glEnable (GL_DEPTH_TEST);
       glEnable (GL_DEPTH_TEST);
-
-    /* GL_DITHER on/off pour le trace */
-    if (theWorkspace.Dither())
-      glEnable (GL_DITHER);
-    else
-      glDisable (GL_DITHER);
+    }
   }
 }
 
   }
 }
 
@@ -662,7 +657,7 @@ void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace)
 
   if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
   {
 
   if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
   {
-    const int antiAliasingMode = AWorkspace->GetDisplay()->AntiAliasingMode();
+    const int antiAliasingMode = AWorkspace->AntiAliasingMode();
 
     if ( !myAntiAliasing )
     {
 
     if ( !myAntiAliasing )
     {
index ba96435..04013ef 100644 (file)
@@ -20,7 +20,6 @@
 #include <OpenGl_Window.hxx>
 
 #include <OpenGl_Context.hxx>
 #include <OpenGl_Window.hxx>
 
 #include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
 
 #include <Aspect_GraphicDeviceDefinitionError.hxx>
 #include <TCollection_AsciiString.hxx>
 
 #include <Aspect_GraphicDeviceDefinitionError.hxx>
 #include <TCollection_AsciiString.hxx>
@@ -127,28 +126,23 @@ namespace
 // function : OpenGl_Window
 // purpose  :
 // =======================================================================
 // function : OpenGl_Window
 // purpose  :
 // =======================================================================
-OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
+OpenGl_Window::OpenGl_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection,
                               const CALL_DEF_WINDOW&        theCWindow,
                               Aspect_RenderingContext       theGContext,
                               const Handle(OpenGl_Caps)&    theCaps,
                               const Handle(OpenGl_Context)& theShareCtx)
                               const CALL_DEF_WINDOW&        theCWindow,
                               Aspect_RenderingContext       theGContext,
                               const Handle(OpenGl_Caps)&    theCaps,
                               const Handle(OpenGl_Context)& theShareCtx)
-: myDisplay (theDisplay),
-  myGlContext (new OpenGl_Context (theCaps)),
+: myGlContext (new OpenGl_Context (theCaps)),
   myOwnGContext (theGContext == 0),
   myOwnGContext (theGContext == 0),
-#if defined(_WIN32)
-  mySysPalInUse (FALSE),
-#endif
   myWidth ((Standard_Integer )theCWindow.dx),
   myHeight ((Standard_Integer )theCWindow.dy),
   myWidth ((Standard_Integer )theCWindow.dx),
   myHeight ((Standard_Integer )theCWindow.dy),
-  myBgColor (THE_DEFAULT_BG_COLOR),
-  myDither (theDisplay->Dither()),
-  myBackDither (theDisplay->BackDither())
+  myBgColor (THE_DEFAULT_BG_COLOR)
 {
   myBgColor.rgb[0] = theCWindow.Background.r;
   myBgColor.rgb[1] = theCWindow.Background.g;
   myBgColor.rgb[2] = theCWindow.Background.b;
 
 #if defined(_WIN32)
 {
   myBgColor.rgb[0] = theCWindow.Background.r;
   myBgColor.rgb[1] = theCWindow.Background.g;
   myBgColor.rgb[2] = theCWindow.Background.b;
 
 #if defined(_WIN32)
+  (void )theDisplayConnection;
   HWND  aWindow   = (HWND )theCWindow.XWindow;
   HDC   aWindowDC = GetDC (aWindow);
   HGLRC aGContext = (HGLRC )theGContext;
   HWND  aWindow   = (HWND )theCWindow.XWindow;
   HDC   aWindowDC = GetDC (aWindow);
   HGLRC aGContext = (HGLRC )theGContext;
@@ -195,23 +189,6 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
   }
 
   DescribePixelFormat (aWindowDC, aPixelFrmtId, sizeof(aPixelFrmt), &aPixelFrmt);
   }
 
   DescribePixelFormat (aWindowDC, aPixelFrmtId, sizeof(aPixelFrmt), &aPixelFrmt);
-  if (aPixelFrmt.dwFlags & PFD_NEED_PALETTE)
-  {
-    WINDOW_DATA* aWndData = (WINDOW_DATA* )GetWindowLongPtr (aWindow, GWLP_USERDATA);
-
-    mySysPalInUse = (aPixelFrmt.dwFlags & PFD_NEED_SYSTEM_PALETTE) ? TRUE : FALSE;
-    InterfaceGraphic_RealizePalette (aWindowDC, aWndData->hPal, FALSE, mySysPalInUse);
-  }
-
-  if (myDither)
-  {
-    myDither = (aPixelFrmt.cColorBits <= 8);
-  }
-
-  if (myBackDither)
-  {
-    myBackDither = (aPixelFrmt.cColorBits <= 8);
-  }
 
   HGLRC aSlaveCtx = !theShareCtx.IsNull() ? (HGLRC )theShareCtx->myGContext : NULL;
   if (aGContext == NULL)
 
   HGLRC aSlaveCtx = !theShareCtx.IsNull() ? (HGLRC )theShareCtx->myGContext : NULL;
   if (aGContext == NULL)
@@ -378,7 +355,8 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
 #else
   WINDOW aParent = (WINDOW )theCWindow.XWindow;
   WINDOW aWindow = 0;
 #else
   WINDOW aParent = (WINDOW )theCWindow.XWindow;
   WINDOW aWindow = 0;
-  DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+  
+  Display*   aDisp     = theDisplayConnection->GetDisplay();
   GLXContext aGContext = (GLXContext )theGContext;
 
   XWindowAttributes wattr;
   GLXContext aGContext = (GLXContext )theGContext;
 
   XWindowAttributes wattr;
@@ -433,7 +411,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
         aStencilSize = 0;
 
       if (!isGl || !aDepthSize || !isRGBA  || !aStencilSize ||
         aStencilSize = 0;
 
       if (!isGl || !aDepthSize || !isRGBA  || !aStencilSize ||
-          (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()   ? 1 : 0) ||
+          (isDoubleBuffer ? 1 : 0) != 1 ||
           (isStereo       ? 1 : 0) != (theCaps->contextStereo ? 1 : 0))
       {
         XFree (aVis);
           (isStereo       ? 1 : 0) != (theCaps->contextStereo ? 1 : 0))
       {
         XFree (aVis);
@@ -463,8 +441,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
       anAttribs[anIter++] = GLX_BLUE_SIZE;
       anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
 
       anAttribs[anIter++] = GLX_BLUE_SIZE;
       anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
 
-      if (myDisplay->DBuffer())
-        anAttribs[anIter++] = GLX_DOUBLEBUFFER;
+      anAttribs[anIter++] = GLX_DOUBLEBUFFER;
 
       // warning: this flag may be set to None, so it need to be last in anAttribs
       Standard_Integer aStereoFlagPos = anIter;
 
       // warning: this flag may be set to None, so it need to be last in anAttribs
       Standard_Integer aStereoFlagPos = anIter;
@@ -548,31 +525,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
     }
   }
 
     }
   }
 
-  /*
-  * Le BackDitherProp est utilise pour le clear du background
-  * Pour eviter une difference de couleurs avec la couleur choisie
-  * par l'application (XWindow) il faut desactiver le dithering
-  * au dessus de 8 plans.
-  *
-  * Pour le DitherProp:
-  * On cherchera a activer le Dithering que si le Visual a au moins
-  * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut
-  * avoir une profondeur superieure a 12 mais avoir besoin du dithering.
-  * (Carte Impact avec GLX_RED_SIZE a 5 par exemple)
-  */
-
-  int aValue;
-  glXGetConfig (aDisp, aVis, GLX_RED_SIZE, &aValue);
-
-  if (myDither)
-    myDither = (aValue < 8);
-
-  if (myBackDither)
-    myBackDither = (aVis->depth <= 8);
-
-  XFree ((char* )aVis);
-
-  myGlContext->Init ((Aspect_Drawable )aWindow, (Aspect_Display )myDisplay->GetDisplay(), (Aspect_RenderingContext )aGContext);
+  myGlContext->Init ((Aspect_Drawable )aWindow, (Aspect_Display )aDisp, (Aspect_RenderingContext )aGContext);
 #endif
   myGlContext->Share (theShareCtx);
 
 #endif
   myGlContext->Share (theShareCtx);
 
@@ -650,9 +603,11 @@ Standard_Boolean OpenGl_Window::Activate()
 // =======================================================================
 void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
 {
 // =======================================================================
 void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
 {
-  DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+#if !defined(_WIN32)
+  Display* aDisp = (Display* )myGlContext->myDisplay;
   if (aDisp == NULL)
     return;
   if (aDisp == NULL)
     return;
+#endif
 
   // If the size is not changed - do nothing
   if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
 
   // If the size is not changed - do nothing
   if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
@@ -729,7 +684,7 @@ void OpenGl_Window::Init()
   unsigned int aDummyU;
   unsigned int aNewWidth  = 0;
   unsigned int aNewHeight = 0;
   unsigned int aDummyU;
   unsigned int aNewWidth  = 0;
   unsigned int aNewHeight = 0;
-  DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+  Display* aDisp = (Display* )myGlContext->myDisplay;
   XGetGeometry (aDisp, myGlContext->myWindow, &aRootWin, &aDummy, &aDummy, &aNewWidth, &aNewHeight, &aDummyU, &aDummyU);
   myWidth  = aNewWidth;
   myHeight = aNewHeight;
   XGetGeometry (aDisp, myGlContext->myWindow, &aRootWin, &aDummy, &aDummy, &aNewWidth, &aNewHeight, &aDummyU, &aDummyU);
   myWidth  = aNewWidth;
   myHeight = aNewHeight;
@@ -744,39 +699,13 @@ void OpenGl_Window::Init()
 
 #endif // !__APPLE__
 
 
 #endif // !__APPLE__
 
-// =======================================================================
-// function : EnablePolygonOffset
-// purpose  : call_subr_enable_polygon_offset
-// =======================================================================
-void OpenGl_Window::EnablePolygonOffset() const
-{
-  Standard_ShortReal aFactor, aUnits;
-  myDisplay->PolygonOffset (aFactor, aUnits);
-  glPolygonOffset (aFactor, aUnits);
-  glEnable (GL_POLYGON_OFFSET_FILL);
-}
-
-// =======================================================================
-// function : DisablePolygonOffset
-// purpose  : call_subr_disable_polygon_offset
-// =======================================================================
-void OpenGl_Window::DisablePolygonOffset() const
-{
-  glDisable (GL_POLYGON_OFFSET_FILL);
-}
-
 // =======================================================================
 // function : EnableFeatures
 // purpose  :
 // =======================================================================
 void OpenGl_Window::EnableFeatures() const
 {
 // =======================================================================
 // function : EnableFeatures
 // purpose  :
 // =======================================================================
 void OpenGl_Window::EnableFeatures() const
 {
-  /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/
-
-  if (myDither)
-    glEnable (GL_DITHER);
-  else
-    glDisable (GL_DITHER);
+  //
 }
 
 // =======================================================================
 }
 
 // =======================================================================
@@ -785,7 +714,6 @@ void OpenGl_Window::EnableFeatures() const
 // =======================================================================
 void OpenGl_Window::DisableFeatures() const
 {
 // =======================================================================
 void OpenGl_Window::DisableFeatures() const
 {
-  glDisable (GL_DITHER);
   glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
 
   /*
   glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
 
   /*
@@ -865,12 +793,3 @@ void OpenGl_Window::MakeBackBufCurrent() const
 {
   glDrawBuffer (GL_BACK);
 }
 {
   glDrawBuffer (GL_BACK);
 }
-
-// =======================================================================
-// function : GetGContext
-// purpose  :
-// =======================================================================
-GLCONTEXT OpenGl_Window::GetGContext() const
-{
-  return (GLCONTEXT )myGlContext->myGContext;
-}
index 3266a1d..7aac39f 100644 (file)
@@ -21,8 +21,8 @@
 #include <OpenGl_Caps.hxx>
 
 #include <Handle_OpenGl_Context.hxx>
 #include <OpenGl_Caps.hxx>
 
 #include <Handle_OpenGl_Context.hxx>
-#include <Handle_OpenGl_Display.hxx>
 #include <Handle_OpenGl_Window.hxx>
 #include <Handle_OpenGl_Window.hxx>
+#include <Aspect_DisplayConnection.hxx>
 
 #include <MMgt_TShared.hxx>
 
 
 #include <MMgt_TShared.hxx>
 
@@ -33,7 +33,7 @@ class OpenGl_Window : public MMgt_TShared
 public:
 
   //! Main constructor - prepare GL context for specified window.
 public:
 
   //! Main constructor - prepare GL context for specified window.
-  OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
+  OpenGl_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection,
                  const CALL_DEF_WINDOW&        theCWindow,
                  Aspect_RenderingContext       theGContext,
                  const Handle(OpenGl_Caps)&    theCaps,
                  const CALL_DEF_WINDOW&        theCWindow,
                  Aspect_RenderingContext       theGContext,
                  const Handle(OpenGl_Caps)&    theCaps,
@@ -54,22 +54,12 @@ public:
                            const Standard_ShortReal theG,
                            const Standard_ShortReal theB);
 
                            const Standard_ShortReal theG,
                            const Standard_ShortReal theB);
 
-  void EnablePolygonOffset() const;
-  void DisablePolygonOffset() const;
-
   Standard_Integer Width()  const { return myWidth; }
   Standard_Integer Height() const { return myHeight; }
   const TEL_COLOUR& BackgroundColor() const { return myBgColor; }
   Standard_Integer Width()  const { return myWidth; }
   Standard_Integer Height() const { return myHeight; }
   const TEL_COLOUR& BackgroundColor() const { return myBgColor; }
-  Standard_Boolean Dither()     const { return myDither; }
-  Standard_Boolean BackDither() const { return myBackDither; }
-
-  const Handle(OpenGl_Display)& GetDisplay() const { return myDisplay; }
 
   const Handle(OpenGl_Context)& GetGlContext() const { return myGlContext; }
 
 
   const Handle(OpenGl_Context)& GetGlContext() const { return myGlContext; }
 
-  //! This method will be removed in future version!
-  GLCONTEXT GetGContext() const;
-
 protected:
 
   //! Activates GL context and setup viewport.
 protected:
 
   //! Activates GL context and setup viewport.
@@ -89,18 +79,11 @@ protected:
 
 protected:
 
 
 protected:
 
-  Handle(OpenGl_Display) myDisplay;
   Handle(OpenGl_Context) myGlContext;
   Standard_Boolean       myOwnGContext; //!< set to TRUE if GL context was not created by this class
   Handle(OpenGl_Context) myGlContext;
   Standard_Boolean       myOwnGContext; //!< set to TRUE if GL context was not created by this class
-#if (defined(_WIN32) || defined(__WIN32__))
-  BOOL                   mySysPalInUse;
-#endif
-
-  Standard_Integer       myWidth;       // WSWidth
-  Standard_Integer       myHeight;      // WSHeight
-  TEL_COLOUR             myBgColor;     // WSBackground
-  Standard_Boolean       myDither;
-  Standard_Boolean       myBackDither;
+  Standard_Integer       myWidth;       //!< window width
+  Standard_Integer       myHeight;      //!< window height
+  TEL_COLOUR             myBgColor;     //!< background color
 
 public:
 
 
 public:
 
index 297c559..5944404 100644 (file)
@@ -22,7 +22,6 @@
 #include <OpenGl_Window.hxx>
 
 #include <OpenGl_Context.hxx>
 #include <OpenGl_Window.hxx>
 
 #include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
 #include <Aspect_GraphicDeviceDefinitionError.hxx>
 #include <Cocoa_LocalPool.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <Aspect_GraphicDeviceDefinitionError.hxx>
 #include <Cocoa_LocalPool.hxx>
 #include <TCollection_AsciiString.hxx>
@@ -38,19 +37,16 @@ namespace
 // function : OpenGl_Window
 // purpose  :
 // =======================================================================
 // function : OpenGl_Window
 // purpose  :
 // =======================================================================
-OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
+OpenGl_Window::OpenGl_Window (const Handle(Aspect_DisplayConnection)& /*theDisplayConnection*/,
                               const CALL_DEF_WINDOW&        theCWindow,
                               Aspect_RenderingContext       theGContext,
                               const Handle(OpenGl_Caps)&    theCaps,
                               const Handle(OpenGl_Context)& theShareCtx)
                               const CALL_DEF_WINDOW&        theCWindow,
                               Aspect_RenderingContext       theGContext,
                               const Handle(OpenGl_Caps)&    theCaps,
                               const Handle(OpenGl_Context)& theShareCtx)
-: myDisplay (theDisplay),
-  myGlContext (new OpenGl_Context (theCaps)),
+: myGlContext (new OpenGl_Context (theCaps)),
   myOwnGContext (theGContext == 0),
   myOwnGContext (theGContext == 0),
-  myWidth ((Standard_Integer )theCWindow.dx),
+  myWidth  ((Standard_Integer )theCWindow.dx),
   myHeight ((Standard_Integer )theCWindow.dy),
   myHeight ((Standard_Integer )theCWindow.dy),
-  myBgColor (THE_DEFAULT_BG_COLOR),
-  myDither (theDisplay->Dither()),
-  myBackDither (theDisplay->BackDither())
+  myBgColor (THE_DEFAULT_BG_COLOR)
 {
   myBgColor.rgb[0] = theCWindow.Background.r;
   myBgColor.rgb[1] = theCWindow.Background.g;
 {
   myBgColor.rgb[0] = theCWindow.Background.r;
   myBgColor.rgb[1] = theCWindow.Background.g;
@@ -122,14 +118,9 @@ OpenGl_Window::~OpenGl_Window()
 // =======================================================================
 void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
 {
 // =======================================================================
 void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
 {
-  DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
-  if (aDisp == NULL)
-  {
-    return;
-  }
-
   // If the size is not changed - do nothing
   // If the size is not changed - do nothing
-  if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
+  if (myWidth  == (Standard_Integer )theCWindow.dx
+   && myHeight == (Standard_Integer )theCWindow.dy)
   {
     return;
   }
   {
     return;
   }
index 1916a7a..825ac63 100644 (file)
@@ -137,12 +137,12 @@ void OpenGl_Material::Init (const OPENGL_SURF_PROP& theProp)
 // function : OpenGl_Workspace
 // purpose  :
 // =======================================================================
 // function : OpenGl_Workspace
 // purpose  :
 // =======================================================================
-OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
+OpenGl_Workspace::OpenGl_Workspace (const Handle(Aspect_DisplayConnection)& theDisplayConnection,
                                     const CALL_DEF_WINDOW&        theCWindow,
                                     Aspect_RenderingContext       theGContext,
                                     const Handle(OpenGl_Caps)&    theCaps,
                                     const Handle(OpenGl_Context)& theShareCtx)
                                     const CALL_DEF_WINDOW&        theCWindow,
                                     Aspect_RenderingContext       theGContext,
                                     const Handle(OpenGl_Caps)&    theCaps,
                                     const Handle(OpenGl_Context)& theShareCtx)
-: OpenGl_Window (theDisplay, theCWindow, theGContext, theCaps, theShareCtx),
+: OpenGl_Window (theDisplayConnection, theCWindow, theGContext, theCaps, theShareCtx),
   NamedStatus (0),
   HighlightColor (&THE_WHITE_COLOR),
   //
   NamedStatus (0),
   HighlightColor (&THE_WHITE_COLOR),
   //
@@ -152,6 +152,7 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
   myViewModificationStatus (0),
   myLayersModificationStatus (0),
   //
   myViewModificationStatus (0),
   myLayersModificationStatus (0),
   //
+  myAntiAliasingMode     (3),
   myTransientDrawToFront (Standard_True),
   myBackBufferRestored   (Standard_False),
   myIsImmediateDrawn     (Standard_False),
   myTransientDrawToFront (Standard_True),
   myBackBufferRestored   (Standard_False),
   myIsImmediateDrawn     (Standard_False),
@@ -176,7 +177,15 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
   myModelViewMatrix (myDefaultMatrix),
   PolygonOffset_applied (NULL)
 {
   myModelViewMatrix (myDefaultMatrix),
   PolygonOffset_applied (NULL)
 {
-  theDisplay->InitAttributes();
+  myGlContext->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+
+  if (!myGlContext->GetResource ("OpenGl_LineAttributes", myLineAttribs))
+  {
+    // share and register for release once the resource is no longer used
+    myLineAttribs = new OpenGl_LineAttributes();
+    myGlContext->ShareResource ("OpenGl_LineAttributes", myLineAttribs);
+    myLineAttribs->Init (myGlContext);
+  }
 
   // General initialization of the context
 
 
   // General initialization of the context
 
@@ -190,8 +199,13 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
   glHint (GL_LINE_SMOOTH_HINT,    GL_FASTEST);
   glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
 
   glHint (GL_LINE_SMOOTH_HINT,    GL_FASTEST);
   glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
 
-  // Polygon Offset
-  EnablePolygonOffset();
+  // AA mode
+  const char* anAaEnv = ::getenv ("CALL_OPENGL_ANTIALIASING_MODE");
+  if (anAaEnv != NULL)
+  {
+    int v;
+    if (sscanf (anAaEnv, "%d", &v) > 0) myAntiAliasingMode = v;
+  }
 }
 
 // =======================================================================
 }
 
 // =======================================================================
@@ -211,6 +225,12 @@ Standard_Boolean OpenGl_Workspace::SetImmediateModeDrawToFront (const Standard_B
 // =======================================================================
 OpenGl_Workspace::~OpenGl_Workspace()
 {
 // =======================================================================
 OpenGl_Workspace::~OpenGl_Workspace()
 {
+  if (!myLineAttribs.IsNull())
+  {
+    myLineAttribs.Nullify();
+    myGlContext->ReleaseResource ("OpenGl_LineAttributes", Standard_True);
+  }
+
   ReleaseRaytraceResources();
 }
 
   ReleaseRaytraceResources();
 }
 
@@ -618,7 +638,7 @@ void OpenGl_Workspace::redraw1 (const Graphic3d_CView& theCView,
                                 const Aspect_CLayer2d& theCOverLayer,
                                 const int              theToSwap)
 {
                                 const Aspect_CLayer2d& theCOverLayer,
                                 const int              theToSwap)
 {
-  if (myDisplay.IsNull() || myView.IsNull())
+  if (myView.IsNull())
   {
     return;
   }
   {
     return;
   }
@@ -626,16 +646,6 @@ void OpenGl_Workspace::redraw1 (const Graphic3d_CView& theCView,
   // request reset of material
   NamedStatus |= OPENGL_NS_RESMAT;
 
   // request reset of material
   NamedStatus |= OPENGL_NS_RESMAT;
 
-  // GL_DITHER on/off pour le background
-  if (myBackDither)
-  {
-    glEnable (GL_DITHER);
-  }
-  else
-  {
-    glDisable (GL_DITHER);
-  }
-
   GLbitfield toClear = GL_COLOR_BUFFER_BIT;
   if (myUseZBuffer)
   {
   GLbitfield toClear = GL_COLOR_BUFFER_BIT;
   if (myUseZBuffer)
   {
index 9c32f49..4a5e0d0 100755 (executable)
@@ -41,7 +41,6 @@
 #include <NCollection_Sequence.hxx>
 
 #include <OpenGl_AspectFace.hxx>
 #include <NCollection_Sequence.hxx>
 
 #include <OpenGl_AspectFace.hxx>
-#include <OpenGl_Display.hxx>
 #include <OpenGl_FrameBuffer.hxx>
 #include <OpenGl_Matrix.hxx>
 #include <OpenGl_NamedStatus.hxx>
 #include <OpenGl_FrameBuffer.hxx>
 #include <OpenGl_Matrix.hxx>
 #include <OpenGl_NamedStatus.hxx>
@@ -50,6 +49,7 @@
 #include <OpenGl_TextParam.hxx>
 #include <OpenGl_RenderFilter.hxx>
 #include <OpenGl_Vec.hxx>
 #include <OpenGl_TextParam.hxx>
 #include <OpenGl_RenderFilter.hxx>
 #include <OpenGl_Vec.hxx>
+#include <OpenGl_LineAttributes.hxx>
 
 #include <Handle_OpenGl_View.hxx>
 #include <Handle_OpenGl_Texture.hxx>
 
 #include <Handle_OpenGl_View.hxx>
 #include <Handle_OpenGl_Texture.hxx>
@@ -98,7 +98,7 @@ class OpenGl_Workspace : public OpenGl_Window
 public:
 
   //! Main constructor - prepare GL context for specified window.
 public:
 
   //! Main constructor - prepare GL context for specified window.
-  OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
+  OpenGl_Workspace (const Handle(Aspect_DisplayConnection)& theDisplayConnection,
                     const CALL_DEF_WINDOW&        theCWindow,
                     Aspect_RenderingContext       theGContext,
                     const Handle(OpenGl_Caps)&    theCaps,
                     const CALL_DEF_WINDOW&        theCWindow,
                     Aspect_RenderingContext       theGContext,
                     const Handle(OpenGl_Caps)&    theCaps,
@@ -156,6 +156,8 @@ public:
   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
 
   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
 
+  Standard_Integer AntiAliasingMode() const { return myAntiAliasingMode; }
+
   //// RELATED TO STATUS ////
 
   Standard_Integer   NamedStatus;
   //// RELATED TO STATUS ////
 
   Standard_Integer   NamedStatus;
@@ -555,7 +557,9 @@ protected: //! @name fields related to ray-tracing
 protected: //! @name protected fields
 
   Handle(OpenGl_PrinterContext) myPrintContext;
 protected: //! @name protected fields
 
   Handle(OpenGl_PrinterContext) myPrintContext;
-  Handle(OpenGl_View)    myView;            // WSViews - now just one view is supported
+  Handle(OpenGl_View)           myView;
+  Handle(OpenGl_LineAttributes) myLineAttribs;
+  Standard_Integer       myAntiAliasingMode;
   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
   Standard_Boolean       myBackBufferRestored;
   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
   Standard_Boolean       myBackBufferRestored;
   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
index 6ab47d6..833bb3f 100644 (file)
@@ -36,8 +36,6 @@
 #include <OpenGl_PrinterContext.hxx>
 #include <OpenGl_Workspace.hxx>
 #include <OpenGl_View.hxx>
 #include <OpenGl_PrinterContext.hxx>
 #include <OpenGl_Workspace.hxx>
 #include <OpenGl_View.hxx>
-#include <OpenGl_Display.hxx>
-
 
 #ifdef _WIN32
 
 
 #ifdef _WIN32
 
index 3c626bd..6b5dc65 100644 (file)
@@ -299,7 +299,7 @@ const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean Wi
 
     if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) )
     {
 
     if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) )
     {
-      myDisplay->SetTypeOfLine(AspectLine_set->Type());
+      myLineAttribs->SetTypeOfLine (AspectLine_set->Type());
     }
 
     if ( !AspectLine_applied || ( AspectLine_set->Width() != AspectLine_applied->Width() ) )
     }
 
     if ( !AspectLine_applied || ( AspectLine_set->Width() != AspectLine_applied->Width() ) )
@@ -386,7 +386,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th
       case Aspect_IS_HATCH:
       {
         glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
       case Aspect_IS_HATCH:
       {
         glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
-        myDisplay->SetTypeOfHatch (AspectFace_applied != NULL ? AspectFace_applied->Hatch() : TEL_HS_SOLID);
+        myLineAttribs->SetTypeOfHatch (AspectFace_applied != NULL ? AspectFace_applied->Hatch() : TEL_HS_SOLID);
         break;
       }
       case Aspect_IS_SOLID:
         break;
       }
       case Aspect_IS_SOLID:
@@ -409,7 +409,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th
     const Tint hatchstyle = AspectFace_set->Hatch();
     if (AspectFace_applied == NULL || AspectFace_applied->Hatch() != hatchstyle)
     {
     const Tint hatchstyle = AspectFace_set->Hatch();
     if (AspectFace_applied == NULL || AspectFace_applied->Hatch() != hatchstyle)
     {
-      myDisplay->SetTypeOfHatch(hatchstyle);
+      myLineAttribs->SetTypeOfHatch (hatchstyle);
     }
   }
 
     }
   }