View Issue Details

IDProjectCategoryView StatusLast Update
0023544Open CASCADEOCCT:Visualizationpublic2017-05-12 11:14
Reporterkgv Assigned Tokgv  
Status closedResolutionfixed 
Product Version6.5.4 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023544: Texture management in TKOpenGl should be redesigned
DescriptionThere are several issues in current implementation of texture management which should be fixed:
- Move OpenGl_TextureBox implementation to the class inherited from OpenGl_Resource. Drop OpenGl_ResourceTexture.
- Eliminate global variables and arrays. Textures should be shared between GL contexts within the single OpenGl_GraphicDriver instance.
- Perform correct destruction of GL resources when last view destroyed in OpenGl_GraphicDriver.
TagsNo tags attached.
Test case numberNot needed


related to 0023500 closedibs Open CASCADE MFC texture example is crashed when view closed 
parent of 0023630 closedkgv Open CASCADE Incorrect NULL check in OpenGl_Workspace::EnableTexture() 
parent of 0023632 closedkgv Open CASCADE Add support for NPOT mipmap textures in TKOpenGl 
parent of 0028734 closedbugmaster Open CASCADE Visualization, OpenGl_Texture - fix initialization of 1D texture 
related to 0023118 closedbugmaster Open CASCADE Incomplete face aspect data returned by Graphic3d_Group::GroupPrimitivesAspect() 
related to 0023813 closedbugmaster Open CASCADE TKOpenGl, OpenGl_Texture ignores stride image property 
child of 0023028 closedbugmaster Open CASCADE Visualization, TKOpenGl - eliminate global static variables 



2012-12-02 17:10

developer   ~0022497

Patch is ready for review in branch CR23544.


2012-12-04 21:06

developer   ~0022553

Branch CR23544 reviewed with the following remarks:

src/OpenGl/OpenGl_Workspace_5.cxx, OpenGl_Workspace::AspectFace ():

    switch (anIntstyle)
      case 5: //szvgl - no corresponding enumeration item Aspect_IS_POINT
Is it possible to consider adding Aspect_IS_POINT?

src/OpenGl/OpenGl_AspectFace.cxx, OpenGl_AspectFace::Init():

Here and in Release(), the texture keys (aNewKey, myTextureId) are checked if they are empty strings, but the meaning of such a special texture key does not seem to be explained anywhere. So at least a comment is needed explaining this.

src/OpenGl/OpenGl_AspectFace.cxx, OpenGl_AspectFace::Release():

TextureRes is not nullified if myTextureId.IsEmpty() returns true, though the comment says it should be. Also check similar block in Init().


2012-12-04 23:11

developer   ~0022554

Dear san,

> case 5: //szvgl - no corresponding enumeration item Aspect_IS_POINT
I suggest to do not try fix enumerations mess in AIS / Graphic3d / OpenGl packages unrelated to texture objects within this patch.

> src/OpenGl/OpenGl_AspectFace.cxx, OpenGl_AspectFace::Release():
> TextureRes is not nullified if myTextureId.IsEmpty() returns true,
> though the comment says it should be. Also check similar block in Init().
Please look deeply in code - TextureRes is always nullify within following code block.

> src/OpenGl/OpenGl_AspectFace.cxx, OpenGl_AspectFace::Init():
> Here and in Release(), the texture keys (aNewKey, myTextureId)
> are checked if they are empty strings, but the meaning of such a special
> texture key does not seem to be explained anywhere.
> So at least a comment is needed explaining this.
I extended documentation of Graphic3d_TextureRoot class although empty key conception has dubious usefulness...


2012-12-05 11:07

developer   ~0022560

Branch CR23544 reviewed without remarks, ready for testing.


2012-12-06 12:15

tester   ~0022584

Dear BugMaster,
Branch CR23544 (and products from GIT master) was compiled on Linux and
Windows platforms and tested.

Not detected

Not detected

Testing cases:
Not needed


2012-12-07 09:20

developer   ~0022603

SSP sample was updated in products branch CR23544 (please don't forget to integrate).


2012-12-11 10:04

administrator   ~0022644

Fix of SSP sample has been integrated into occt-products repository

Related Changesets

occt: master bf75be98

2012-12-07 09:58:30


Details Diff
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.
Affected Issues
mod - .gitignore Diff File
mod - src/AIS/AIS_TexturedShape.cxx Diff File
mod - src/Graphic3d/FILES Diff File
mod - src/Graphic3d/Graphic3d.cdl Diff File
mod - src/Graphic3d/Graphic3d_CGroup.hxx Diff File
rm - src/Graphic3d/Graphic3d_CInitTexture.hxx Diff File
mod - src/Graphic3d/Graphic3d_CStructure.hxx Diff File
mod - src/Graphic3d/Graphic3d_CTexture.hxx Diff File
mod - src/Graphic3d/Graphic3d_CView.hxx Diff File
mod - src/Graphic3d/Graphic3d_GraphicDriver.cdl Diff File
mod - src/Graphic3d/Graphic3d_Group.cxx Diff File
mod - src/Graphic3d/Graphic3d_Group_8.cxx Diff File
mod - src/Graphic3d/Graphic3d_Structure.cdl Diff File
mod - src/Graphic3d/Graphic3d_Structure.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture1D.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture1D.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture1Dmanual.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture1Dmanual.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture1Dsegment.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture1Dsegment.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture2D.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture2D.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture2Dmanual.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture2Dmanual.cxx Diff File
mod - src/Graphic3d/Graphic3d_Texture2Dplane.cdl Diff File
mod - src/Graphic3d/Graphic3d_Texture2Dplane.cxx Diff File
mod - src/Graphic3d/Graphic3d_TextureEnv.cdl Diff File
mod - src/Graphic3d/Graphic3d_TextureEnv.cxx Diff File
mod - src/Graphic3d/Graphic3d_TextureMap.cdl Diff File
mod - src/Graphic3d/Graphic3d_TextureMap.cxx Diff File
add - src/Graphic3d/Graphic3d_TextureParams.cdl Diff File
add - src/Graphic3d/Graphic3d_TextureParams.cxx Diff File
mod - src/Graphic3d/Graphic3d_TextureRoot.cdl Diff File
mod - src/Graphic3d/Graphic3d_TextureRoot.cxx Diff File
mod - src/Image/FILES Diff File
mod - src/Image/Image_PixMap.hxx Diff File
mod - src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx Diff File
mod - src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx Diff File
mod - src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx Diff File
mod - src/NCollection/NCollection_Vec2.hxx Diff File
mod - src/NCollection/NCollection_Vec3.hxx Diff File
mod - src/OpenGl/FILES Diff File
mod - src/OpenGl/OpenGl_AspectFace.cxx Diff File
mod - src/OpenGl/OpenGl_AspectFace.hxx Diff File
mod - src/OpenGl/OpenGl_AspectLine.cxx Diff File
mod - src/OpenGl/OpenGl_AspectLine.hxx Diff File
mod - src/OpenGl/OpenGl_AspectMarker.cxx Diff File
mod - src/OpenGl/OpenGl_AspectMarker.hxx Diff File
mod - src/OpenGl/OpenGl_AspectText.cxx Diff File
mod - src/OpenGl/OpenGl_AspectText.hxx Diff File
mod - src/OpenGl/OpenGl_Context.cxx Diff File
mod - src/OpenGl/OpenGl_Context.hxx Diff File
mod - src/OpenGl/OpenGl_Element.hxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver.hxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver_3.cxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver_4.cxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver_7.cxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver_9.cxx Diff File
mod - src/OpenGl/OpenGl_Group.cxx Diff File
mod - src/OpenGl/OpenGl_Group.hxx Diff File
mod - src/OpenGl/OpenGl_Marker.cxx Diff File
mod - src/OpenGl/OpenGl_MarkerSet.cxx Diff File
mod - src/OpenGl/OpenGl_Polygon.cxx Diff File
mod - src/OpenGl/OpenGl_Polyline.cxx Diff File
mod - src/OpenGl/OpenGl_PrimitiveArray.cxx Diff File
mod - src/OpenGl/OpenGl_PrimitiveArray.hxx Diff File
rm - src/OpenGl/OpenGl_ResourceTexture.cxx Diff File
mod - src/OpenGl/OpenGl_Structure.cxx Diff File
mod - src/OpenGl/OpenGl_Structure.hxx Diff File
mod - src/OpenGl/OpenGl_Text.cxx Diff File
add - src/OpenGl/OpenGl_Texture.cxx Diff File
add - src/OpenGl/OpenGl_Texture.hxx Diff File
rm - src/OpenGl/OpenGl_TextureBox.cxx Diff File
rm - src/OpenGl/OpenGl_TextureBox.hxx Diff File
mod - src/OpenGl/OpenGl_Trihedron.cxx Diff File
mod - src/OpenGl/OpenGl_View.cxx Diff File
mod - src/OpenGl/OpenGl_View.hxx Diff File
mod - src/OpenGl/OpenGl_View_2.cxx Diff File
mod - src/OpenGl/OpenGl_Workspace.cxx Diff File
mod - src/OpenGl/OpenGl_Workspace.hxx Diff File
mod - src/OpenGl/OpenGl_Workspace_3.cxx Diff File
mod - src/OpenGl/OpenGl_Workspace_5.cxx Diff File
mod - src/ViewerTest/ViewerTest.cxx Diff File
mod - src/ViewerTest/ViewerTest_OpenGlCommands.cxx Diff File
mod - src/Visual3d/Visual3d_TransientManager.cxx Diff File
mod - src/Visual3d/Visual3d_View.cxx Diff File
mod - src/Visual3d/Visual3d_ViewManager.cxx Diff File

Issue History

Date Modified Username Field Change
2012-11-12 13:08 kgv New Issue
2012-11-12 13:08 kgv Assigned To => kgv
2012-11-12 13:08 kgv Relationship added child of 0023028
2012-11-12 13:09 kgv Relationship added related to 0023500
2012-12-02 17:10 kgv Note Added: 0022497
2012-12-02 17:10 kgv Assigned To kgv => san
2012-12-02 17:10 kgv Status new => resolved
2012-12-02 17:12 kgv Relationship added related to 0023118
2012-12-04 21:06 san Note Added: 0022553
2012-12-04 21:06 san Assigned To san => kgv
2012-12-04 21:06 san Status resolved => assigned
2012-12-04 23:11 kgv Note Added: 0022554
2012-12-04 23:11 kgv Assigned To kgv => san
2012-12-04 23:11 kgv Status assigned => resolved
2012-12-05 11:07 san Note Added: 0022560
2012-12-05 11:07 san Assigned To san => bugmaster
2012-12-05 11:07 san Status resolved => reviewed
2012-12-05 18:19 mkv Assigned To bugmaster => mkv
2012-12-06 12:15 mkv Note Added: 0022584
2012-12-06 12:16 mkv Test case number => Not needed
2012-12-06 12:16 mkv Assigned To mkv => bugmaster
2012-12-06 12:16 mkv Status reviewed => tested
2012-12-07 09:20 kgv Note Added: 0022603
2012-12-10 17:16 kgv Changeset attached => occt master bf75be98
2012-12-10 17:16 kgv Assigned To bugmaster => kgv
2012-12-10 17:16 kgv Status tested => verified
2012-12-10 17:16 kgv Resolution open => fixed
2012-12-11 10:04 bugmaster Note Added: 0022644
2012-12-11 18:00 kgv Relationship added parent of 0023630
2012-12-12 16:03 kgv Relationship added parent of 0023632
2013-03-05 09:22 kgv Relationship added related to 0023813
2013-04-23 13:35 aiv Status verified => closed
2013-04-29 15:23 aiv Fixed in Version => 6.6.0
2017-05-12 11:14 kgv Relationship added parent of 0028734