Remove obsolete properties, remove OpenGl_Display class.
Fix compilation on Linux
InterfaceGraphic_XWD.hxx
InterfaceGraphic_wntio.hxx
InterfaceGraphic_cPrintf.cxx
-InterfaceGraphic_Palette.c
InterfaceGraphic_telem.hxx
InterfaceGraphic_tgl_all.hxx
+++ /dev/null
-/*
- 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 */
} 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 */
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_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
+++ /dev/null
-// 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
+++ /dev/null
-// 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;
- }
-}
+++ /dev/null
-// 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
+++ /dev/null
-// 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 );
-}
-
-/*----------------------------------------------------------------------*/
#include <OpenGl_Trihedron.hxx>
#include <OpenGl_Workspace.hxx>
+#include <OSD_Environment.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)
//
}
+// =======================================================================
+// 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 :
#include <Graphic3d_GraphicDriver.hxx>
#include <Handle_OpenGl_GraphicDriver.hxx>
-#include <Handle_OpenGl_Display.hxx>
#include <OpenGl_Context.hxx>
#include <OpenGl_PrinterContext.hxx>
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;
+++ /dev/null
-// 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();
-}
+++ /dev/null
-// 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;
-}
-
#include <OpenGl_Structure.hxx>
#include <OpenGl_CView.hxx>
-#include <OpenGl_Display.hxx>
#include <OpenGl_Text.hxx>
/*----------------------------------------------------------------------*/
aStruct->ReleaseGlResources (aCtx);
}
myTempText->Release (aCtx);
- myGlDisplay->ReleaseAttributes (aCtx.operator->());
myDeviceLostFlag = !myMapOfStructure.IsEmpty();
}
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();
- 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);
#include <Font_FontAspect.hxx>
-#include <OpenGl_Display.hxx>
#include <OpenGl_AspectText.hxx>
#include <OpenGl_Text.hxx>
#include <OpenGl_TextParam.hxx>
+#include <OpenGl_LineAttributes.hxx>
/*----------------------------------------------------------------------*/
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 ((GLfloat) Width);
+ TheLayerProp.LineWidth = theWidth;
+ glLineWidth ((GLfloat )theWidth);
}
}
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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
#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_LayerList.hxx>
#include <OpenGl_Light.hxx>
+#include <OpenGl_LineAttributes.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>
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;
#include <OpenGl_AspectLine.hxx>
#include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
#include <OpenGl_Matrix.hxx>
#include <OpenGl_Workspace.hxx>
#include <OpenGl_View.hxx>
glPopAttrib(); //GL_ENABLE_BIT | GL_TEXTURE_BIT
if (theWorkspace.UseZBuffer())
+ {
glEnable (GL_DEPTH_TEST);
-
- /* GL_DITHER on/off pour le trace */
- if (theWorkspace.Dither())
- glEnable (GL_DITHER);
- else
- glDisable (GL_DITHER);
+ }
}
}
if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
{
- const int antiAliasingMode = AWorkspace->GetDisplay()->AntiAliasingMode();
+ const int antiAliasingMode = AWorkspace->AntiAliasingMode();
if ( !myAntiAliasing )
{
#include <OpenGl_Window.hxx>
#include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
#include <Aspect_GraphicDeviceDefinitionError.hxx>
#include <TCollection_AsciiString.hxx>
// 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)
-: myDisplay (theDisplay),
- myGlContext (new OpenGl_Context (theCaps)),
+: myGlContext (new OpenGl_Context (theCaps)),
myOwnGContext (theGContext == 0),
-#if defined(_WIN32)
- mySysPalInUse (FALSE),
-#endif
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)
+ (void )theDisplayConnection;
HWND aWindow = (HWND )theCWindow.XWindow;
HDC aWindowDC = GetDC (aWindow);
HGLRC aGContext = (HGLRC )theGContext;
}
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)
#else
WINDOW aParent = (WINDOW )theCWindow.XWindow;
WINDOW aWindow = 0;
- DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+
+ Display* aDisp = theDisplayConnection->GetDisplay();
GLXContext aGContext = (GLXContext )theGContext;
XWindowAttributes wattr;
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);
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;
}
}
- /*
- * 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);
// =======================================================================
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;
+#endif
// If the size is not changed - do nothing
if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
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;
#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
{
- /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/
-
- if (myDither)
- glEnable (GL_DITHER);
- else
- glDisable (GL_DITHER);
+ //
}
// =======================================================================
// =======================================================================
void OpenGl_Window::DisableFeatures() const
{
- glDisable (GL_DITHER);
glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
/*
{
glDrawBuffer (GL_BACK);
}
-
-// =======================================================================
-// function : GetGContext
-// purpose :
-// =======================================================================
-GLCONTEXT OpenGl_Window::GetGContext() const
-{
- return (GLCONTEXT )myGlContext->myGContext;
-}
#include <OpenGl_Caps.hxx>
#include <Handle_OpenGl_Context.hxx>
-#include <Handle_OpenGl_Display.hxx>
#include <Handle_OpenGl_Window.hxx>
+#include <Aspect_DisplayConnection.hxx>
#include <MMgt_TShared.hxx>
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 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_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; }
- //! This method will be removed in future version!
- GLCONTEXT GetGContext() const;
-
protected:
//! Activates GL context and setup viewport.
protected:
- Handle(OpenGl_Display) myDisplay;
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:
#include <OpenGl_Window.hxx>
#include <OpenGl_Context.hxx>
-#include <OpenGl_Display.hxx>
#include <Aspect_GraphicDeviceDefinitionError.hxx>
#include <Cocoa_LocalPool.hxx>
#include <TCollection_AsciiString.hxx>
// 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)
-: myDisplay (theDisplay),
- myGlContext (new OpenGl_Context (theCaps)),
+: myGlContext (new OpenGl_Context (theCaps)),
myOwnGContext (theGContext == 0),
- myWidth ((Standard_Integer )theCWindow.dx),
+ 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;
// =======================================================================
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 ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
+ if (myWidth == (Standard_Integer )theCWindow.dx
+ && myHeight == (Standard_Integer )theCWindow.dy)
{
return;
}
// 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)
-: OpenGl_Window (theDisplay, theCWindow, theGContext, theCaps, theShareCtx),
+: OpenGl_Window (theDisplayConnection, theCWindow, theGContext, theCaps, theShareCtx),
NamedStatus (0),
HighlightColor (&THE_WHITE_COLOR),
//
myViewModificationStatus (0),
myLayersModificationStatus (0),
//
+ myAntiAliasingMode (3),
myTransientDrawToFront (Standard_True),
myBackBufferRestored (Standard_False),
myIsImmediateDrawn (Standard_False),
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
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;
+ }
}
// =======================================================================
// =======================================================================
OpenGl_Workspace::~OpenGl_Workspace()
{
+ if (!myLineAttribs.IsNull())
+ {
+ myLineAttribs.Nullify();
+ myGlContext->ReleaseResource ("OpenGl_LineAttributes", Standard_True);
+ }
+
ReleaseRaytraceResources();
}
const Aspect_CLayer2d& theCOverLayer,
const int theToSwap)
{
- if (myDisplay.IsNull() || myView.IsNull())
+ if (myView.IsNull())
{
return;
}
// 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)
{
#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_TextParam.hxx>
#include <OpenGl_RenderFilter.hxx>
#include <OpenGl_Vec.hxx>
+#include <OpenGl_LineAttributes.hxx>
#include <Handle_OpenGl_View.hxx>
#include <Handle_OpenGl_Texture.hxx>
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,
Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
Standard_Boolean& UseGLLight() { return myUseGLLight; }
+ Standard_Integer AntiAliasingMode() const { return myAntiAliasingMode; }
+
//// RELATED TO STATUS ////
Standard_Integer NamedStatus;
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
#include <OpenGl_PrinterContext.hxx>
#include <OpenGl_Workspace.hxx>
#include <OpenGl_View.hxx>
-#include <OpenGl_Display.hxx>
-
#ifdef _WIN32
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() ) )
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:
const Tint hatchstyle = AspectFace_set->Hatch();
if (AspectFace_applied == NULL || AspectFace_applied->Hatch() != hatchstyle)
{
- myDisplay->SetTypeOfHatch(hatchstyle);
+ myLineAttribs->SetTypeOfHatch (hatchstyle);
}
}