1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023544: Texture management in TKOpenGl should be redesigned

Structures Graphic3d_CView, Graphic3d_CStructure, Graphic3d_CGroup become classes and their definitions moved from InterfaceGraphic to Graphic3d.
Introduced new class OpenGl_Texture as replacement for OpenGl_ResourceTexture class and static functions in OpenGl_TextureBox.
Graphic3d_TextureRoot now no more communicate within Graphic3d_GraphicalDriver.
Instead class returns image through GetImage() method.
OpenGl_AspectFace - avoid possible NULL-dereference
OpenGl_Texture::Init() - check gluBuild2DMipmaps() return value
OpenGl_Texture - check GL_BGRA_EXT for compatibility
OpenGl_Texture - scale NPOT image when required
Added more description to Graphic3d_TextureRoot class
OpenGl_Texture - added missing break statement for ImgBGR32 case
OpenGl_Workspace::setTextureParams() - fixed local variable aFilterMin overrides visibility of early declared variable
OpenGl_Workspace::DisableTexture() - reset texture matrix
FTGL do not reset texture matrix and corrupt text could be rendered if custom texture has not identity texture matrix.
This commit is contained in:
kgv
2012-12-07 13:58:30 +04:00
parent ab8fcacf28
commit bf75be9867
92 changed files with 3647 additions and 3857 deletions

View File

@@ -54,6 +54,7 @@
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_TextureRoot.hxx>
#include <Image_AlienPixMap.hxx>
#include <Prs3d_ShadingAspect.hxx>
@@ -1786,61 +1787,6 @@ static int VDisplayAll( Draw_Interpretor& di, Standard_Integer argc, const char*
return 0;
}
//#######################################################################################################
static TCollection_AsciiString GetEnvir (Draw_Interpretor& di) {
static Standard_Boolean IsDefined=Standard_False ;
static TCollection_AsciiString VarName;
if ( !IsDefined ) {
const char *envir, *casroot ;
envir = getenv("CSF_MDTVTexturesDirectory") ;
Standard_Boolean HasDefinition = Standard_False ;
if ( !envir ) {
casroot = getenv("CASROOT");
if ( casroot ) {
VarName = TCollection_AsciiString (casroot);
VarName += "/src/Textures" ;
HasDefinition = Standard_True ;
}
} else {
VarName = TCollection_AsciiString (envir);
HasDefinition = Standard_True ;
}
if ( HasDefinition ) {
OSD_Path aPath ( VarName );
OSD_Directory aDir(aPath);
if ( aDir.Exists () ) {
TCollection_AsciiString aTexture = VarName + "/2d_MatraDatavision.rgb" ;
OSD_File TextureFile ( aTexture );
if ( !TextureFile.Exists() ) {
di << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << "\n";
di << " not all files are found in : "<<VarName.ToCString() << "\n";
Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory or CASROOT not correctly setted " );
}
} else {
di << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << "\n";
di << " Directory : "<< VarName.ToCString() << " not exist " << "\n";
Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory or CASROOT not correctly setted " );
}
return VarName ;
} else {
di << " CSF_MDTVTexturesDirectory and CASROOT not setted " << "\n";
di << " one of these variable are mandatory to use this fonctionnality" << "\n";
Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory and CASROOT not setted " );
}
IsDefined = Standard_True ;
}
return VarName ;
}
//#######################################################################################################
//#######################################################################################################
//## VTexture
@@ -1909,8 +1855,7 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha
{
if(strcasecmp(argv[2],"?")==0)
{
TCollection_AsciiString monPath = GetEnvir (di) ;
TCollection_AsciiString monPath = Graphic3d_TextureRoot::TexturesFolder();
di<<"\n Files in current directory : \n"<<"\n";
TCollection_AsciiString Cmnd ("glob -nocomplain *");
di.Eval(Cmnd.ToCString());

View File

@@ -171,7 +171,6 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
// To test linking against OpenGl_Workspace and all aspect classes
const OpenGl_AspectLine* aLA = theWorkspace->AspectLine(0);
const OpenGl_AspectFace* aFA = theWorkspace->AspectFace(0);
aFA->Context();
const OpenGl_AspectMarker* aMA = theWorkspace->AspectMarker(0);
aMA->Type();
const OpenGl_AspectText* aTA = theWorkspace->AspectText(0);