MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0030600Open CASCADE[OCCT] OCCT:Visualizationpublic2019-03-22 14:202020-05-28 01:17
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeverityintegration request 
StatusverifiedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.5.0*Fixed in Version 
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
Attached Files

- Relationships
parent of 0031375verifiedkgv Open CASCADE Visualization, TKOpenGl - suppress warning on WebGL 1.0 
parent of 0031583verifiedbugmaster Open CASCADE Visualization, OpenGl_Context - load OpenGL ES 3.0 functions 

-  Notes
(0089559)
kgv (developer)
2019-12-15 18:16

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>
(0089590)
git (administrator)
2019-12-17 10:15

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
(0089594)
kgv (developer)
2019-12-17 11:22
edited on: 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.

(0089625)
git (administrator)
2019-12-18 18:10

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

(0089626)
git (administrator)
2019-12-18 18:10

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
(0089627)
mzernova (developer)
2019-12-18 18:11

The patch CR30600 is ready to review
(0089629)
kgv (developer)
2019-12-18 18:22

-      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.
(0089630)
kgv (developer)
2019-12-18 18:23

> Changed GLES2/gl2.h to GLES3/gl3.h
Please also document OpenGl_Window_1.mm changes within commit message.
(0089632)
kgv (developer)
2019-12-18 18:30

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.
(0089644)
git (administrator)
2019-12-19 10:53

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.

(0089645)
git (administrator)
2019-12-19 10:53

Branch CR30600_1 has been updated forcibly by mzernova.

SHA-1: a981817f500b3d08ae7d13c42259903e3b3628a0
(0089646)
mzernova (developer)
2019-12-19 10:54

The patch CR30600 is ready to review
(0089672)
bugmaster (administrator)
2019-12-20 13:45

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
(0089690)
git (administrator)
2019-12-22 11:09

Branch CR30600_1 has been deleted by inv.

SHA-1: a981817f500b3d08ae7d13c42259903e3b3628a0
(0089691)
git (administrator)
2019-12-22 11:09

Branch CR30600 has been deleted by inv.

SHA-1: f88938bf8dc238dae8eb42c008b019b4a0cc597e

- Related Changesets
occt: master c68c346d
Timestamp: 2019-12-10 11:39:56
Author: 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.
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 14:20 kgv Relationship added related to 0030505
2019-03-22 15:06 kgv Description Updated View Revisions
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 15:25 kgv Relationship added related to 0031230
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 View Revisions
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


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker