mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
Merging OCC22105, OCC22354, OCC22150 , OCC22199 , OCC22391 and OCC22108
This commit is contained in:
parent
c3d894867d
commit
d4c2114a1d
@ -55,6 +55,8 @@ static unsigned long vRand = 1L;
|
|||||||
#include <OpenGl_tgl_funcs.hxx>
|
#include <OpenGl_tgl_funcs.hxx>
|
||||||
#include <OpenGl_LightBox.hxx>
|
#include <OpenGl_LightBox.hxx>
|
||||||
#include <OpenGl_TextureBox.hxx>
|
#include <OpenGl_TextureBox.hxx>
|
||||||
|
#include <OpenGl_ResourceCleaner.hxx>
|
||||||
|
#include <OpenGl_ResourceVBO.hxx>
|
||||||
#include <InterfaceGraphic_PrimitiveArray.hxx>
|
#include <InterfaceGraphic_PrimitiveArray.hxx>
|
||||||
#include <OpenGl_Memory.hxx>
|
#include <OpenGl_Memory.hxx>
|
||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
@ -232,6 +234,10 @@ static void BuildVBO( CALL_DEF_PARRAY* p )
|
|||||||
|
|
||||||
if( p->flagBufferVBO == VBO_OK )
|
if( p->flagBufferVBO == VBO_OK )
|
||||||
clearRAMMemory(p);
|
clearRAMMemory(p);
|
||||||
|
|
||||||
|
//specify context for VBO resource
|
||||||
|
p->contextId = (Standard_Address)GET_GL_CONTEXT();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
@ -769,6 +775,21 @@ draw_array( call_def_parray p, Tint hflag,
|
|||||||
static TStatus
|
static TStatus
|
||||||
ParrayDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
|
ParrayDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
|
||||||
{
|
{
|
||||||
|
call_def_parray p = (call_def_parray)data.pdata;
|
||||||
|
if( p->VBOEnabled == VBO_OK ) {
|
||||||
|
OpenGl_ResourceCleaner* resCleaner = OpenGl_ResourceCleaner::GetInstance();
|
||||||
|
if( p->bufferVBO[VBOEdges] )
|
||||||
|
resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOEdges]) );
|
||||||
|
if( p->bufferVBO[VBOVertices] )
|
||||||
|
resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVertices]) );
|
||||||
|
if( p->bufferVBO[VBOVcolours] )
|
||||||
|
resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVcolours]) );
|
||||||
|
if( p->bufferVBO[VBOVnormals] )
|
||||||
|
resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVnormals]) );
|
||||||
|
if( p->bufferVBO[VBOVtexels] )
|
||||||
|
resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVtexels]) );
|
||||||
|
}
|
||||||
|
|
||||||
return TSuccess;
|
return TSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,12 +300,6 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x
|
|||||||
TsmGetAttri( 1, &keyZoom );
|
TsmGetAttri( 1, &keyZoom );
|
||||||
zoom = keyZoom.data.ldata;
|
zoom = keyZoom.data.ldata;
|
||||||
|
|
||||||
CMN_KEY keyfontName;
|
|
||||||
keyfontName.id = TelTextFont;//This flag responding about TextFontName
|
|
||||||
TsmGetAttri( 1, &keyfontName );
|
|
||||||
char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1];
|
|
||||||
strcpy(fontName,(char*)keyfontName.data.pdata);
|
|
||||||
|
|
||||||
OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
|
OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
|
||||||
int vh = 2 ;
|
int vh = 2 ;
|
||||||
int vv = 2 ;
|
int vv = 2 ;
|
||||||
@ -402,10 +396,17 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x
|
|||||||
if ( renderMode == GL_FEEDBACK )
|
if ( renderMode == GL_FEEDBACK )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GL2PS
|
#ifdef HAVE_GL2PS
|
||||||
|
CMN_KEY keyfontName;
|
||||||
|
keyfontName.id = TelTextFont;//This flag responding about TextFontName
|
||||||
|
TsmGetAttri( 1, &keyfontName );
|
||||||
|
char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1];
|
||||||
|
strcpy(fontName,(char*)keyfontName.data.pdata);
|
||||||
|
|
||||||
export_h = (GLdouble)fnt->FaceSize() / export_h;
|
export_h = (GLdouble)fnt->FaceSize() / export_h;
|
||||||
int aligment = alignmentforgl2ps( vh, vv );
|
int aligment = alignmentforgl2ps( vh, vv );
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
ExportText( str, fontName, export_h, angle, aligment, x, y, z, is2d!=0 );
|
ExportText( str, fontName, export_h, angle, aligment, x, y, z, is2d!=0 );
|
||||||
|
delete [] fontName;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -414,7 +415,6 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
delete [] fontName;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ GLboolean g_fBitmap;
|
|||||||
#include <OpenGl_tgl_funcs.hxx>
|
#include <OpenGl_tgl_funcs.hxx>
|
||||||
#include <OpenGl_tgl_subrvis.hxx>
|
#include <OpenGl_tgl_subrvis.hxx>
|
||||||
#include <OpenGl_FrameBuffer.hxx>
|
#include <OpenGl_FrameBuffer.hxx>
|
||||||
|
#include <OpenGl_ResourceCleaner.hxx>
|
||||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||||
#include <InterfaceGraphic_Visual3d.hxx>
|
#include <InterfaceGraphic_Visual3d.hxx>
|
||||||
|
|
||||||
@ -86,9 +87,9 @@ call_togl_redraw
|
|||||||
aFrameBuffer->BindBuffer();
|
aFrameBuffer->BindBuffer();
|
||||||
swap = 0; // no need to swap buffers
|
swap = 0; // no need to swap buffers
|
||||||
}
|
}
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->Cleanup();
|
||||||
call_func_redraw_all_structs_begin (aview->WsId);
|
call_func_redraw_all_structs_begin (aview->WsId);
|
||||||
call_togl_setplane( aview ); /* apl - OCC22108: update clipping planes */
|
call_togl_setplane( aview );
|
||||||
if (anunderlayer->ptrLayer)
|
if (anunderlayer->ptrLayer)
|
||||||
{
|
{
|
||||||
call_togl_redraw_layer2d (aview, anunderlayer);
|
call_togl_redraw_layer2d (aview, anunderlayer);
|
||||||
@ -163,8 +164,9 @@ call_togl_redraw_area
|
|||||||
glScissor ((GLint )x,
|
glScissor ((GLint )x,
|
||||||
(GLint )((int )aview->DefWindow.dy - (y + height)),
|
(GLint )((int )aview->DefWindow.dy - (y + height)),
|
||||||
(GLsizei )width, (GLsizei )height);
|
(GLsizei )width, (GLsizei )height);
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->Cleanup();
|
||||||
call_func_redraw_all_structs_begin (aview->WsId);
|
call_func_redraw_all_structs_begin (aview->WsId);
|
||||||
call_togl_setplane( aview ); /* apl - OCC22108: update clipping planes */
|
call_togl_setplane( aview );
|
||||||
if (anunderlayer->ptrLayer)
|
if (anunderlayer->ptrLayer)
|
||||||
{
|
{
|
||||||
call_togl_redraw_layer2d (aview, anunderlayer);
|
call_togl_redraw_layer2d (aview, anunderlayer);
|
||||||
|
@ -83,6 +83,7 @@ Old code resulted in crashes on some ATI Radeon cards under Linux.
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <OpenGl_Memory.hxx>
|
#include <OpenGl_Memory.hxx>
|
||||||
|
#include <OpenGl_ResourceCleaner.hxx>
|
||||||
|
|
||||||
|
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
@ -312,6 +313,8 @@ __declspec( dllexport ) int __fastcall __OpenGl_INIT__ (
|
|||||||
|
|
||||||
if( !ctx) return TFailure;
|
if( !ctx) return TFailure;
|
||||||
|
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->AppendContext( ctx, true );
|
||||||
|
|
||||||
cmap = XCreateColormap( disp, par, vis->visual, AllocNone );
|
cmap = XCreateColormap( disp, par, vis->visual, AllocNone );
|
||||||
|
|
||||||
color.red = (unsigned short) (bgcolr * 0xFFFF);
|
color.red = (unsigned short) (bgcolr * 0xFFFF);
|
||||||
@ -451,12 +454,29 @@ __declspec( dllexport ) int __fastcall __OpenGl_INIT__ (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previous_ctx == 0 )
|
Standard_Boolean isShared = Standard_True;
|
||||||
{
|
|
||||||
previous_ctx = hte -> hGLRC;
|
|
||||||
} else
|
|
||||||
wglShareLists(previous_ctx, hte -> hGLRC);
|
|
||||||
|
|
||||||
|
if (previous_ctx == 0 )
|
||||||
|
previous_ctx = hte -> hGLRC;
|
||||||
|
// if we already have some shared context
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the context to OpenGl_ResourceCleaner control list
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->AppendContext( hte -> hGLRC, isShared);
|
||||||
_Txgl_Map.Bind( (Tint)par, hte );
|
_Txgl_Map.Bind( (Tint)par, hte );
|
||||||
|
|
||||||
return par;
|
return par;
|
||||||
@ -763,6 +783,7 @@ __declspec( dllexport ) int __fastcall __OpenGl_INIT__ (
|
|||||||
/* FSXXX sync necessary if non-direct rendering */
|
/* FSXXX sync necessary if non-direct rendering */
|
||||||
glXWaitGL();
|
glXWaitGL();
|
||||||
|
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->RemoveContext( ctx );
|
||||||
_Txgl_Map.UnBind( win );
|
_Txgl_Map.UnBind( win );
|
||||||
|
|
||||||
if (previous_ctx == ctx) {
|
if (previous_ctx == ctx) {
|
||||||
@ -811,12 +832,16 @@ __declspec( dllexport ) int __fastcall __OpenGl_INIT__ (
|
|||||||
|
|
||||||
if ( --hte -> nUsed == 0 )
|
if ( --hte -> nUsed == 0 )
|
||||||
{
|
{
|
||||||
|
OpenGl_ResourceCleaner::GetInstance()->RemoveContext( hte -> hGLRC );
|
||||||
#ifdef OCC954
|
#ifdef OCC954
|
||||||
if ( wglGetCurrentContext() != NULL )
|
if ( wglGetCurrentContext() != NULL )
|
||||||
#endif
|
#endif
|
||||||
wglDeleteContext ( hte -> hGLRC );
|
wglDeleteContext ( hte -> hGLRC );
|
||||||
ReleaseDC ( win, hte -> hDC );
|
ReleaseDC ( win, hte -> hDC );
|
||||||
_Txgl_Map.UnBind( (Tint ) win );
|
_Txgl_Map.UnBind( (Tint ) win );
|
||||||
|
if( _Txgl_Map.Size() == 0 ) {
|
||||||
|
previous_ctx = 0;
|
||||||
|
}
|
||||||
delete hte;
|
delete hte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user