Updated BlackBerry references to make note of the change from FREEGLUT_GLES2/1 to FREEGLUT_GLES.
Updated BlackBerry toolchain to support building with Dinkum and to support OS 10.3 and GCC 4.8.2 Updated BlackBerry fg_window_blackberry so that window usages aren't hardcoded based on compile information, since it is now controlled by glutInitContextVersion. EGL window setup now supports EGL 1.5, Renderable type for ES3, and using the minor version from glutInitContextVersion to have more exact control over which version of OpenGL ES is used (requires EGL 1.5)
This commit is contained in:
parent
d11c062c72
commit
2dab5a32a6
@ -6,7 +6,7 @@
|
||||
# $ source /absolute/path/to/the/bbndk/bbndk-env.sh
|
||||
# $ mkdir build
|
||||
# $ cd build
|
||||
# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# $ make -j8
|
||||
#
|
||||
# Usage Mac:
|
||||
@ -16,6 +16,8 @@
|
||||
# > /absolute/path/to/the/bbndk/bbndk-env.bat
|
||||
# > mkdir build
|
||||
# > cd build
|
||||
# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# > make -j8
|
||||
#
|
||||
|
||||
To change which version of OpenGL to use, call glutInitContextVersion(1, 0) for OpenGL ES 1.x, glutInitContextVersion(2, 0) for OpenGL ES 2.0, or glutInitContextVersion(3, 0) for OpenGL ES 3.0.
|
@ -6,7 +6,7 @@
|
||||
# $ source /absolute/path/to/the/bbndk/bbndk-env.sh
|
||||
# $ mkdir build
|
||||
# $ cd build
|
||||
# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# $ make -j8
|
||||
#
|
||||
# Usage Mac:
|
||||
@ -16,7 +16,7 @@
|
||||
# > /absolute/path/to/the/bbndk/bbndk-env.bat
|
||||
# > mkdir build
|
||||
# > cd build
|
||||
# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles"
|
||||
# > make -j8
|
||||
#
|
||||
|
||||
@ -37,6 +37,11 @@ if( EXISTS "${BLACKBERRY_TARGET_ROOT}/x86/lib/gcc/4.4.2" )
|
||||
set( PLAYBOOK True )
|
||||
endif()
|
||||
|
||||
# Check for for GCC 4.8.2
|
||||
if( EXISTS "${BLACKBERRY_TARGET_ROOT}/x86/lib/gcc/4.8.2" )
|
||||
set( BB_GCC_482 True )
|
||||
endif()
|
||||
|
||||
# STL version: by default gnustl_static will be used
|
||||
set( BLACKBERRY_USE_STLPORT FALSE CACHE BOOL "Experimental: use stlport_static instead of gnustl_static")
|
||||
mark_as_advanced( BLACKBERRY_USE_STLPORT )
|
||||
@ -103,28 +108,52 @@ else()
|
||||
endif()
|
||||
|
||||
# Flags and preprocessor definitions
|
||||
set( BB_USING_GCC_482 False )
|
||||
if( PLAYBOOK )
|
||||
set( BLACKBERRY_COMP_DEF "-D__PLAYBOOK__" )
|
||||
set( BLACKBERRY_COMP_VERSION "4.4.2" )
|
||||
else()
|
||||
set( BLACKBERRY_COMP_DEF "-D__QNX__" )
|
||||
if( BB_GCC_482 AND BLACKBERRY_USE_GCC_4_8 )
|
||||
set( BLACKBERRY_COMP_VERSION "4.8.2" )
|
||||
set( BB_USING_GCC_482 True )
|
||||
else()
|
||||
set( BLACKBERRY_COMP_VERSION "4.6.3" )
|
||||
endif()
|
||||
endif()
|
||||
if( BLACKBERRY_ARCHITECTURE STREQUAL "arm" )
|
||||
if( PLAYBOOK )
|
||||
set( BLACKBERRY_CC_FLAGS " -V4.4.2,gcc_ntoarmv7le -D__PLAYBOOK__" )
|
||||
set( BLACKBERRY_CXX_FLAGS " -V4.4.2,gcc_ntoarmv7le -Y_gpp -D__PLAYBOOK__" )
|
||||
set( BLACKBERRY_COMP_TARGET "gcc_ntoarmv7le" )
|
||||
else()
|
||||
set( BLACKBERRY_CC_FLAGS " -V4.6.3,gcc_ntoarmv7le -D__QNX__" )
|
||||
set( BLACKBERRY_CXX_FLAGS " -V4.6.3,gcc_ntoarmv7le -Y_gpp -D__QNX__" )
|
||||
set( BLACKBERRY_COMP_TARGET "gcc_ntox86" )
|
||||
endif()
|
||||
set( BLACKBERRY_CXX_COMP_LIB "" )
|
||||
if( BLACKBERRY_DINKUM )
|
||||
set( DINKUM 1 )
|
||||
if( BB_USING_GCC_482 )
|
||||
set( BLACKBERRY_COMP_TARGET "${BLACKBERRY_COMP_TARGET}_cpp" )
|
||||
else()
|
||||
set( BLACKBERRY_CXX_COMP_LIB "-Y_cpp" )
|
||||
endif()
|
||||
else()
|
||||
if( PLAYBOOK )
|
||||
set( BLACKBERRY_CC_FLAGS " -V4.4.2,gcc_ntox86 -D__PLAYBOOK__" )
|
||||
set( BLACKBERRY_CXX_FLAGS " -V4.4.2,gcc_ntox86 -Y_gpp -D__PLAYBOOK__" )
|
||||
set( DINKUM 0 )
|
||||
if( BB_USING_GCC_482 )
|
||||
set( BLACKBERRY_COMP_TARGET "${BLACKBERRY_COMP_TARGET}_gpp" )
|
||||
else()
|
||||
set( BLACKBERRY_CC_FLAGS " -V4.6.3,gcc_ntox86 -D__QNX__" )
|
||||
set( BLACKBERRY_CXX_FLAGS " -V4.6.3,gcc_ntox86 -Y_gpp -D__QNX__" )
|
||||
set( BLACKBERRY_CXX_COMP_LIB "-Y_gpp" )
|
||||
endif()
|
||||
endif()
|
||||
set( BLACKBERRY_CC_FLAGS " -V${BLACKBERRY_COMP_VERSION},${BLACKBERRY_COMP_TARGET} ${BLACKBERRY_COMP_DEF}" )
|
||||
set( BLACKBERRY_CXX_FLAGS " -V${BLACKBERRY_COMP_VERSION},${BLACKBERRY_COMP_TARGET} ${BLACKBERRY_CXX_COMP_LIB} ${BLACKBERRY_COMP_DEF}" )
|
||||
set( BLACKBERRY 1 )
|
||||
|
||||
# NDK flags
|
||||
if( DINKUM )
|
||||
set( CMAKE_CXX_FLAGS "${BLACKBERRY_CXX_FLAGS} -DBLACKBERRY_DINKUM=1" )
|
||||
set( CMAKE_C_FLAGS "${BLACKBERRY_CC_FLAGS} -DBLACKBERRY_DINKUM=1" )
|
||||
else()
|
||||
set( CMAKE_CXX_FLAGS "${BLACKBERRY_CXX_FLAGS}" )
|
||||
set( CMAKE_C_FLAGS "${BLACKBERRY_CC_FLAGS}" )
|
||||
endif()
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" )
|
||||
|
||||
|
@ -69,11 +69,17 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
|
||||
|
||||
/* Set window properties */
|
||||
int orientation = atoi(getenv("ORIENTATION"));
|
||||
#ifdef GL_ES_VERSION_2_0
|
||||
int screenUsage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION;
|
||||
#elif GL_VERSION_ES_CM_1_0 || GL_VERSION_ES_CL_1_0 || GL_VERSION_ES_CM_1_1 || GL_VERSION_ES_CL_1_1
|
||||
int screenUsage = SCREEN_USAGE_OPENGL_ES1 | SCREEN_USAGE_ROTATION;
|
||||
int screenUsage = SCREEN_USAGE_ROTATION;
|
||||
#ifdef SCREEN_USAGE_OPENGL_ES3
|
||||
if (fgState.MajorVersion >= 3) {
|
||||
screenUsage |= SCREEN_USAGE_OPENGL_ES3;
|
||||
} else
|
||||
#endif
|
||||
if (fgState.MajorVersion >= 2) {
|
||||
screenUsage |= SCREEN_USAGE_OPENGL_ES2;
|
||||
} else {
|
||||
screenUsage |= SCREEN_USAGE_OPENGL_ES1;
|
||||
}
|
||||
#if !defined(__X86__) && !defined(__PLAYBOOK__)
|
||||
screenUsage |= SCREEN_USAGE_DISPLAY; // Physical device copy directly into physical display
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ void fghPlatformInitializeEGL()
|
||||
|
||||
FREEGLUT_INTERNAL_ERROR_EXIT(fgDisplay.pDisplay.egl.Display != EGL_NO_DISPLAY,
|
||||
"No display available", "fgPlatformInitialize");
|
||||
if (eglInitialize(fgDisplay.pDisplay.egl.Display, NULL, NULL) != EGL_TRUE)
|
||||
if (eglInitialize(fgDisplay.pDisplay.egl.Display, &fgDisplay.pDisplay.egl.MajorVersion, &fgDisplay.pDisplay.egl.MinorVersion) != EGL_TRUE)
|
||||
fgError("eglInitialize: error %x\n", eglGetError());
|
||||
|
||||
# ifdef GL_VERSION_1_1 /* or later */
|
||||
@ -59,6 +59,8 @@ void fghPlatformCloseDisplayEGL()
|
||||
if (fgDisplay.pDisplay.egl.Display != EGL_NO_DISPLAY) {
|
||||
eglTerminate(fgDisplay.pDisplay.egl.Display);
|
||||
fgDisplay.pDisplay.egl.Display = EGL_NO_DISPLAY;
|
||||
fgDisplay.pDisplay.egl.MajorVersion = 0;
|
||||
fgDisplay.pDisplay.egl.MinorVersion = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@ struct tagSFG_PlatformDisplayEGL
|
||||
{
|
||||
/* Used to initialize and deinitialize EGL */
|
||||
EGLDisplay Display;
|
||||
EGLint MajorVersion;
|
||||
EGLint MinorVersion;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,11 +30,16 @@ int fghChooseConfig(EGLConfig* config) {
|
||||
EGLint attributes[32];
|
||||
int where = 0;
|
||||
ATTRIB_VAL(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
|
||||
#ifdef EGL_OPENGL_ES3_BIT
|
||||
if (fgDisplay.pDisplay.egl.MinorVersion >= 5 && fgState.MajorVersion >= 3) {
|
||||
ATTRIB_VAL(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT);
|
||||
} else
|
||||
#endif
|
||||
if (fgState.MajorVersion >= 2) {
|
||||
/*
|
||||
* Khronos does not specify a EGL_OPENGL_ES3_BIT outside of the OpenGL extension "EGL_KHR_create_context". There are numerous references on the internet that
|
||||
* say to use EGL_OPENGL_ES3_BIT, followed by many saying they can't find it in any headers. In fact, the offical updated specification for EGL does not have
|
||||
* any references to OpenGL ES 3.0. Tests have shown that EGL_OPENGL_ES2_BIT will work with ES 3.0.
|
||||
* Khronos does not specify a EGL_OPENGL_ES3_BIT outside of the OpenGL extension "EGL_KHR_create_context" and EGL 1.5. There are numerous references on the internet
|
||||
* that say to use EGL_OPENGL_ES3_BIT (pre-EGL 1.5), followed by many saying they can't find it in any headers. In fact, the offical updated specification for EGL
|
||||
* does not have any references to OpenGL ES 3.x. Tests have shown that EGL_OPENGL_ES2_BIT will work with ES 3.x.
|
||||
*/
|
||||
ATTRIB_VAL(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
|
||||
} else {
|
||||
@ -87,6 +92,12 @@ EGLContext fghCreateNewContextEGL( SFG_Window* window ) {
|
||||
EGLint attributes[32];
|
||||
int where = 0;
|
||||
ATTRIB_VAL(EGL_CONTEXT_CLIENT_VERSION, fgState.MajorVersion);
|
||||
#ifdef EGL_CONTEXT_MINOR_VERSION
|
||||
if (fgDisplay.pDisplay.egl.MinorVersion >= 5) {
|
||||
// EGL_CONTEXT_CLIENT_VERSION == EGL_CONTEXT_MAJOR_VERSION
|
||||
ATTRIB_VAL(EGL_CONTEXT_MINOR_VERSION, fgState.MinorVersion);
|
||||
}
|
||||
#endif
|
||||
ATTRIB(EGL_NONE);
|
||||
|
||||
context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attributes);
|
||||
@ -96,8 +107,17 @@ EGLContext fghCreateNewContextEGL( SFG_Window* window ) {
|
||||
}
|
||||
|
||||
eglQueryContext(fgDisplay.pDisplay.egl.Display, context, EGL_CONTEXT_CLIENT_VERSION, &ver);
|
||||
if (ver != fgState.MajorVersion)
|
||||
if (ver != fgState.MajorVersion) {
|
||||
fgError("Wrong GLES major version: %d\n", ver);
|
||||
}
|
||||
#ifdef EGL_CONTEXT_MINOR_VERSION
|
||||
if (fgDisplay.pDisplay.egl.MinorVersion >= 5) {
|
||||
eglQueryContext(fgDisplay.pDisplay.egl.Display, context, EGL_CONTEXT_MINOR_VERSION, &ver);
|
||||
if (ver != fgState.MinorVersion) {
|
||||
fgError("Wrong GLES minor version: %d\n", ver);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return context;
|
||||
}
|
||||
|
Reference in New Issue
Block a user