mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0022819: Redesign of OpenGl driver Additional integration
This commit is contained in:
parent
408ecc39f3
commit
c320e55791
@ -487,7 +487,7 @@ typedef struct {
|
|||||||
|
|
||||||
int IsSet;
|
int IsSet;
|
||||||
|
|
||||||
char* Font;
|
const char* Font;
|
||||||
|
|
||||||
float Space;
|
float Space;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class OpenGl_Display : public MMgt_TShared
|
|||||||
|
|
||||||
void Init ();
|
void Init ();
|
||||||
|
|
||||||
void ExportText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height);
|
void ExportText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const short height);
|
||||||
|
|
||||||
#ifdef HAVE_GL2PS
|
#ifdef HAVE_GL2PS
|
||||||
static void getGL2PSFontName(const char *src_font, char *ps_font);
|
static void getGL2PSFontName(const char *src_font, char *ps_font);
|
||||||
|
@ -310,9 +310,9 @@ void OpenGl_Display::RenderText (const wchar_t* str, const int is2d, const float
|
|||||||
if ( renderMode == GL_FEEDBACK )
|
if ( renderMode == GL_FEEDBACK )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GL2PS
|
#ifdef HAVE_GL2PS
|
||||||
export_h = (GLdouble)fnt->FaceSize() / export_h;
|
export_h = (float)fnt->FaceSize() / export_h;
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
ExportText( str, is2d, x, y, z, aspect, param, export_h );
|
ExportText( str, is2d, x, y, z, aspect, param, (short)export_h );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -328,7 +328,7 @@ void OpenGl_Display::RenderText (const wchar_t* str, const int is2d, const float
|
|||||||
static const int alignmentforgl2ps[3][3] = { {5,2,8}, {4,1,7}, {6,3,9} };
|
static const int alignmentforgl2ps[3][3] = { {5,2,8}, {4,1,7}, {6,3,9} };
|
||||||
|
|
||||||
void OpenGl_Display::ExportText (const wchar_t* text, const int is2d, const float x, const float y, const float z,
|
void OpenGl_Display::ExportText (const wchar_t* text, const int is2d, const float x, const float y, const float z,
|
||||||
const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height)
|
const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const short height)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GL2PS
|
#ifdef HAVE_GL2PS
|
||||||
|
|
||||||
|
@ -338,8 +338,8 @@ void OpenGl_FontMgr::render_text( const Standard_Integer id, const wchar_t* text
|
|||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint* param = new GLint;
|
GLint param;
|
||||||
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
|
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, ¶m);
|
||||||
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
glAlphaFunc(GL_GEQUAL, 0.285f);
|
glAlphaFunc(GL_GEQUAL, 0.285f);
|
||||||
@ -347,15 +347,13 @@ void OpenGl_FontMgr::render_text( const Standard_Integer id, const wchar_t* text
|
|||||||
OGLFont_Cache cache = _FontCache.Find( id );
|
OGLFont_Cache cache = _FontCache.Find( id );
|
||||||
cache.Font->Render( text );
|
cache.Font->Render( text );
|
||||||
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, *param);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
|
||||||
|
|
||||||
if( !enableTexture )
|
if( !enableTexture )
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
if( !enableDepthTest )
|
if( !enableDepthTest )
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
delete param;
|
|
||||||
|
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
glMatrixMode( GL_MODELVIEW );
|
glMatrixMode( GL_MODELVIEW );
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -248,7 +248,7 @@ void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const
|
|||||||
{
|
{
|
||||||
CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText;
|
CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText;
|
||||||
|
|
||||||
aContextText.Font = (char*)Font;
|
aContextText.Font = Font;
|
||||||
aContextText.DisplayType = AType;
|
aContextText.DisplayType = AType;
|
||||||
aContextText.Color.r = R;
|
aContextText.Color.r = R;
|
||||||
aContextText.Color.g = G;
|
aContextText.Color.g = G;
|
||||||
|
@ -424,13 +424,13 @@ static void MyGenTextureEXT (TextureID ID)
|
|||||||
*/
|
*/
|
||||||
static void MyBindTextureEXT (TextureID ID, int Context)
|
static void MyBindTextureEXT (TextureID ID, int Context)
|
||||||
{
|
{
|
||||||
// si l'extension est presente, c'est facile
|
|
||||||
TextureDataID data = textab[ID].data;
|
TextureDataID data = textab[ID].data;
|
||||||
if (textab[ID].status == TEXDATA_NONE)
|
if (texdata[data].status == TEXDATA_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// OCC11904 - make sure that the correct texture is bound before drawing
|
GLenum aParamName = texdata[data].status == TEXDATA_1D ?
|
||||||
GLenum aParamName = textab[ID].status == TEXDATA_1D ? GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
|
GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
|
||||||
|
|
||||||
GLint aCurrTex = -1;
|
GLint aCurrTex = -1;
|
||||||
glGetIntegerv (aParamName, &aCurrTex);
|
glGetIntegerv (aParamName, &aCurrTex);
|
||||||
if (textab[ID].number[Context] != aCurrTex)
|
if (textab[ID].number[Context] != aCurrTex)
|
||||||
|
@ -946,7 +946,7 @@ D = -[Px,Py,Pz] dot |Nx|
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
glPushAttrib( GL_FOG_BIT | GL_LIGHTING_BIT );
|
glPushAttrib( GL_FOG_BIT | GL_LIGHTING_BIT | GL_ENABLE_BIT );
|
||||||
|
|
||||||
// Apply Fog
|
// Apply Fog
|
||||||
if ( myFog.IsOn )
|
if ( myFog.IsOn )
|
||||||
@ -1184,7 +1184,7 @@ D = -[Px,Py,Pz] dot |Nx|
|
|||||||
if (!myGraduatedTrihedron.IsNull())
|
if (!myGraduatedTrihedron.IsNull())
|
||||||
myGraduatedTrihedron->Render(AWorkspace);
|
myGraduatedTrihedron->Render(AWorkspace);
|
||||||
|
|
||||||
glPopAttrib(); // GL_FOG_BIT | GL_LIGHTING_BIT
|
glPopAttrib(); // GL_FOG_BIT | GL_LIGHTING_BIT | GL_ENABLE_BIT
|
||||||
|
|
||||||
// Restore face culling
|
// Restore face culling
|
||||||
if ( myBackfacing )
|
if ( myBackfacing )
|
||||||
|
@ -482,7 +482,7 @@ Standard_Boolean OpenGl_Workspace::Print
|
|||||||
{
|
{
|
||||||
if (hViewBitmap)
|
if (hViewBitmap)
|
||||||
DeleteObject (hViewBitmap);
|
DeleteObject (hViewBitmap);
|
||||||
aFrameBuffer->Release ();
|
aFrameBuffer->Release (GetGlContext());
|
||||||
hViewBitmap = NULL;
|
hViewBitmap = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user