#include <stdio.h>
#include <OpenGl_Memory.hxx>
-#include <OpenGl_ResourceCleaner.hxx>
#ifdef WNT
if( !ctx) return TFailure;
- OpenGl_ResourceCleaner::GetInstance()->AppendContext( ctx, true );
-
cmap = XCreateColormap( disp, par, vis->visual, AllocNone );
color.red = (unsigned short) (bgcolr * 0xFFFF);
if ( pfd.dwFlags & PFD_NEED_PALETTE )
{
-#ifndef _WIN64
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLong ( par, GWL_USERDATA );
-#else
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLong ( par, GWLP_USERDATA );
-#endif
+ WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA );
InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE,
s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE);
return 0;
}
- Standard_Boolean isShared = Standard_True;
-
- if (previous_ctx == 0 )
- previous_ctx = hte -> hGLRC;
- // if we already have some shared context
- else
+ if (previous_ctx == 0 )
{
- // try to share context with one from resource cleaner list
- GLCONTEXT shareCtx = OpenGl_ResourceCleaner::GetInstance()->GetSharedContext();
-
- if (shareCtx != 0)
- isShared = (Standard_Boolean)wglShareLists(shareCtx, hte -> hGLRC);
- else
- {
- isShared = (Standard_Boolean)wglShareLists(previous_ctx, hte -> hGLRC);
- // add shared previous_ctx to a control list if it's not there
- if (isShared)
- OpenGl_ResourceCleaner::GetInstance()->AppendContext(previous_ctx, isShared);
- }
- }
+ previous_ctx = hte -> hGLRC;
+ } else
+ wglShareLists(previous_ctx, hte -> hGLRC);
- // add the context to OpenGl_ResourceCleaner control list
- OpenGl_ResourceCleaner::GetInstance()->AppendContext( hte -> hGLRC, isShared);
_Txgl_Map.Bind( (Tint)par, hte );
return par;
if ( pfd.dwFlags & PFD_NEED_PALETTE )
{
-#ifndef _WIN64
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLong ( par, GWL_USERDATA );
-#else
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLong ( par, GWLP_USERDATA );
-#endif
+ WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA );
InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE,
s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE);
/* FSXXX sync necessary if non-direct rendering */
glXWaitGL();
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext( ctx );
_Txgl_Map.UnBind( win );
if (previous_ctx == ctx) {
/* palette messages in the main application message loop. */
/* In debug version we don't have message loop for most */
/* cases. So, let's restore system colors here now. */
-#ifndef _WIN64
- wd = ( WINDOW_DATA* )GetWindowLong ( win, GWL_USERDATA );
-#else
- wd = ( WINDOW_DATA* )GetWindowLong ( win, GWLP_USERDATA );
-#endif
+ wd = ( WINDOW_DATA* )GetWindowLongPtr ( win, GWLP_USERDATA );
if ( wd != NULL ) InterfaceGraphic_RealizePalette (
hte -> hDC, wd -> hPal, TRUE, s_sysPalInUse);
if ( --hte -> nUsed == 0 )
{
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext( hte -> hGLRC );
#ifdef OCC954
if ( wglGetCurrentContext() != NULL )
#endif
wglDeleteContext ( hte -> hGLRC );
ReleaseDC ( win, hte -> hDC );
_Txgl_Map.UnBind( (Tint ) win );
- if( _Txgl_Map.Size() == 0 ) {
- previous_ctx = 0;
- }
delete hte;
}