View Issue Details

IDProjectCategoryView StatusLast Update
0030600Open CASCADEOCCT:Visualizationpublic2021-12-07 12:13
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityintegration request 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0030600: Visualization, TKOpenGl - include GLES3/gl3.h instead of GLES2/gl2.h
DescriptionOpenGl_GlFunctions.hxx currently includes GLES2/gl2.h header for compatibility with old Android/iOS devices. This leads to extra bloating re-definitions for using GLES3 functionality.

// include main OpenGL header provided with system
#if defined(__APPLE__)
  #import <TargetConditionals.h>
  #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
    #include <OpenGLES/ES2/gl.h>
  #else
    #include <OpenGL/gl.h>
  #endif
  #define __X_GL_H // prevent chaotic gl.h inclusions to avoid compile errors
#elif defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
  #if defined(_WIN32)
    // Angle OpenGL ES headers do not define function prototypes even for core functions,
    // however OCCT is expected to be linked against libGLESv2
    #define GL_GLEXT_PROTOTYPES
  #endif
  #include <GLES2/gl2.h>
  //#include <GLES3/gl3.h>
#else
  #include <GL/gl.h>
#endif


It is proposed to use GLES3/gl3.h and remove extra macros, but at the same time remain linking to libGLESv2.so, so that only header files will be actually needed for building.
This should work transparently for newer Android NDK (like android-ndk-r16b), where header files are now shared across all versions, but on older NDKs (like android-ndk-r12), this would require building for at least Android 19+ (or hacking earlier Android headers by copying GLES3).

The same should apply to iOS target [OpenGLES/ES3/gl.h].
Note that OpenGl_Window_1.mm should be also updated to try creating kEAGLRenderingAPIOpenGLES3 and then fallback to kEAGLRenderingAPIOpenGLES2:
    aGLContext = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot required

Relationships

parent of 0031375 closedkgv Open CASCADE Visualization, TKOpenGl - suppress warning on WebGL 1.0 
parent of 0031583 closedbugmaster Open CASCADE Visualization, OpenGl_Context - load OpenGL ES 3.0 functions 
related to 0032713 closedsmoskvin Open CASCADE Visualization, OpenGl_GlFunctions - unify OpenGL and OpenGL ES function lists 

Activities

kgv

2019-12-15 18:16

developer   ~0089559

Please also remove #ifdef from OpenGl_TextureFormat.hxx, as OpenGL ES 3 supports these texture types (necessary for #0031230).
//! Only unsigned formats are available in OpenGL ES 2.0
#if !defined(GL_ES_VERSION_2_0)
//! Specialization for signed byte.
template<> struct OpenGl_TextureFormatSelector<GLbyte>

git

2019-12-17 10:15

administrator   ~0089590

Branch CR30600 has been created by mzernova.

SHA-1: 68e02d633ee13cbc7153e5ece52b156a52fb606f


Detailed log of new commits:

Author: mzernova
Date: Tue Dec 10 14:39:56 2019 +0300

    0030600: Visualization, TKOpenGl - include GLES3/gl3.h instead of GLES2/gl2.h
    
    Changed GLES2/gl2.h to GLES3/gl3.h

kgv

2019-12-17 11:22

developer   ~0089594

Last edited: 2019-12-17 11:23

--- a/src/OpenGl/OpenGl_TextureFormat.hxx
+++ b/src/OpenGl/OpenGl_TextureFormat.hxx
-//! Only unsigned formats are available in OpenGL ES 2.0
-#if !defined(GL_ES_VERSION_2_0)
-//! Specialization for signed byte.

It is necessary removing #ifdef checks, not the code itself.

--- a/src/OpenGl/OpenGl_GlFunctions.hxx
+++ b/src/OpenGl/OpenGl_GlFunctions.hxx

The block below within the file:
  68 #if defined(GL_ES_VERSION_2_0)
  69   // define items to unify code paths with desktop OpenGL
  70   typedef double GLdouble;
  71   typedef double GLclampd;
  72   typedef uint64_t GLuint64;
  73   #define GL_NONE 0
  74 
  75   // OpenGL ES 3.0+ or GL_OES_element_index_uint extension
  76   #define GL_UNSIGNED_INT 0x1405
...

should be also cleaned out from no more needed defines.
Most can be safely removed with some exceptions like GLdouble.
You can try removing all of them and check for compilation errors.

git

2019-12-18 18:10

administrator   ~0089625

Branch CR30600 has been updated by mzernova.

SHA-1: 339e8abce5be6e15c044c6127d6e20b82c94c7a0


Detailed log of new commits:

Author: mzernova
Date: Wed Dec 18 18:06:28 2019 +0300

    remarks from kgv

git

2019-12-18 18:10

administrator   ~0089626

Branch CR30600_1 has been created by mzernova.

SHA-1: d38c6ff3f379332d0dad7fa868725895b901a2f0


Detailed log of new commits:

Author: mzernova
Date: Tue Dec 10 14:39:56 2019 +0300

    0030600: Visualization, TKOpenGl - include GLES3/gl3.h instead of GLES2/gl2.h
    
    Changed GLES2/gl2.h to GLES3/gl3.h

mzernova

2019-12-18 18:11

developer   ~0089627

The patch CR30600 is ready to review

kgv

2019-12-18 18:22

developer   ~0089629

-      case 1:  return GL_R8_SNORM;
-      case 2:  return GL_RG8_SNORM;
-      case 3:  return GL_RGB8_SNORM;
-      case 4:  return GL_RGBA8_SNORM;
-      default: return GL_NONE;
+    case 1:  return GL_R8_SNORM;
+    case 2:  return GL_RG8_SNORM;
+    case 3:  return GL_RGB8_SNORM;
+    case 4:  return GL_RGBA8_SNORM;
+    default: return GL_NONE;

Please revert unrelated formatting changes.

kgv

2019-12-18 18:23

developer   ~0089630

> Changed GLES2/gl2.h to GLES3/gl3.h
Please also document OpenGl_Window_1.mm changes within commit message.

kgv

2019-12-18 18:30

developer   ~0089632

Please also change within dox/dev_guides/building/android/android.md
  -DCMAKE_SYSTEM_VERSION=15
with
  -DCMAKE_SYSTEM_VERSION=21
for building using old Android NDK.

git

2019-12-19 10:53

administrator   ~0089644

Branch CR30600 has been updated by mzernova.

SHA-1: f88938bf8dc238dae8eb42c008b019b4a0cc597e


Detailed log of new commits:

Author: mzernova
Date: Thu Dec 19 10:45:34 2019 +0300

    OpenGl_Window_1.mm has been updated, now it is trying to create kEAGLRenderingAPIOpenGLES3 before trying to create kEAGLRenderingAPIOpenGLES2.

git

2019-12-19 10:53

administrator   ~0089645

Branch CR30600_1 has been updated forcibly by mzernova.

SHA-1: a981817f500b3d08ae7d13c42259903e3b3628a0

mzernova

2019-12-19 10:54

developer   ~0089646

The patch CR30600 is ready to review

bugmaster

2019-12-20 13:45

administrator   ~0089672

Combination -
OCCT branch : WEEK-51
master SHA - 9504a30d153b3281750b1a1ce56ae15317160032
48c80365a5ee43eb35cde01737ce3b9b92fa554e
Products branch : WEEK-51 SHA - 99f80f7455973d51db9d36558d69941712fdd853
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16954.910000000098 / 16976.290000000114 [-0.13%]
Products
Total CPU difference: 10728.550000000081 / 10746.800000000061 [-0.17%]
Windows-64-VC14:
OCCT
Total CPU difference: 18408.234375 / 18406.625 [+0.01%]
Products
Total CPU difference: 12716.875 / 12757.328125 [-0.32%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2019-12-22 11:09

administrator   ~0089690

Branch CR30600_1 has been deleted by inv.

SHA-1: a981817f500b3d08ae7d13c42259903e3b3628a0

git

2019-12-22 11:09

administrator   ~0089691

Branch CR30600 has been deleted by inv.

SHA-1: f88938bf8dc238dae8eb42c008b019b4a0cc597e

Related Changesets

occt: master c68c346d

2019-12-10 11:39:56

mzernova


Committer: bugmaster Details Diff
0030600: Visualization, TKOpenGl - include GLES3/gl3.h instead of GLES2/gl2.h

Changed GLES2/gl2.h to GLES3/gl3.h.

OpenGl_Window_1.mm has been updated, now it is trying to create kEAGLRenderingAPIOpenGLES3 before trying to create kEAGLRenderingAPIOpenGLES2.
Affected Issues
0030600
mod - dox/dev_guides/building/android/android.md Diff File
mod - src/OpenGl/OpenGl_GlFunctions.hxx Diff File
mod - src/OpenGl/OpenGl_HaltonSampler.hxx Diff File
mod - src/OpenGl/OpenGl_TextureFormat.hxx Diff File
mod - src/OpenGl/OpenGl_Window_1.mm Diff File

Issue History

Date Modified Username Field Change
2019-03-22 14:20 kgv New Issue
2019-03-22 14:20 kgv Assigned To => kgv
2019-03-22 15:06 kgv Description Updated
2019-09-04 18:27 kgv Target Version 7.4.0 => 7.5.0
2019-11-18 17:16 kgv Assigned To kgv => mzernova
2019-11-18 17:16 kgv Status new => assigned
2019-12-15 18:16 kgv Note Added: 0089559
2019-12-17 10:15 git Note Added: 0089590
2019-12-17 11:22 kgv Note Added: 0089594
2019-12-17 11:23 kgv Note Edited: 0089594
2019-12-18 18:10 git Note Added: 0089625
2019-12-18 18:10 git Note Added: 0089626
2019-12-18 18:11 mzernova Note Added: 0089627
2019-12-18 18:11 mzernova Assigned To mzernova => kgv
2019-12-18 18:11 mzernova Status assigned => resolved
2019-12-18 18:22 kgv Note Added: 0089629
2019-12-18 18:22 kgv Assigned To kgv => mzernova
2019-12-18 18:22 kgv Status resolved => assigned
2019-12-18 18:23 kgv Note Added: 0089630
2019-12-18 18:30 kgv Note Added: 0089632
2019-12-19 10:53 git Note Added: 0089644
2019-12-19 10:53 git Note Added: 0089645
2019-12-19 10:54 mzernova Note Added: 0089646
2019-12-19 10:54 mzernova Assigned To mzernova => kgv
2019-12-19 10:54 mzernova Status assigned => resolved
2019-12-19 10:57 kgv Assigned To kgv => bugmaster
2019-12-19 10:57 kgv Status resolved => reviewed
2019-12-19 16:51 bugmaster Test case number => Not required
2019-12-20 13:45 bugmaster Note Added: 0089672
2019-12-20 13:45 bugmaster Status reviewed => tested
2019-12-22 11:04 bugmaster Changeset attached => occt master c68c346d
2019-12-22 11:04 bugmaster Status tested => verified
2019-12-22 11:04 bugmaster Resolution open => fixed
2019-12-22 11:09 git Note Added: 0089690
2019-12-22 11:09 git Note Added: 0089691
2020-02-17 12:46 kgv Relationship added parent of 0031375
2020-05-28 01:17 kgv Relationship added parent of 0031583
2020-12-02 16:40 emo Fixed in Version => 7.5.0
2020-12-02 17:11 emo Status verified => closed
2021-12-07 12:13 kgv Relationship added related to 0032713