DiscussionsIssue archiveOCCT:Visualization

Archived issue #0025282

Visualization, OpenGl_PrimitiveArray - provide built-in GLSL programs as alternative to FFP

Open CASCADEOCCT:Visualizationclosed16 public notes

Search issues

Description

Some systems do not provide complete compatibility with old FFP (fixed-function pipeline) in their OpenGL implementations. TKOpenGl provides API for user-provided GLSL programs, however there are no built-in replacement for standard functionality.

Public activity

16 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Sun Sep 28 22:18:08 2014 +0300

    0025282: Visualization, OpenGl_PrimitiveArray - provide built-in GLSL programs as alternative to FFP
    
    Enumerations Visual3d_TypeOfModel, V3d_TypeOfShadingModel.
    - Remove unused values V3d_MULTICOLOR, V3d_HIDDEN, Visual3d_TOM_INTERP_COLOR.
    - Add per-pixel shading mode - V3d_PHONG, Visual3d_TOM_FRAGMENT.
    
    Draw Harness command vrenderparams.
    Add option -shadingModel to setup Shading Model.
    
    OpenGl_Caps::ffpEnable - new option to switch FFP/built-in GLSL programs.
    OpenGl_ShaderManager - add built-in GLSL programs.
    
    Draw Harness command vcaps.
    - Fix command syntax to meet coding rules.
    - Add option -ffp to activate/disable built-in GLSL programs.
    
    GLSL API changes.
    - Rename vertex attribute occColor -> occVertColor.
    - Introduce vec4 occColor uniform variable for light-less shaders.
    - Introduce float occPointSize uniform variable for marker programs.
    
    OpenGl_VertexBuffer::bindAttribute() - activate normalization for non-GL_FLOAT types,
    since color attribute is defined as 32-bit vector of 4 unsigned byte values.
    
    OpenGl_Context - add methods SetColor4fv() and SetPointSize()
    for parameters redirection to active GLSL program
    (as alternative to glColor4fv() and glPointSize()).
    
    OpenGl_ShaderProgram - define default precision for float types
    in Fragment Shader within OpenGL ES 2.0+ context.
02Author
Dear colleagues,

I would appreciate you remarks for the first patch draft based on Phong shader in OCCT.
Current limitations:
- No texture support (save the markers). Requires texture matrix uploading (at least for environment map).
- No textured font support. Requires proper matrices management without GLU in OpenGl_Text.
- No optimizations for different lights configuration. Lights loop can be generated for different combinations, and such combinations can be cached into map with keys like "ds" (0 - directional light, 1 - spot light) and automatically switched on view change (e.g. within OpenGl_ShaderManager::UpdateLightSourceStateTo()). It is suggested to provide this improvements in dedicated patches.
- Lighting does not work properly with points - to be investigated.
- Not yet tested on OpenGL ES 2.0 devices.
03Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Sep 29 09:46:03 2014 +0300

    OpenGl_ShaderManager, support RGB markers.
    
    OpenGl_AspectMarker, initialize Aspect_TOM_O_POINT display list
    in the same way as sprite texture.
    
    OpenGl_Texture, do not use sized internal formats on OpenGL ES.

04Commenter 4
Dear kgv,

We probably should optimize shaders for efficient rendering on mobile devices. The simplest way to do this is using free GLSL Optimizer (https://www.openhub.net/p/glsl-optimizer). It perform various optimizations of shader code and increaes performance up to 2x.

Also it is possible to use precision qualifiers (4.5.2 Precision Qualifiers in OpenGL ES spec) for some variables. It may significantly increase the rendering performance.
05Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: ibs
Date: Mon Sep 29 15:21:00 2014 +0400

    some typos fixed

06Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Sep 29 16:38:36 2014 +0400

    0025282: Visualization, OpenGl_PrimitiveArray - provide built-in GLSL programs as alternative to FFP
    
    Enumerations Visual3d_TypeOfModel, V3d_TypeOfShadingModel.
    - Remove unused values V3d_MULTICOLOR, V3d_HIDDEN, Visual3d_TOM_INTERP_COLOR.
    - Add per-pixel shading mode - V3d_PHONG, Visual3d_TOM_FRAGMENT.
    
    Draw Harness command vrenderparams.
    Add option -shadingModel to setup Shading Model.
    
    OpenGl_Caps::ffpEnable - new option to switch FFP/built-in GLSL programs.
    OpenGl_ShaderManager - add built-in GLSL programs.
    
    Draw Harness command vcaps.
    - Fix command syntax to meet coding rules.
    - Add option -ffp to activate/disable built-in GLSL programs.
    
    GLSL API changes.
    - Rename vertex attribute occColor -> occVertColor.
    - Introduce vec4 occColor uniform variable for light-less shaders.
    - Introduce float occPointSize uniform variable for marker programs.
    
    OpenGl_VertexBuffer::bindAttribute() - activate normalization for non-GL_FLOAT types,
    since color attribute is defined as 32-bit vector of 4 unsigned byte values.
    
    OpenGl_Context - add methods SetColor4fv() and SetPointSize()
    for parameters redirection to active GLSL program
    (as alternative to glColor4fv() and glPointSize()).
    
    OpenGl_ShaderProgram - define default precision for float types
    in Fragment Shader within OpenGL ES 2.0+ context.
    
    OpenGl_AspectMarker, initialize Aspect_TOM_O_POINT display list
    in the same way as sprite texture.
    
    OpenGl_Texture, do not use sized internal formats on OpenGL ES.
07Author
Dear Commenter 1,

please test branch CR25282_1.
08Commenter 8
Dear Commenter 1,
Branch CR25282_1 from occt git-repository (and master from products git-repository) was compiled on Linux and Windows platforms and tested on Release mode.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 16 (15 on master)
Windows: 0 (0 on master)

There is new additional compilation warning on Linux platform:
http://jenkins-test-03.nnov.opencascade.com:8080/user/mnt/my-views/view/A_mnt_warnings/job/mnt-CR25282_1-master_build_occt_linux/1/warnings16Result/package.-133837126/
OpenGl_ShaderManager.cxx:1013, GNU C Compiler 4 (gcc), Priority: Normal
statement has no effect

products component :
Linux: 11 (11 on master)
Windows: 3 (3 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 396618740 / 396931464
Total CPU difference: 44521.260000000046 / 46584.790000000045
products component :
Total MEMORY difference: 124760808 / 124645448
Total CPU difference: 14857.269999999982 / 14771.669999999953

Testing on Windows:
occt component :
Total MEMORY difference: 253834528 / 279236240
Total CPU difference: 33022.734375 / 39387.8125
products component :
Total MEMORY difference: 67257604 / 67249232
Total CPU difference: 11606.1875 / 11300.046875

There are no differences in images found by testdiff.
09Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Tue Sep 30 18:26:48 2014 +0400

    fix misprint in OpenGl_ShaderManager::prepareStdProgramFont()

10Author
The warning has been fixed in updated branch CR25282_1.
Please switch to tested (change does not affect any tests).
11Commenter 11
Dear Commenter 1,
Branch CR25282_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 15 (15 on master)
Windows: 0 (0 on master)
MacOS: 196 (196 on master)

products component :
Linux: 11 (11 on master)
Windows: 3 (3 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 396801420 / 396920756
Total CPU difference: 45379.37999999995 / 46584.63000000004
products component :
Total MEMORY difference: 124723560 / 124607824
Total CPU difference: 14762.299999999988 / 14765.679999999953

Testing on Windows:
occt component :
Total MEMORY difference: 277713700 / 279229128
Total CPU difference: 32941.859375 / 39387.640625
products component :
Total MEMORY difference: 70530248 / 66603556
Total CPU difference: 10457.71875 / 11151.0625

There are no differences in images found by testdiff.
12Author
Please use branch CR25147_25282 for IR, rebased on #0025147 (resolving trivial merge conflict).
13Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Oct 10 11:10:44 2014 +0400

    Sync res/resource.h from src/resource.h
14Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
15Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
16Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records