mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
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.
This commit is contained in:
parent
e2447a80ea
commit
c68c346d2b
@ -64,7 +64,7 @@ Then makefiles will appear in the build folder (e.g. <i> D:/occt/build-android <
|
||||
|
||||
Alternatively one may specify the values without a toolchain file:
|
||||
|
||||
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=15 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
|
||||
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
|
||||
|
||||
@figure{/dev_guides/building/android/images/android_image006.png}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
// macOS 10.4 deprecated OpenGL framework - suppress useless warnings
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl.h>
|
||||
#endif
|
||||
@ -60,8 +60,7 @@
|
||||
// however OCCT is expected to be linked against libGLESv2
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#endif
|
||||
#include <GLES2/gl2.h>
|
||||
//#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
@ -70,113 +69,44 @@
|
||||
// define items to unify code paths with desktop OpenGL
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef uint64_t GLuint64;
|
||||
#define GL_NONE 0
|
||||
|
||||
// OpenGL ES 3.0+ or GL_OES_element_index_uint extension
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
|
||||
// GL_EXT_sRGB_write_control extension for OpenGL ES
|
||||
// adds GL_FRAMEBUFFER_SRGB_EXT flag as on desktop OpenGL
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
|
||||
#define GL_TEXTURE_BASE_LEVEL 0x813C
|
||||
#define GL_TEXTURE_MAX_LEVEL 0x813D
|
||||
|
||||
// OpenGL ES 3.1+
|
||||
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
|
||||
#define GL_MAX_SAMPLES 0x8D57
|
||||
|
||||
// OpenGL ES 3.2+ or GL_EXT_texture_buffer for OpenGL ES 3.1+
|
||||
#define GL_TEXTURE_BUFFER 0x8C2A
|
||||
|
||||
// in core since OpenGL ES 3.0, extension GL_EXT_texture_rg
|
||||
#define GL_RED 0x1903
|
||||
#define GL_R8 0x8229
|
||||
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
|
||||
#define GL_RGB8 0x8051
|
||||
#define GL_RGBA8 0x8058
|
||||
#define GL_LUMINANCE8 0x8040
|
||||
#define GL_LUMINANCE8 0x8040
|
||||
// GL_EXT_texture_format_BGRA8888
|
||||
#define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop
|
||||
#define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop
|
||||
|
||||
#define GL_SRGB 0x8C40
|
||||
#define GL_SRGB8 0x8C41
|
||||
#define GL_SRGB8_ALPHA8 0x8C43
|
||||
#define GL_R16 0x822A
|
||||
#define GL_RGB4 0x804F
|
||||
#define GL_RGB5 0x8050
|
||||
#define GL_RGB10 0x8052
|
||||
#define GL_RGB12 0x8053
|
||||
#define GL_RGB16 0x8054
|
||||
#define GL_RGB10_A2 0x8059
|
||||
#define GL_RGBA12 0x805A
|
||||
#define GL_RGBA16 0x805B
|
||||
#define GL_ALPHA8 0x803C
|
||||
#define GL_ALPHA16 0x803E
|
||||
#define GL_RG16 0x822C
|
||||
|
||||
#define GL_R16 0x822A
|
||||
#define GL_R16F 0x822D
|
||||
#define GL_R32F 0x822E
|
||||
#define GL_RGB16F 0x881B
|
||||
#define GL_RGBA32F 0x8814
|
||||
#define GL_RGB32F 0x8815
|
||||
#define GL_RGBA16F 0x881A
|
||||
#define GL_RGB16F 0x881B
|
||||
#define GL_RGB4 0x804F
|
||||
#define GL_RGB5 0x8050
|
||||
#define GL_RGB8 0x8051
|
||||
#define GL_RGB10 0x8052
|
||||
#define GL_RGB12 0x8053
|
||||
#define GL_RGB16 0x8054
|
||||
#define GL_RGBA8 0x8058
|
||||
#define GL_RGB10_A2 0x8059
|
||||
#define GL_RGBA12 0x805A
|
||||
#define GL_RGBA16 0x805B
|
||||
#define GL_ALPHA8 0x803C
|
||||
#define GL_ALPHA16 0x803E
|
||||
#define GL_R16_SNORM 0x8F98
|
||||
#define GL_RG16_SNORM 0x8F99
|
||||
#define GL_RGB16_SNORM 0x8F9A
|
||||
#define GL_RGBA16_SNORM 0x8F9B
|
||||
|
||||
#define GL_RG 0x8227
|
||||
#define GL_RG8 0x822B
|
||||
#define GL_RG16 0x822C
|
||||
#define GL_RG16F 0x822F
|
||||
#define GL_RG32F 0x8230
|
||||
#define GL_RG_INTEGER 0x8228
|
||||
#define GL_RED_INTEGER 0x8D94
|
||||
|
||||
#define GL_R8I 0x8231
|
||||
#define GL_R8UI 0x8232
|
||||
#define GL_R16I 0x8233
|
||||
#define GL_R16UI 0x8234
|
||||
#define GL_R32I 0x8235
|
||||
#define GL_R32UI 0x8236
|
||||
#define GL_RG8I 0x8237
|
||||
#define GL_RG8UI 0x8238
|
||||
#define GL_RG16I 0x8239
|
||||
#define GL_RG16UI 0x823A
|
||||
#define GL_RG32I 0x823B
|
||||
#define GL_RG32UI 0x823C
|
||||
#define GL_RG8_SNORM 0x8F95
|
||||
#define GL_RGBA32UI 0x8D70
|
||||
#define GL_RGB32UI 0x8D71
|
||||
#define GL_RGBA16UI 0x8D76
|
||||
#define GL_RGB16UI 0x8D77
|
||||
#define GL_RGBA8UI 0x8D7C
|
||||
#define GL_RGB8UI 0x8D7D
|
||||
#define GL_RGBA32I 0x8D82
|
||||
#define GL_RGB32I 0x8D83
|
||||
#define GL_RGBA16I 0x8D88
|
||||
#define GL_RGB16I 0x8D89
|
||||
#define GL_RGBA8I 0x8D8E
|
||||
#define GL_RGB8I 0x8D8F
|
||||
|
||||
// GL_OES_packed_depth_stencil
|
||||
#define GL_DEPTH_STENCIL 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8 0x88F0
|
||||
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
|
||||
|
||||
// OpenGL ES 3.0+
|
||||
#define GL_DEPTH_COMPONENT24 0x81A6
|
||||
#define GL_DEPTH_COMPONENT32F 0x8CAC
|
||||
#define GL_DEPTH32F_STENCIL8 0x8CAD
|
||||
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
|
||||
|
||||
#define GL_READ_FRAMEBUFFER 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER 0x8CA9
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
|
||||
|
||||
#define GL_TEXTURE_3D 0x806F
|
||||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_RED_SNORM 0x8F90
|
||||
#define GL_RG_SNORM 0x8F91
|
||||
#define GL_RGB_SNORM 0x8F92
|
||||
#define GL_RGBA_SNORM 0x8F93
|
||||
|
||||
// GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
@ -207,12 +137,7 @@
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
|
||||
// GL_ARB_draw_buffers (GL_EXT_draw_buffers) extension
|
||||
#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
|
||||
#define GL_MAX_DRAW_BUFFERS 0x8824
|
||||
|
||||
// OpenGL ES 3.0+ or OES_texture_half_float
|
||||
#define GL_HALF_FLOAT 0x140B
|
||||
#define GL_HALF_FLOAT_OES 0x8D61
|
||||
|
||||
// OpenGL ES 3.1+
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
return (myPerm3[theIndex % 243u] * 14348907u
|
||||
+ myPerm3[(theIndex / 243u) % 243u] * 59049u
|
||||
+ myPerm3[(theIndex / 59049u) % 243u] * 243u
|
||||
+ myPerm3[(theIndex / 14348907u) % 243u]) * float(0.999999999999999f / 3486784401u); // Results in [0,1).
|
||||
+ myPerm3[(theIndex / 14348907u) % 243u]) * float(0.999999999999999 / 3486784401u); // Results in [0,1).
|
||||
}
|
||||
|
||||
float halton5 (unsigned theIndex) const
|
||||
@ -112,7 +112,7 @@ private:
|
||||
return (myPerm5[theIndex % 125u] * 1953125u
|
||||
+ myPerm5[(theIndex / 125u) % 125u] * 15625u
|
||||
+ myPerm5[(theIndex / 15625u) % 125u] * 125u
|
||||
+ myPerm5[(theIndex / 1953125u) % 125u]) * float(0.999999999999999f / 244140625u); // Results in [0,1).
|
||||
+ myPerm5[(theIndex / 1953125u) % 125u]) * float(0.999999999999999 / 244140625u); // Results in [0,1).
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -182,8 +182,6 @@ template<> struct OpenGl_TextureFormatSelector<GLuint>
|
||||
}
|
||||
};
|
||||
|
||||
//! 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>
|
||||
{
|
||||
@ -234,7 +232,6 @@ template<> struct OpenGl_TextureFormatSelector<GLint>
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// =======================================================================
|
||||
// function : Create
|
||||
|
@ -91,13 +91,19 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_GraphicDriver)& theDriver,
|
||||
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
|
||||
NULL];
|
||||
|
||||
aGLContext = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
|
||||
aGLContext = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES3];
|
||||
if (aGLContext == NULL
|
||||
|| ![EAGLContext setCurrentContext: aGLContext])
|
||||
{
|
||||
TCollection_AsciiString aMsg ("OpenGl_Window::CreateWindow: EAGLContext creation failed");
|
||||
throw Aspect_GraphicDeviceDefinitionError(aMsg.ToCString());
|
||||
return;
|
||||
aGLContext = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
|
||||
|
||||
if (aGLContext == NULL
|
||||
|| ![EAGLContext setCurrentContext: aGLContext])
|
||||
{
|
||||
TCollection_AsciiString aMsg ("OpenGl_Window::CreateWindow: EAGLContext creation failed");
|
||||
throw Aspect_GraphicDeviceDefinitionError(aMsg.ToCString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myGlContext->Init (aGLContext, Standard_False);
|
||||
|
Loading…
x
Reference in New Issue
Block a user