Initial linux version.

Currently works only with irrlicht-based renderer because shaders are not ported yet.
This commit is contained in:
Deve 2016-06-24 02:47:13 +02:00
parent 416edef95d
commit d13716a917
35 changed files with 980 additions and 632 deletions

View File

@ -19,6 +19,7 @@ option(USE_FRIBIDI "Support for right-to-left languages" ON)
option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
option(ENABLE_NETWORK_MULTIPLAYER "Enable network multiplayer. This will replace the online profile GUI in the main menu with the network multiplayer GUI" OFF)
option(USE_GLES2 "Use OpenGL ES2 renderer" ON)
if(MSVC AND (MSVC_VERSION LESS 1900))
# Normally hide the option to build wiiuse on VS, since it depends
@ -59,6 +60,10 @@ if(WIN32)
add_definitions(-D_IRR_STATIC_LIB_)
endif()
if(USE_GLES2)
add_definitions(-DUSE_GLES2)
endif()
# Build the Bullet physics library
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
@ -68,8 +73,10 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
# Build glew library
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
if(NOT USE_GLES2)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
endif()
if((WIN32 AND NOT MINGW) OR APPLE)
if (NOT APPLE)
@ -194,8 +201,10 @@ if (OPENMP_FOUND)
endif()
# OpenGL
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if(NOT USE_GLES2)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
@ -342,16 +351,20 @@ target_link_libraries(supertuxkart
bulletcollision
bulletmath
enet
glew
stkirrlicht
${Angelscript_LIBRARIES}
${CURL_LIBRARIES}
${OGGVORBIS_LIBRARIES}
${OPENAL_LIBRARY}
${OPENGL_LIBRARIES}
${FREETYPE_LIBRARIES}
)
if(NOT USE_GLES2)
target_link_libraries(supertuxkart ${OPENGL_LIBRARIES} glew)
else()
target_link_libraries(supertuxkart EGL GLESv2)
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(supertuxkart ${X11_LIBRARIES})
if(USE_XRANDR)

View File

@ -0,0 +1,142 @@
precision mediump float;
/* Definitions */
#define Solid 0
#define Solid2Layer 1
#define LightMap 2
#define DetailMap 3
#define SphereMap 4
#define Reflection2Layer 5
#define TransparentAlphaChannel 6
#define TransparentAlphaChannelRef 7
#define TransparentVertexAlpha 8
#define TransparentReflection2Layer 9
/* Uniforms */
uniform int uMaterialType;
uniform bool uTextureUsage0;
uniform bool uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
/* Varyings */
varying vec2 varTexCoord0;
varying vec2 varTexCoord1;
varying vec4 varVertexColor;
varying float varEyeDist;
vec4 renderSolid()
{
vec4 Color = varVertexColor;
if(uTextureUsage0)
Color *= texture2D(uTextureUnit0, varTexCoord0);
Color.a = 1.0;
return Color;
}
vec4 render2LayerSolid()
{
float BlendFactor = varVertexColor.a;
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0 * BlendFactor + Texel1 * (1.0 - BlendFactor);
return Color;
}
vec4 renderLightMap()
{
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0 * Texel1 * 4.0;
Color.a = Texel0.a * Texel0.a;
return Color;
}
vec4 renderDetailMap()
{
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0;
Color += Texel1 - 0.5;
return Color;
}
vec4 renderReflection2Layer()
{
vec4 Color = varVertexColor;
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
Color *= Texel0 * Texel1;
return Color;
}
vec4 renderTransparent()
{
vec4 Color = vec4(1.0, 1.0, 1.0, 1.0);
if(uTextureUsage0)
Color *= texture2D(uTextureUnit0, varTexCoord0);
return Color;
}
void main ()
{
if (uMaterialType == Solid)
gl_FragColor = renderSolid();
else if(uMaterialType == Solid2Layer)
gl_FragColor = render2LayerSolid();
else if(uMaterialType == LightMap)
gl_FragColor = renderLightMap();
else if(uMaterialType == DetailMap)
gl_FragColor = renderDetailMap();
else if(uMaterialType == SphereMap)
gl_FragColor = renderSolid();
else if(uMaterialType == Reflection2Layer)
gl_FragColor = renderReflection2Layer();
else if(uMaterialType == TransparentAlphaChannel)
gl_FragColor = renderTransparent();
else if(uMaterialType == TransparentAlphaChannelRef)
{
vec4 Color = renderTransparent();
if (Color.a < 0.5)
discard;
gl_FragColor = Color;
}
else if(uMaterialType == TransparentVertexAlpha)
{
vec4 Color = renderTransparent();
Color.a = varVertexColor.a;
gl_FragColor = Color;
}
else if(uMaterialType == TransparentReflection2Layer)
{
vec4 Color = renderReflection2Layer();
Color.a = varVertexColor.a;
gl_FragColor = Color;
}
else
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}

View File

@ -0,0 +1,36 @@
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
attribute vec2 inTexCoord1;
/* Uniforms */
uniform int uMaterialType;
uniform mat4 uMvpMatrix;
uniform mat4 uTextureMatrix0;
uniform mat4 uTextureMatrix1;
/* Varyings */
varying vec2 varTexCoord0;
varying vec2 varTexCoord1;
varying vec4 varVertexColor;
varying float varEyeDist;
void main(void)
{
gl_Position = uMvpMatrix * vec4(inVertexPosition,1.0);
vec4 TexCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 0.0, 0.0);
varTexCoord0 = vec4(uTextureMatrix0 * TexCoord0).xy;
vec4 TexCoord1 = vec4(inTexCoord1.x, inTexCoord1.y, 0.0, 0.0);
varTexCoord1 = vec4(uTextureMatrix1 * TexCoord1).xy;
varVertexColor = inVertexColor.zyxw;
}

View File

@ -0,0 +1,36 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
precision mediump float;
uniform sampler2D texture0;
uniform sampler2D texture1;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec4 debug;
void main(void)
{
// fetch color and normal map
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
vec4 colorMap = texture2D(texture0, varTexCoord.xy);
// calculate color of light 0
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
// calculate color of light 1
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
//luminance * base color
color *= colorMap;
color.a = varLightColor[0].a;
gl_FragColor = color;
}

View File

@ -0,0 +1,69 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec4 inTexCoord0;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
uniform mat4 uMvpMatrix;
uniform vec4 uLightPos[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec4 debug;
void main(void)
{
debug = vec4(inVertexNormal, 1.0);
// transform position to clip space
gl_Position = uMvpMatrix * inVertexPosition;
// vertex - lightpositions
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
// transform the light vector 1 with U, V, W
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
// transform the light vector 2 with U, V, W
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
// calculate attenuation of light 0
varLightColor[0].w = 0.0;
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
varLightColor[0].x *= uLightColor[0].w;
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
varLightColor[0] *= uLightColor[0];
// normalize light vector 0
varLightVector[0] = normalize(varLightVector[0]);
// calculate attenuation of light 1
varLightColor[1].w = 0.0;
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
varLightColor[1].x *= uLightColor[1].w;
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
varLightColor[1] *= uLightColor[1];
// normalize light vector 1
varLightVector[1] = normalize(varLightVector[1]);
// move out texture coordinates and original alpha value
varTexCoord = inTexCoord0;
varLightColor[0].a = inVertexColor.a;
}

View File

@ -0,0 +1,49 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
precision mediump float;
uniform sampler2D texture0;
uniform sampler2D texture1;
//uniform vec4 uLightDiffuse[MAX_LIGHTS];
uniform float uHeightScale;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec3 varEyeVector;
varying vec4 debug;
void main(void)
{
// fetch color and normal map
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
// height = height * scale
normalMap *= uHeightScale;
// calculate new texture coord: height * eye + oldTexCoord
vec2 offset = varEyeVector.xy * normalMap.w + varTexCoord.xy;
// fetch new textures
vec4 colorMap = texture2D(texture0, offset);
normalMap = normalize(texture2D(texture1, offset) * 2.0 - 1.0);
// calculate color of light 0
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
// calculate color of light 1
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
//luminance * base color
color *= colorMap;
color.a = varLightColor[0].a;
gl_FragColor = color;
}

View File

@ -0,0 +1,81 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec4 inTexCoord0;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
uniform mat4 uMvpMatrix;
uniform vec4 uLightPos[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
uniform vec3 uEyePos;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec3 varEyeVector;
varying vec4 debug;
void main(void)
{
debug = vec4(inVertexNormal, 1.0);
// transform position to clip space
gl_Position = uMvpMatrix * inVertexPosition;
// vertex - lightpositions
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
// eye vector
vec4 Temp = vec4(uEyePos, 1.0) - inVertexPosition;
// transform the light vector 1 with U, V, W
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
// transform the light vector 2 with U, V, W
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
// transform the eye vector with U, V, W
varEyeVector.x = dot(inVertexTangent, Temp.xyz);
varEyeVector.y = dot(inVertexBinormal, Temp.xyz);
varEyeVector.z = dot(inVertexNormal, Temp.xyz);
varEyeVector *= vec3(1.0,-1.0, -1.0);
varEyeVector = normalize(varEyeVector);
// calculate attenuation of light 0
varLightColor[0].w = 0.0;
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
varLightColor[0].x *= uLightColor[0].w;
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
varLightColor[0] *= uLightColor[0];
// normalize light vector 0
varLightVector[0] = normalize(varLightVector[0]);
// calculate attenuation of light 1
varLightColor[1].w = 0.0;
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
varLightColor[1].x *= uLightColor[1].w;
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
varLightColor[1] *= uLightColor[1];
// normalize light vector 1
varLightVector[1] = normalize(varLightVector[1]);
// move out texture coordinates and original alpha value
varTexCoord = inTexCoord0;
varLightColor[0].a = inVertexColor.a;
}

View File

@ -0,0 +1,23 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
precision mediump float;
uniform bool uUseTexture;
uniform sampler2D uTextureUnit;
varying vec4 vVertexColor;
varying vec2 vTexCoord;
void main(void)
{
vec4 Color = vVertexColor;
if(uUseTexture)
Color *= texture2D(uTextureUnit, vTexCoord);
gl_FragColor = Color;
}

View File

@ -0,0 +1,21 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
uniform mat4 uOrthoMatrix;
varying vec4 vVertexColor;
varying vec2 vTexCoord;
void main(void)
{
gl_Position = uOrthoMatrix * inVertexPosition;
vVertexColor = inVertexColor.bgra;
vTexCoord = inTexCoord0;
}

View File

@ -8,8 +8,10 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${ZLIB_INCLUDE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/../zlib/") # For zconf.h on WIN32
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if(NOT USE_GLES2)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(APPLE)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht")
@ -35,6 +37,10 @@ else()
endif()
endif()
if(USE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_ -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DNO_IRR_COMPILE_WITH_OGLES1_ -DNO_IRR_COMPILE_WITH_OPENGL_ -DNO_IRR_USE_NON_SYSTEM_JPEG_LIB_ -DNO_IRR_USE_NON_SYSTEM_LIB_PNG_ -DNO_IRR_USE_NON_SYSTEM_ZLIB_)
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
add_definitions(-DNO_IRR_LINUX_X11_VIDMODE_)
@ -45,446 +51,145 @@ if(CYGWIN)
add_definitions(-DNO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
endif()
set(IRRLICHT_SOURCES
source/Irrlicht/CGUIListBox.cpp
source/Irrlicht/CZBuffer.cpp
source/Irrlicht/CGUIModalScreen.cpp
source/Irrlicht/CParticleCylinderEmitter.cpp
source/Irrlicht/CLimitReadFile.cpp
source/Irrlicht/CVideoModeList.cpp
source/Irrlicht/CDefaultGUIElementFactory.cpp
source/Irrlicht/CCubeSceneNode.cpp
source/Irrlicht/CGUIMeshViewer.cpp
source/Irrlicht/CParticleSphereEmitter.cpp
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
source/Irrlicht/CGUITabControl.cpp
source/Irrlicht/CGUIToolBar.cpp
source/Irrlicht/CTerrainTriangleSelector.cpp
source/Irrlicht/CFileSystem.cpp
source/Irrlicht/CTerrainSceneNode.cpp
source/Irrlicht/os.cpp
source/Irrlicht/CFPSCounter.cpp
source/Irrlicht/CGUIContextMenu.cpp
source/Irrlicht/CImageWriterJPG.cpp
source/Irrlicht/CZipReader.cpp
source/Irrlicht/CImageLoaderPNG.cpp
source/Irrlicht/CImageLoaderBMP.cpp
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
source/Irrlicht/CSkyDomeSceneNode.cpp
source/Irrlicht/CGUIFileOpenDialog.cpp
source/Irrlicht/CGUISpriteBank.cpp
source/Irrlicht/CParticleFadeOutAffector.cpp
source/Irrlicht/CGUIMenu.cpp
source/Irrlicht/CSphereSceneNode.cpp
source/Irrlicht/CImageWriterPNG.cpp
source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
source/Irrlicht/CGUIMessageBox.cpp
source/Irrlicht/CParticleGravityAffector.cpp
source/Irrlicht/CGUISkin.cpp
source/Irrlicht/CBoneSceneNode.cpp
source/Irrlicht/COpenGLSLMaterialRenderer.cpp
source/Irrlicht/CParticleRotationAffector.cpp
source/Irrlicht/CGeometryCreator.cpp
source/Irrlicht/C3DSMeshFileLoader.cpp
source/Irrlicht/CParticleSystemSceneNode.cpp
source/Irrlicht/CSceneNodeAnimatorDelete.cpp
source/Irrlicht/CGUICheckBox.cpp
source/Irrlicht/COGLES2MaterialRenderer.cpp
source/Irrlicht/CGUIButton.cpp
source/Irrlicht/CAnimatedMeshSceneNode.cpp
source/Irrlicht/CSkinnedMesh.cpp
source/Irrlicht/CSceneNodeAnimatorTexture.cpp
source/Irrlicht/CParticleBoxEmitter.cpp
source/Irrlicht/CTriangleBBSelector.cpp
source/Irrlicht/CGUIComboBox.cpp
source/Irrlicht/CSceneNodeAnimatorTexture.cpp
source/Irrlicht/COpenGLTexture.cpp
source/Irrlicht/COctreeSceneNode.cpp
source/Irrlicht/CWaterSurfaceSceneNode.cpp
source/Irrlicht/CParticleAttractionAffector.cpp
source/Irrlicht/CMeshSceneNode.cpp
source/Irrlicht/CGUIScrollBar.cpp
source/Irrlicht/CAttributes.cpp
source/Irrlicht/CGUIStaticText.cpp
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
source/Irrlicht/CGUIFont.cpp
source/Irrlicht/CTriangleSelector.cpp
source/Irrlicht/CParticlePointEmitter.cpp
source/Irrlicht/CTextSceneNode.cpp
source/Irrlicht/CIrrDeviceLinux.cpp
source/Irrlicht/CIrrDeviceStub.cpp
source/Irrlicht/CGUIInOutFader.cpp
source/Irrlicht/CGUITreeView.cpp
source/Irrlicht/CAnimatedMeshSceneNode.cpp
source/Irrlicht/CGUICheckBox.cpp
source/Irrlicht/CGUIWindow.cpp
source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
source/Irrlicht/CGUIFileOpenDialog.cpp
source/Irrlicht/CLimitReadFile.cpp
source/Irrlicht/CParticleGravityAffector.cpp
source/Irrlicht/CGUIMeshViewer.cpp
source/Irrlicht/os.cpp
source/Irrlicht/CParticleCylinderEmitter.cpp
source/Irrlicht/COpenGLExtensionHandler.cpp
source/Irrlicht/CParticleRotationAffector.cpp
source/Irrlicht/COGLES2NormalMapRenderer.cpp
source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
source/Irrlicht/CColorConverter.cpp
source/Irrlicht/COpenGLParallaxMapRenderer.cpp
source/Irrlicht/CGUIImage.cpp
source/Irrlicht/CVideoModeList.cpp
source/Irrlicht/COctreeSceneNode.cpp
source/Irrlicht/COGLES2Texture.cpp
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
source/Irrlicht/CImageWriterBMP.cpp
source/Irrlicht/CMeshCache.cpp
source/Irrlicht/CIrrDeviceFB.cpp
source/Irrlicht/CMemoryFile.cpp
source/Irrlicht/CMountPointReader.cpp
source/Irrlicht/CBillboardSceneNode.cpp
source/Irrlicht/CGUIImageList.cpp
source/Irrlicht/CSceneCollisionManager.cpp
source/Irrlicht/CIrrDeviceWin32.cpp
source/Irrlicht/CEmptySceneNode.cpp
source/Irrlicht/CParticleBoxEmitter.cpp
source/Irrlicht/CParticleSystemSceneNode.cpp
source/Irrlicht/CIrrDeviceConsole.cpp
source/Irrlicht/CImage.cpp
source/Irrlicht/CTarReader.cpp
source/Irrlicht/CGUIButton.cpp
source/Irrlicht/COpenGLParallaxMapRenderer.cpp
source/Irrlicht/CGUIEditBox.cpp
source/Irrlicht/CLogger.cpp
source/Irrlicht/CMeshManipulator.cpp
source/Irrlicht/CLightSceneNode.cpp
source/Irrlicht/CSkyBoxSceneNode.cpp
source/Irrlicht/CWriteFile.cpp
source/Irrlicht/COctreeTriangleSelector.cpp
source/Irrlicht/CFileList.cpp
source/Irrlicht/CIrrDeviceSDL.cpp
source/Irrlicht/COSOperator.cpp
source/Irrlicht/CImageLoaderJPG.cpp
source/Irrlicht/COpenGLExtensionHandler.cpp
source/Irrlicht/CXMLWriter.cpp
source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
source/Irrlicht/CGUIColorSelectDialog.cpp
source/Irrlicht/CSceneManager.cpp
source/Irrlicht/Irrlicht.cpp
source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
source/Irrlicht/COpenGLDriver.cpp
source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
source/Irrlicht/irrXML.cpp
source/Irrlicht/CSkinnedMesh.cpp
source/Irrlicht/CXMLReader.cpp
source/Irrlicht/CDummyTransformationSceneNode.cpp
source/Irrlicht/CGUITable.cpp
source/Irrlicht/CB3DMeshFileLoader.cpp
source/Irrlicht/CGeometryCreator.cpp
source/Irrlicht/CNullDriver.cpp
source/Irrlicht/CCameraSceneNode.cpp
source/Irrlicht/CGUISpinBox.cpp
source/Irrlicht/CReadFile.cpp
source/Irrlicht/CParticleRingEmitter.cpp
source/Irrlicht/COctreeTriangleSelector.cpp
source/Irrlicht/CGUIMenu.cpp
source/Irrlicht/CMetaTriangleSelector.cpp
source/Irrlicht/CFileList.cpp
source/Irrlicht/CImageWriterJPG.cpp
source/Irrlicht/CImageLoaderJPG.cpp
source/Irrlicht/CParticlePointEmitter.cpp
source/Irrlicht/CTerrainTriangleSelector.cpp
source/Irrlicht/COGLES2FixedPipelineRenderer.cpp
source/Irrlicht/CAndroidAssetReader.cpp
source/Irrlicht/CIrrDeviceSDL.cpp
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
source/Irrlicht/COGLES2Renderer2D.cpp
source/Irrlicht/CGUIStaticText.cpp
source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
source/Irrlicht/CSceneManager.cpp
source/Irrlicht/CGUITreeView.cpp
source/Irrlicht/CDefaultGUIElementFactory.cpp
source/Irrlicht/CSceneCollisionManager.cpp
source/Irrlicht/CGUIInOutFader.cpp
source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
source/Irrlicht/CColorConverter.cpp
source/Irrlicht/CLogger.cpp
source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
source/Irrlicht/CGUIModalScreen.cpp
source/Irrlicht/CSkyDomeSceneNode.cpp
source/Irrlicht/CAndroidAssetFileArchive.cpp
source/Irrlicht/CGUITabControl.cpp
source/Irrlicht/CNullDriver.cpp
source/Irrlicht/CGUISpriteBank.cpp
source/Irrlicht/COGLES2Driver.cpp
source/Irrlicht/CLightSceneNode.cpp
source/Irrlicht/CBoneSceneNode.cpp
source/Irrlicht/CGUITable.cpp
source/Irrlicht/CParticleAttractionAffector.cpp
source/Irrlicht/CImage.cpp
source/Irrlicht/CB3DMeshFileLoader.cpp
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
source/Irrlicht/CGUIScrollBar.cpp
source/Irrlicht/CSkyBoxSceneNode.cpp
source/Irrlicht/CTerrainSceneNode.cpp
source/Irrlicht/COSOperator.cpp
source/Irrlicht/CImageLoaderPNG.cpp
source/Irrlicht/CMountPointReader.cpp
source/Irrlicht/CParticleSphereEmitter.cpp
source/Irrlicht/CDummyTransformationSceneNode.cpp
source/Irrlicht/CDefaultSceneNodeFactory.cpp
source/Irrlicht/CGUIImage.cpp
source/Irrlicht/CGUIEnvironment.cpp
source/Irrlicht/CParticleScaleAffector.cpp
source/Irrlicht/CSceneNodeAnimatorDelete.cpp
source/Irrlicht/CImageWriterBMP.cpp
source/Irrlicht/CParticleFadeOutAffector.cpp
source/Irrlicht/CGUIEditBox.cpp
source/Irrlicht/COGLES2ParallaxMapRenderer.cpp
source/Irrlicht/CXMLReader.cpp
source/Irrlicht/COGLESDriver.cpp
source/Irrlicht/CIrrDeviceAndroid.cpp
source/Irrlicht/COGLESTexture.cpp
source/Irrlicht/CGUIWindow.cpp
source/Irrlicht/CParticleMeshEmitter.cpp
source/Irrlicht/CGUIEnvironment.cpp
source/Irrlicht/CTarReader.cpp
source/Irrlicht/CMeshManipulator.cpp
source/Irrlicht/CGUISpinBox.cpp
source/Irrlicht/CImageLoaderBMP.cpp
source/Irrlicht/CIrrDeviceWin32.cpp
source/Irrlicht/CTriangleSelector.cpp
source/Irrlicht/COpenGLSLMaterialRenderer.cpp
source/Irrlicht/CIrrDeviceStub.cpp
source/Irrlicht/irrXML.cpp
source/Irrlicht/COpenGLTexture.cpp
source/Irrlicht/CAttributes.cpp
source/Irrlicht/COGLES2ExtensionHandler.cpp
source/Irrlicht/COGLESExtensionHandler.cpp
source/Irrlicht/CImageWriterPNG.cpp
source/Irrlicht/CZBuffer.cpp
source/Irrlicht/CParticleRingEmitter.cpp
source/Irrlicht/CFileSystem.cpp
source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
source/Irrlicht/CIrrDeviceLinux.cpp
source/Irrlicht/CCubeSceneNode.cpp
source/Irrlicht/CReadFile.cpp
source/Irrlicht/CZipReader.cpp
source/Irrlicht/CSphereSceneNode.cpp
source/Irrlicht/CGUIMessageBox.cpp
source/Irrlicht/CGUIContextMenu.cpp
source/Irrlicht/CGUIListBox.cpp
source/Irrlicht/CGUIToolBar.cpp
source/Irrlicht/CCameraSceneNode.cpp
source/Irrlicht/CXMeshFileLoader.cpp
source/Irrlicht/CParticleScaleAffector.cpp
source/Irrlicht/CBillboardSceneNode.cpp
source/Irrlicht/Irrlicht.cpp
source/Irrlicht/CEmptySceneNode.cpp
source/Irrlicht/CMemoryFile.cpp
source/Irrlicht/CFPSCounter.cpp
source/Irrlicht/CGUISkin.cpp
source/Irrlicht/CGUIColorSelectDialog.cpp
source/Irrlicht/CWaterSurfaceSceneNode.cpp
source/Irrlicht/CIrrDeviceConsole.cpp
source/Irrlicht/CTextSceneNode.cpp
source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
source/Irrlicht/CGUIFont.cpp
source/Irrlicht/CWriteFile.cpp
source/Irrlicht/CMeshSceneNode.cpp
source/Irrlicht/CXMLWriter.cpp
source/Irrlicht/CGUIImageList.cpp
source/Irrlicht/CSceneNodeAnimatorRotation.cpp
source/Irrlicht/glext.h
source/Irrlicht/CB3DMeshFileLoader.h
source/Irrlicht/CIrrDeviceLinux.h
source/Irrlicht/CMeshCache.h
source/Irrlicht/CAttributes.h
source/Irrlicht/CParticleMeshEmitter.h
source/Irrlicht/CParticlePointEmitter.h
source/Irrlicht/CParticleRotationAffector.h
source/Irrlicht/CMountPointReader.h
source/Irrlicht/CIrrDeviceConsole.h
source/Irrlicht/CTerrainSceneNode.h
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
source/Irrlicht/CImageLoaderBMP.h
source/Irrlicht/CSkinnedMesh.h
source/Irrlicht/COpenGLParallaxMapRenderer.h
source/Irrlicht/CParticleRingEmitter.h
source/Irrlicht/COpenGLShaderMaterialRenderer.h
source/Irrlicht/CImageLoaderPNG.h
source/Irrlicht/COctreeTriangleSelector.h
source/Irrlicht/COpenGLTexture.h
source/Irrlicht/Octree.h
source/Irrlicht/os.h
source/Irrlicht/CDefaultGUIElementFactory.h
source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
source/Irrlicht/CTriangleBBSelector.h
source/Irrlicht/S2DVertex.h
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
source/Irrlicht/CGUIMessageBox.h
source/Irrlicht/CBoneSceneNode.h
source/Irrlicht/CGUITable.h
source/Irrlicht/CGUIColorSelectDialog.h
source/Irrlicht/CCubeSceneNode.h
source/Irrlicht/resource.h
source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
source/Irrlicht/SoftwareDriver2_helper.h
source/Irrlicht/CGUIWindow.h
source/Irrlicht/dmfsupport.h
source/Irrlicht/CGUICheckBox.h
source/Irrlicht/CMeshManipulator.h
source/Irrlicht/IImagePresenter.h
source/Irrlicht/CGUIMeshViewer.h
source/Irrlicht/CMeshSceneNode.h
source/Irrlicht/CGUIImage.h
source/Irrlicht/CCameraSceneNode.h
source/Irrlicht/IZBuffer.h
source/Irrlicht/CAnimatedMeshSceneNode.h
source/Irrlicht/CGUIStaticText.h
source/Irrlicht/wglext.h
source/Irrlicht/CTimer.h
source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
source/Irrlicht/CParticleFadeOutAffector.h
source/Irrlicht/COpenGLSLMaterialRenderer.h
source/Irrlicht/CParticleAttractionAffector.h
source/Irrlicht/MacOSX/AppDelegate.h
source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h
source/Irrlicht/MacOSX/OSXClipboard.h
source/Irrlicht/CSceneManager.h
source/Irrlicht/COpenGLDriver.h
source/Irrlicht/CGUIComboBox.h
source/Irrlicht/CSceneCollisionManager.h
source/Irrlicht/ISceneNodeAnimatorFinishing.h
source/Irrlicht/CGUITabControl.h
source/Irrlicht/CSphereSceneNode.h
source/Irrlicht/CIrrDeviceStub.h
source/Irrlicht/CDummyTransformationSceneNode.h
source/Irrlicht/CParticleBoxEmitter.h
source/Irrlicht/COctreeSceneNode.h
source/Irrlicht/CReadFile.h
source/Irrlicht/COSOperator.h
source/Irrlicht/CLightSceneNode.h
source/Irrlicht/CParticleSphereEmitter.h
source/Irrlicht/CZBuffer.h
source/Irrlicht/CImage.h
source/Irrlicht/CIrrDeviceWin32.h
source/Irrlicht/CGUIEditBox.h
source/Irrlicht/CGUISpriteBank.h
source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
source/Irrlicht/COpenGLExtensionHandler.h
source/Irrlicht/CGUIScrollBar.h
source/Irrlicht/CTriangleSelector.h
source/Irrlicht/CParticleGravityAffector.h
source/Irrlicht/CGUIModalScreen.h
source/Irrlicht/CDefaultSceneNodeFactory.h
source/Irrlicht/CXMLReaderImpl.h
source/Irrlicht/COpenGLMaterialRenderer.h
source/Irrlicht/CVideoModeList.h
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
source/Irrlicht/CColorConverter.h
source/Irrlicht/CWaterSurfaceSceneNode.h
source/Irrlicht/SoftwareDriver2_compile_config.h
source/Irrlicht/CSceneNodeAnimatorTexture.h
source/Irrlicht/CXMLReader.h
source/Irrlicht/CEmptySceneNode.h
source/Irrlicht/CParticleSystemSceneNode.h
source/Irrlicht/CImageWriterPNG.h
source/Irrlicht/CParticleScaleAffector.h
source/Irrlicht/CImageLoaderJPG.h
source/Irrlicht/CBillboardSceneNode.h
source/Irrlicht/CIrrDeviceSDL.h
source/Irrlicht/CSkyDomeSceneNode.h
source/Irrlicht/CGUIInOutFader.h
source/Irrlicht/CGUIFont.h
source/Irrlicht/CGUIImageList.h
source/Irrlicht/CFileSystem.h
source/Irrlicht/CSceneNodeAnimatorRotation.h
source/Irrlicht/CGUISkin.h
source/Irrlicht/S4DVertex.h
source/Irrlicht/CGUIMenu.h
source/Irrlicht/CBlit.h
source/Irrlicht/CZipReader.h
source/Irrlicht/CGUIToolBar.h
source/Irrlicht/CImageWriterJPG.h
source/Irrlicht/IAttribute.h
source/Irrlicht/CNullDriver.h
source/Irrlicht/CWriteFile.h
source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
source/Irrlicht/glxext.h
source/Irrlicht/CMetaTriangleSelector.h
source/Irrlicht/CTarReader.h
source/Irrlicht/CXMLWriter.h
source/Irrlicht/CParticleCylinderEmitter.h
source/Irrlicht/ITriangleRenderer.h
source/Irrlicht/CSceneNodeAnimatorDelete.h
source/Irrlicht/CIrrDeviceFB.h
source/Irrlicht/CGUIEnvironment.h
source/Irrlicht/CTerrainTriangleSelector.h
source/Irrlicht/CAttributeImpl.h
source/Irrlicht/CGeometryCreator.h
source/Irrlicht/CSkyBoxSceneNode.h
source/Irrlicht/CImageWriterBMP.h
source/Irrlicht/BuiltInFont.h
source/Irrlicht/CMemoryFile.h
source/Irrlicht/CFPSCounter.h
source/Irrlicht/CGUITreeView.h
source/Irrlicht/CGUIContextMenu.h
source/Irrlicht/CFileList.h
source/Irrlicht/CLimitReadFile.h
source/Irrlicht/CGUISpinBox.h
source/Irrlicht/CGUIButton.h
source/Irrlicht/CGUIListBox.h
source/Irrlicht/CGUIFileOpenDialog.h
source/Irrlicht/CTextSceneNode.h
include/ESceneNodeAnimatorTypes.h
include/IParticleGravityAffector.h
include/IGUIFontBitmap.h
include/IEventReceiver.h
include/EMessageBoxFlags.h
include/IParticleSphereEmitter.h
include/IParticleFadeOutAffector.h
include/IGeometryCreator.h
include/IGUIEnvironment.h
include/irrunpack.h
include/IParticleRingEmitter.h
include/IGUIElement.h
include/IMaterialRenderer.h
include/SVertexIndex.h
include/SMaterialLayer.h
include/irrMap.h
include/EMaterialTypes.h
include/IAnimatedMeshSceneNode.h
include/IParticleCylinderEmitter.h
include/IAttributeExchangingObject.h
include/IVertexBuffer.h
include/ISkinnedMesh.h
include/irrList.h
include/SAnimatedMesh.h
include/IGUITreeView.h
include/IGUIFont.h
include/IGUIElementFactory.h
include/IParticleSystemSceneNode.h
include/ITerrainSceneNode.h
include/SMeshBuffer.h
include/IGUIEditBox.h
include/ILogger.h
include/ILightManager.h
include/IMeshBuffer.h
include/irrlicht.h
include/ITimer.h
include/IImage.h
include/position2d.h
include/IGUIToolbar.h
include/IGUISpinBox.h
include/IGUITabControl.h
include/IBillboardTextSceneNode.h
include/IGUIInOutFader.h
include/path.h
include/IMetaTriangleSelector.h
include/ISceneUserDataSerializer.h
include/irrArray.h
include/irrString.h
include/IMesh.h
include/line3d.h
include/IMeshLoader.h
include/aabbox3d.h
include/CMeshBuffer.h
include/ETerrainElements.h
include/EDebugSceneTypes.h
include/driverChoice.h
include/IParticleAttractionAffector.h
include/IGUISpriteBank.h
include/IGUISkin.h
include/irrAllocator.h
include/IDummyTransformationSceneNode.h
include/SSkinMeshBuffer.h
include/ISceneLoader.h
include/IrrlichtDevice.h
include/IMaterialRendererServices.h
include/SColor.h
include/IXMLWriter.h
include/CDynamicMeshBuffer.h
include/IFileArchive.h
include/IGUIContextMenu.h
include/IVideoDriver.h
include/irrMath.h
include/ISceneNode.h
include/line2d.h
include/irrpack.h
include/plane3d.h
include/ISceneManager.h
include/IImageWriter.h
include/EGUIElementTypes.h
include/IParticleMeshEmitter.h
include/IGUIColorSelectDialog.h
include/IGUIImage.h
include/IGUIListBox.h
include/vector2d.h
include/CIndexBuffer.h
include/IAnimatedMesh.h
include/SMaterial.h
include/rect.h
include/EDriverFeatures.h
include/IVideoModeList.h
include/fast_atof.h
include/IGUICheckBox.h
include/ISceneNodeAnimatorFactory.h
include/SVertexManipulator.h
include/ITextSceneNode.h
include/IDynamicMeshBuffer.h
include/SExposedVideoData.h
include/IReferenceCounted.h
include/irrXML.h
include/SKeyMap.h
include/ECullingTypes.h
include/IBillboardSceneNode.h
include/ITriangleSelector.h
include/coreutil.h
include/SMeshBufferTangents.h
include/ILightSceneNode.h
include/dimension2d.h
include/ISceneCollisionManager.h
include/heapsort.h
include/IGUIComboBox.h
include/Keycodes.h
include/SParticle.h
include/EDriverTypes.h
include/IFileSystem.h
include/SMesh.h
include/IParticleAffector.h
include/IGUIImageList.h
include/EShaderTypes.h
include/SceneParameters.h
include/IGUIScrollBar.h
include/IImageLoader.h
include/IParticleBoxEmitter.h
include/ICursorControl.h
include/ICameraSceneNode.h
include/ISceneNodeAnimatorCameraMaya.h
include/IMeshManipulator.h
include/CVertexBuffer.h
include/SSharedMeshBuffer.h
include/vector3d.h
include/ISceneNodeAnimatorCameraFPS.h
include/IGUIMeshViewer.h
include/triangle3d.h
include/matrix4.h
include/IGUIStaticText.h
include/IMeshWriter.h
include/IMeshSceneNode.h
include/IParticleAnimatedMeshSceneNodeEmitter.h
include/IMeshCache.h
include/EMeshWriterEnums.h
include/EPrimitiveTypes.h
include/SViewFrustum.h
include/IXMLReader.h
include/EHardwareBufferFlags.h
include/IOSOperator.h
include/IGPUProgrammingServices.h
include/IrrCompileConfig.h
include/ISceneNodeFactory.h
include/IGUITable.h
include/IGUIButton.h
include/EMaterialFlags.h
include/EDeviceTypes.h
include/IGUIWindow.h
include/EAttributes.h
include/S3DVertex.h
include/ISceneNodeAnimatorCollisionResponse.h
include/IWriteFile.h
include/irrTypes.h
include/IParticleEmitter.h
include/quaternion.h
include/SLight.h
include/IReadFile.h
include/ESceneNodeTypes.h
include/IIndexBuffer.h
include/EGUIAlignment.h
include/SIrrCreationParameters.h
include/IFileList.h
include/SMeshBufferLightMap.h
include/IRandomizer.h
include/ISceneNodeAnimator.h
include/IAttributes.h
include/IParticleRotationAffector.h
include/IGUIFileOpenDialog.h
include/IBoneSceneNode.h
include/IShaderConstantSetCallBack.h
include/ITexture.h
)
if(APPLE)

View File

@ -106,8 +106,10 @@
#endif
#endif
#if defined(ANDROID)
#define _IRR_ANDROID_PLATFORM_
#define _IRR_POSIX_API_
#endif
#if defined(_IRR_ANDROID_PLATFORM_)
#define _IRR_COMPILE_WITH_ANDROID_DEVICE_
@ -236,7 +238,7 @@ define out. */
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
#define IRR_OGLES2_SHADER_PATH "media/Shaders/"
#else
#define IRR_OGLES2_SHADER_PATH "../../media/Shaders/"
#define IRR_OGLES2_SHADER_PATH "data/shaders/irrlicht/"
#endif
#endif

View File

@ -63,6 +63,8 @@ namespace irr
extern bool useCoreContext;
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceLinux* device);
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
video::SExposedVideoData& data, io::IFileSystem* io);
}
} // end namespace irr
@ -85,10 +87,16 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
#ifdef _IRR_COMPILE_WITH_X11_
display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0),
XInputMethod(0), XInputContext(0),
#ifdef _IRR_COMPILE_WITH_OPENGL_
#ifdef COMPILE_WITH_GLX
glxWin(0),
Context(0),
glxContext(0),
#endif
#ifdef COMPILE_WITH_EGL
eglDisplay(0),
eglContext(0),
eglSurface(0),
#endif
#endif
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
WindowHasFocus(false), WindowMinimized(false),
@ -178,8 +186,8 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
if (display)
{
#ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context)
#ifdef COMPILE_WITH_GLX
if (glxContext)
{
if (glxWin)
{
@ -191,11 +199,11 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
if (!glXMakeCurrent(display, None, NULL))
os::Printer::log("Could not release glx context.", ELL_WARNING);
}
glXDestroyContext(display, Context);
glXDestroyContext(display, glxContext);
if (glxWin)
glXDestroyWindow(display, glxWin);
}
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
#endif // #ifdef COMPILE_WITH_GLX
if (SoftwareImage)
XDestroyImage(SoftwareImage);
@ -204,10 +212,10 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
{
XDestroyWindow(display,window);
}
// Reset fullscreen resolution change
restoreResolution();
restoreResolution();
if (!ExternalWindow)
{
XCloseDisplay(display);
@ -267,14 +275,14 @@ bool CIrrDeviceLinux::restoreResolution()
return false;
XRROutputInfo* output = XRRGetOutputInfo(display, res, output_id);
if (!output || !output->crtc || output->connection == RR_Disconnected)
if (!output || !output->crtc || output->connection == RR_Disconnected)
{
XRRFreeOutputInfo(output);
return false;
}
XRRCrtcInfo* crtc = XRRGetCrtcInfo(display, res, output->crtc);
if (!crtc)
if (!crtc)
{
XRRFreeOutputInfo(output);
return false;
@ -382,7 +390,7 @@ bool CIrrDeviceLinux::changeResolution()
XRRFreeScreenResources(res);
break;
}
XRRCrtcInfo* crtc = XRRGetCrtcInfo(display, res, output->crtc);
if (!crtc)
{
@ -402,12 +410,12 @@ bool CIrrDeviceLinux::changeResolution()
if (crtc->rotation & (XRANDR_ROTATION_LEFT|XRANDR_ROTATION_RIGHT))
{
size = core::dimension2d<u32>(mode->height, mode->width);
}
else
}
else
{
size = core::dimension2d<u32>(mode->width, mode->height);
}
if (bestMode == -1 && mode->id == output->modes[0])
{
mode0_size = size;
@ -455,7 +463,7 @@ bool CIrrDeviceLinux::changeResolution()
Status s = XRRSetCrtcConfig(display, res, output->crtc, CurrentTime,
crtc->x, crtc->y, output->modes[bestMode],
crtc->rotation, &output_id, 1);
if (s == Success)
UseXRandR = true;
@ -464,7 +472,7 @@ bool CIrrDeviceLinux::changeResolution()
XRRFreeScreenResources(res);
break;
}
if (UseXRandR == false)
{
os::Printer::log("Could not get video output. Try to run in windowed mode.", ELL_WARNING);
@ -506,6 +514,7 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
}
#endif
#ifdef COMPILE_WITH_GLX
static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, bool force_legacy_context)
{
GLXContext Context;
@ -558,7 +567,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
if(!force_legacy_context)
{
// create core 4.3 context
@ -566,7 +575,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, GLContextDebugBit ? core43ctxdebug : core43ctx);
if (!XErrorSignaled)
return Context;
XErrorSignaled = false;
// create core 3.3 context
os::Printer::log("Creating OpenGL 3.3 context...", ELL_INFORMATION);
@ -590,6 +599,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
return Context;
}
#endif
bool CIrrDeviceLinux::createWindow()
{
@ -612,8 +622,37 @@ bool CIrrDeviceLinux::createWindow()
changeResolution();
#ifdef _IRR_COMPILE_WITH_OPENGL_
#ifdef COMPILE_WITH_EGL
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(!eglInitialize(eglDisplay, NULL, NULL))
{
printf("EGLInit error %d\n", eglGetError());
}
int attrib[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_RED_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_BLUE_SIZE, 4,
EGL_ALPHA_SIZE, CreationParams.WithAlphaChannel?1:0,
EGL_DEPTH_SIZE, CreationParams.ZBufferBits, //10,11
EGL_NONE
};
EGLConfig conf;
int size;
if (!eglChooseConfig(eglDisplay, attrib, 0, 0, &size))
{
printf("EGL Config count error %x\n", eglGetError());
}
printf("size is %d\n", size);
if (!eglChooseConfig(eglDisplay, attrib, &conf, 1, &size))
{
printf("EGL Config error %x\n", eglGetError());
}
#endif
#ifdef COMPILE_WITH_GLX
GLXFBConfig glxFBConfig;
int major, minor;
bool isAvailableGLX=false;
@ -837,7 +876,7 @@ bool CIrrDeviceLinux::createWindow()
// don't use the XVisual with OpenGL, because it ignores all requested
// properties of the CreationParams
else if (!visual)
#endif // _IRR_COMPILE_WITH_OPENGL_
#endif // COMPILE_WITH_GLX
// create visual with standard X methods
{
@ -910,7 +949,36 @@ bool CIrrDeviceLinux::createWindow()
Atom wmDelete;
wmDelete = XInternAtom(display, wmDeleteWindow, True);
XSetWMProtocols(display, window, &wmDelete, 1);
#ifdef COMPILE_WITH_EGL
eglSurface = eglCreateWindowSurface(eglDisplay, conf, window, NULL);
if (eglSurface == EGL_NO_SURFACE )
{
printf("EGL NO SURFACE %x\n", eglGetError());
}
//~ if (!eglBindAPI(EGL_OPENGL_API))
if (!eglBindAPI(EGL_OPENGL_ES_API))
{
printf("EGL bind api %x\n", eglGetError());
}
int egl_context_attrib[] =
{
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
//~ EGL_CONTEXT_MINOR_VERSION_KHR, 3,
EGL_CONTEXT_MINOR_VERSION_KHR, 0,
EGL_NONE
};
eglContext = eglCreateContext(eglDisplay, conf, EGL_NO_CONTEXT, egl_context_attrib);
if (eglContext == EGL_NO_CONTEXT)
{
printf("EGL Context %x\n", eglGetError());
}
if (!eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext))
{
printf("EGL Make current %x\n", eglGetError());
}
#endif
if (CreationParams.Fullscreen)
{
if (netWM)
@ -937,11 +1005,11 @@ bool CIrrDeviceLinux::createWindow()
xev.xclient.format = 32;
xev.xclient.data.l[0] = 1;
xev.xclient.data.l[1] = WMFullscreenAtom;
XSendEvent(display, RootWindow(display, visual->screen), false,
XSendEvent(display, RootWindow(display, visual->screen), false,
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XFlush(display);
// Wait until window state is already changed to fullscreen
bool fullscreen = false;
for (int i = 0; i < 500; i++)
@ -952,36 +1020,36 @@ bool CIrrDeviceLinux::createWindow()
unsigned char* data = NULL;
int s = XGetWindowProperty(display, window, WMStateAtom,
0l, 1024, False, XA_ATOM, &type,
&format, &numItems, &bytesAfter,
0l, 1024, False, XA_ATOM, &type,
&format, &numItems, &bytesAfter,
&data);
if (s == Success)
if (s == Success)
{
Atom* atoms = (Atom*)data;
for (unsigned int i = 0; i < numItems; ++i)
for (unsigned int i = 0; i < numItems; ++i)
{
if (atoms[i] == WMFullscreenAtom)
if (atoms[i] == WMFullscreenAtom)
{
fullscreen = true;
break;
}
}
}
XFree(data);
if (fullscreen == true)
break;
usleep(1000);
}
if (!fullscreen)
{
os::Printer::log("Warning! Got timeout while checking fullscreen sate", ELL_WARNING);
}
}
}
else
{
@ -1021,10 +1089,10 @@ bool CIrrDeviceLinux::createWindow()
// Currently broken in X, see Bug ID 2795321
// XkbSetDetectableAutoRepeat(display, True, &AutorepeatSupport);
#ifdef _IRR_COMPILE_WITH_OPENGL_
#ifdef COMPILE_WITH_GLX
// connect glx context to window
Context=0;
glxContext=0;
if (isAvailableGLX && CreationParams.DriverType==video::EDT_OPENGL)
{
if (UseGLXWindow)
@ -1032,13 +1100,13 @@ bool CIrrDeviceLinux::createWindow()
glxWin=glXCreateWindow(display,glxFBConfig,window,NULL);
if (glxWin)
{
Context = getMeAGLContext(display, glxFBConfig, CreationParams.ForceLegacyDevice);
if (Context)
glxContext = getMeAGLContext(display, glxFBConfig);
if (glxContext)
{
if (!glXMakeContextCurrent(display, glxWin, glxWin, Context))
if (!glXMakeContextCurrent(display, glxWin, glxWin, glxContext))
{
os::Printer::log("Could not make context current.", ELL_WARNING);
glXDestroyContext(display, Context);
glXDestroyContext(display, glxContext);
}
}
else
@ -1053,13 +1121,13 @@ bool CIrrDeviceLinux::createWindow()
}
else
{
Context = glXCreateContext(display, visual, NULL, True);
if (Context)
glxContext = glXCreateContext(display, visual, NULL, True);
if (glxContext)
{
if (!glXMakeCurrent(display, window, Context))
if (!glXMakeCurrent(display, window, glxContext))
{
os::Printer::log("Could not make context current.", ELL_WARNING);
glXDestroyContext(display, Context);
glXDestroyContext(display, glxContext);
}
}
else
@ -1068,7 +1136,7 @@ bool CIrrDeviceLinux::createWindow()
}
}
}
#endif // _IRR_COMPILE_WITH_OPENGL_
#endif // COMPILE_WITH_GLX
Window tmp;
u32 borderWidth;
@ -1109,6 +1177,7 @@ bool CIrrDeviceLinux::createWindow()
//! create the driver
void CIrrDeviceLinux::createDriver()
{
bool tmp = false;
switch(CreationParams.DriverType)
{
#ifdef _IRR_COMPILE_WITH_X11_
@ -1130,14 +1199,25 @@ void CIrrDeviceLinux::createDriver()
break;
case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context)
#ifdef COMPILE_WITH_GLX
tmp |= (glxContext != 0);
#endif
#ifdef COMPILE_WITH_EGL
tmp |= (eglContext != 0);
#endif
if (tmp)
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
#else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
break;
}
case video::EDT_DIRECT3D8:
case video::EDT_DIRECT3D9:
os::Printer::log("This driver is not available in Linux. Try OpenGL or Software renderer.",
@ -1809,7 +1889,7 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
#ifdef _IRR_LINUX_X11_RANDR_
output_id = BadRROutput;
old_mode = BadRRMode;
while (XRRQueryExtension(display, &eventbase, &errorbase))
{
XRROutputInfo* output = NULL;
@ -1819,52 +1899,52 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
XRRScreenResources* res = XRRGetScreenResources(display, DefaultRootWindow(display));
if (!res)
break;
RROutput primary_id = XRRGetOutputPrimary(display, DefaultRootWindow(display));
for (int i = 0; i < res->noutput; i++)
for (int i = 0; i < res->noutput; i++)
{
XRROutputInfo* output_tmp = XRRGetOutputInfo(display, res, res->outputs[i]);
if (!output_tmp || !output_tmp->crtc || output_tmp->connection == RR_Disconnected)
if (!output_tmp || !output_tmp->crtc || output_tmp->connection == RR_Disconnected)
{
XRRFreeOutputInfo(output_tmp);
continue;
}
XRRCrtcInfo* crtc_tmp = XRRGetCrtcInfo(display, res, output_tmp->crtc);
if (!crtc_tmp)
if (!crtc_tmp)
{
XRRFreeOutputInfo(output_tmp);
continue;
}
if (res->outputs[i] == primary_id ||
output_id == BadRROutput || crtc_tmp->x < crtc->x ||
(crtc_tmp->x == crtc->x && crtc_tmp->y < crtc->y))
{
XRRFreeCrtcInfo(crtc);
XRRFreeOutputInfo(output);
XRRFreeOutputInfo(output);
output = output_tmp;
crtc = crtc_tmp;
crtc = crtc_tmp;
output_id = res->outputs[i];
}
else
{
XRRFreeCrtcInfo(crtc_tmp);
XRRFreeOutputInfo(output_tmp);
XRRFreeOutputInfo(output_tmp);
}
if (res->outputs[i] == primary_id)
break;
}
if (output_id == BadRROutput)
{
os::Printer::log("Could not get video output.", ELL_WARNING);
break;
}
crtc_x = crtc->x;
crtc_y = crtc->y;
@ -1876,14 +1956,14 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
if (crtc->rotation & (XRANDR_ROTATION_LEFT|XRANDR_ROTATION_RIGHT))
{
size = core::dimension2d<u32>(mode->height, mode->width);
}
else
}
else
{
size = core::dimension2d<u32>(mode->width, mode->height);
}
for (int j = 0; j < output->nmode; j++)
{
{
if (mode->id == output->modes[j])
{
VideoModeList.addMode(size, defaultDepth);
@ -1897,15 +1977,15 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
VideoModeList.setDesktop(defaultDepth, size);
}
}
XRRFreeCrtcInfo(crtc);
XRRFreeOutputInfo(output);
XRRFreeScreenResources(res);
XRRFreeScreenResources(res);
break;
}
#endif
}
if (display && temporaryDisplay)
{
XCloseDisplay(display);
@ -2201,6 +2281,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
ActiveJoysticks.push_back(info);
returnInfo.HasGenericName = false;
returnInfo.Joystick = joystick;
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
returnInfo.Axes = info.axes;
@ -2286,7 +2367,7 @@ void CIrrDeviceLinux::pollJoysticks()
// Send an irrlicht joystick event once per ::run() even if no new data were received.
(void)postEventFromUser(info.persistentData);
#ifdef _IRR_COMPILE_WITH_X11_
if (event_received)
{
@ -2394,12 +2475,12 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
const c8* CIrrDeviceLinux::getTextFromClipboard() const
{
#if defined(_IRR_COMPILE_WITH_X11_)
if (X_ATOM_CLIPBOARD == None)
if (X_ATOM_CLIPBOARD == None)
{
os::Printer::log("Couldn't access X clipboard", ELL_WARNING);
return 0;
}
Window ownerWindow = XGetSelectionOwner(display, X_ATOM_CLIPBOARD);
if (ownerWindow == window)
{
@ -2413,38 +2494,38 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
Atom selection = XInternAtom(display, "IRR_SELECTION", False);
XConvertSelection(display, X_ATOM_CLIPBOARD, XA_STRING, selection, window, CurrentTime);
const int SELECTION_RETRIES = 500;
int i = 0;
for (i = 0; i < SELECTION_RETRIES; i++)
{
XEvent xevent;
bool res = XCheckTypedWindowEvent(display, window, SelectionNotify, &xevent);
if (res && xevent.xselection.selection == X_ATOM_CLIPBOARD)
if (res && xevent.xselection.selection == X_ATOM_CLIPBOARD)
break;
usleep(1000);
}
if (i == SELECTION_RETRIES)
{
os::Printer::log("Timed out waiting for SelectionNotify event", ELL_WARNING);
return 0;
}
Atom type;
int format;
unsigned long numItems, dummy;
unsigned char *data;
int result = XGetWindowProperty(display, window, selection, 0, INT_MAX/4,
False, AnyPropertyType, &type, &format,
int result = XGetWindowProperty(display, window, selection, 0, INT_MAX/4,
False, AnyPropertyType, &type, &format,
&numItems, &dummy, &data);
if (result == Success)
Clipboard = (irr::c8*)data;
XFree (data);
return Clipboard.c_str();
#else

View File

@ -18,13 +18,15 @@
#ifdef _IRR_COMPILE_WITH_X11_
#ifdef _IRR_COMPILE_WITH_OPENGL_
#include <GL/gl.h>
#define GLX_GLXEXT_LEGACY 1
#include <GL/glx.h>
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
#define GLX_GLXEXT_PROTOTYPES
#include "glxext.h"
#include <GLES3/gl3.h>
#endif
//#define COMPILE_WITH_EGL
#ifdef COMPILE_WITH_EGL
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif
#include <X11/Xlib.h>
@ -408,10 +410,17 @@ namespace irr
int crtc_x;
int crtc_y;
#endif
#ifdef _IRR_COMPILE_WITH_OPENGL_
#ifdef COMPILE_WITH_GLX
GLXWindow glxWin;
GLXContext Context;
#endif
GLXContext glxContext;
#endif
#ifdef COMPILE_WITH_EGL
public:
EGLDisplay eglDisplay;
EGLContext eglContext;
EGLSurface eglSurface;
private:
#endif
#endif
u32 Width, Height;
bool WindowHasFocus;

View File

@ -25,7 +25,8 @@
#include "glwrap.hpp"
#include "utils/cpp2011.hpp"
#ifdef ANDROID
#if defined(ANDROID) || defined(USE_GLES2)
# define _IRR_COMPILE_WITH_OGLES2_
# include "../../lib/irrlicht/source/Irrlicht/COGLES2Texture.h"
#else
# include "../../lib/irrlicht/source/Irrlicht/COpenGLTexture.h"
@ -183,7 +184,7 @@ static void drawTexColoredQuad(const video::ITexture *texture,
ColoredTextureRectShader::getInstance()->use();
glBindVertexArray(ColoredTextureRectShader::getInstance()->m_vao);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
const irr::video::COpenGLTexture *t =
static_cast<const irr::video::COpenGLTexture*>(texture);
#else
@ -321,7 +322,7 @@ void draw2DImage(const video::ITexture* texture,
UniformColoredTextureRectShader::getInstance()->use();
glBindVertexArray(SharedGPUObjects::getUI_VAO());
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
const video::COpenGLTexture *c_texture =
static_cast<const video::COpenGLTexture*>(texture);
#else
@ -438,7 +439,7 @@ void draw2DImage(const video::ITexture* texture,
}
else
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
const video::COpenGLTexture *c_texture =
static_cast<const video::COpenGLTexture*>(texture);
#else

View File

@ -68,8 +68,12 @@ void CentralVideoSettings::init()
Log::info("IrrDriver", "OpenGL renderer: %s", glGetString(GL_RENDERER));
Log::info("IrrDriver", "OpenGL version string: %s", glGetString(GL_VERSION));
}
#if !defined(ANDROID) && !defined(USE_GLES2)
m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1))
&& !UserConfigParams::m_force_legacy_device;
#else
m_glsl = false;
#endif
if (!ProfileWorld::isNoGraphics())
initGL();
@ -84,27 +88,33 @@ void CentralVideoSettings::init()
Log::info("GLDriver", "AMD Vertex Shader Layer Present");
}
#if !defined(USE_GLES2)
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BUFFER_STORAGE) &&
hasGLExtension("GL_ARB_buffer_storage") )
{
hasBuffserStorage = true;
Log::info("GLDriver", "ARB Buffer Storage Present");
}
#endif
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BASE_INSTANCE) &&
hasGLExtension("GL_ARB_base_instance")) {
hasBaseInstance = true;
Log::info("GLDriver", "ARB Base Instance Present");
}
#if !defined(USE_GLES2)
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_DRAW_INDIRECT) &&
hasGLExtension("GL_ARB_draw_indirect")) {
hasDrawIndirect = true;
Log::info("GLDriver", "ARB Draw Indirect Present");
}
#endif
#if !defined(USE_GLES2)
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_COMPUTE_SHADER) &&
hasGLExtension("GL_ARB_compute_shader")) {
hasComputeShaders = true;
Log::info("GLDriver", "ARB Compute Shader Present");
}
#endif
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_ARRAYS_OF_ARRAYS) &&
hasGLExtension("GL_ARB_arrays_of_arrays")) {
hasArraysOfArrays = true;
@ -145,21 +155,25 @@ void CentralVideoSettings::init()
hasMultiDrawIndirect = true;
Log::info("GLDriver", "ARB Multi Draw Indirect Present");
}
#if !defined(USE_GLES2)
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXT_TEXTURE_COMPRESSION_S3TC) &&
hasGLExtension("GL_EXT_texture_compression_s3tc")) {
hasTextureCompression = true;
Log::info("GLDriver", "EXT Texture Compression S3TC Present");
}
#endif
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_UNIFORM_BUFFER_OBJECT) &&
hasGLExtension("GL_ARB_uniform_buffer_object")) {
hasUBO = true;
Log::info("GLDriver", "ARB Uniform Buffer Object Present");
}
#if !defined(USE_GLES2)
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_GEOMETRY_SHADER4) &&
hasGLExtension("GL_ARB_geometry_shader4")) {
hasGS = true;
Log::info("GLDriver", "ARB Geometry Shader 4 Present");
}
#endif
// Only unset the high def textures if they are set as default. If the
// user has enabled them (bit 1 set), then leave them enabled.
@ -189,16 +203,16 @@ void CentralVideoSettings::init()
}
// Check if visual is sRGB-capable
#if !defined(ANDROID) && !defined(USE_GLES2)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE) &&
m_glsl == true)
{
#ifndef ANDROID
GLint param = GL_SRGB;
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &param);
m_need_srgb_visual_workaround = (param != GL_SRGB);
#endif
}
#endif
}
}

View File

@ -21,7 +21,7 @@
#define GLEW_STATIC
extern "C" {
#ifndef ANDROID_DEVICE
#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2)
# include <GL/glew.h>
#endif
}
@ -40,10 +40,11 @@ extern "C" {
# ifndef GL_TEXTURE_SWIZZLE_RGBA
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
# endif
#elif defined(ANDROID_DEVICE)
#elif defined(ANDROID_DEVICE) || defined(USE_GLES2)
# include <GLES3/gl3.h>
# include <GLES3/gl31.h>
# include <GLES3/gl3ext.h>
# include <GLES2/gl2ext.h>
# define glVertexAttribDivisorARB glVertexAttribDivisor
#elif defined(WIN32)
# define WIN32_LEAN_AND_MEAN
@ -55,6 +56,30 @@ extern "C" {
# include <GL/glext.h>
#endif
#if defined(ANDROID) || defined(USE_GLES2)
#define GL_BGRA 0x80E1
#define GL_BGR 0x80E0
#endif
#if defined(USE_GLES2)
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
#define GL_TEXTURE_BUFFER GL_TEXTURE_BUFFER_EXT
#define GL_FRAMEBUFFER_SRGB GL_FRAMEBUFFER_SRGB_EXT
#define GL_SRGB_ALPHA GL_SRGB_ALPHA_EXT
extern PFNGLUNIFORMHANDLEUI64NVPROC pglUniformHandleui64NV;
extern PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES;
extern PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR;
extern PFNGLTEXBUFFEROESPROC pglTexBufferOES;
extern PFNGLTEXTUREVIEWOESPROC pglTextureViewOES;
#define glUniformHandleui64ARB pglUniformHandleui64NV
#define glDrawElementsBaseVertex pglDrawElementsBaseVertexOES
#define glDebugMessageCallbackARB pglDebugMessageCallbackKHR
#define glTexBuffer pglTexBufferOES
#define glTextureView pglTextureViewOES
#endif
struct DrawElementsIndirectCommand{
GLuint count;
GLuint instanceCount;

View File

@ -30,6 +30,17 @@
#include <string>
#include <sstream>
#if defined(USE_GLES2)
#include <EGL/egl.h>
#include <EGL/eglext.h>
PFNGLUNIFORMHANDLEUI64NVPROC pglUniformHandleui64NV = 0;
PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES = 0;
PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR = 0;
PFNGLTEXBUFFEROESPROC pglTexBufferOES = 0;
PFNGLTEXTUREVIEWOESPROC pglTextureViewOES = 0;
#endif
#ifndef GL_DEBUG_SEVERITY_HIGH_ARB
// Extension: ARB_debug_output
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
@ -177,7 +188,7 @@ void initGL()
return;
is_gl_init = true;
// For Mesa extension reporting
#ifndef ANDROID_DEVICE
#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2)
#ifndef WIN32
glewExperimental = GL_TRUE;
#endif
@ -185,9 +196,22 @@ void initGL()
if (GLEW_OK != err)
Log::fatal("GLEW", "Glew initialisation failed with error %s", glewGetErrorString(err));
#endif
#if defined(USE_GLES2)
glUniformHandleui64ARB = (PFNGLUNIFORMHANDLEUI64NVPROC)eglGetProcAddress("pglUniformHandleui64NV");
glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXOESPROC)eglGetProcAddress("glDrawElementsBaseVertexOES");
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)eglGetProcAddress("glDebugMessageCallbackKHR");
glTexBuffer = (PFNGLTEXBUFFEROESPROC)eglGetProcAddress("glTexBufferOES");
glTextureView = (PFNGLTEXTUREVIEWOESPROC)eglGetProcAddress("glTextureViewOES");
#endif
#ifdef ARB_DEBUG_OUTPUT
#if !defined(USE_GLES2)
if (glDebugMessageCallbackARB)
glDebugMessageCallbackARB((GLDEBUGPROCARB)debugCallback, NULL);
#else
glDebugMessageCallbackARB((GLDEBUGPROCKHR)debugCallback, NULL);
#endif
#endif
}
@ -243,19 +267,19 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h,
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (layered)
{
for (unsigned i = 0; i < RTTs.size(); i++)
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, RTTs[i], 0);
}
else
{
#endif
{
for (unsigned i = 0; i < RTTs.size(); i++)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
#ifndef ANDROID
}
#ifndef ANDROID
GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
assert(result == GL_FRAMEBUFFER_COMPLETE_EXT);
#endif
@ -268,7 +292,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (layered)
{
for (unsigned i = 0; i < RTTs.size(); i++)
@ -276,13 +300,13 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, DS, 0);
}
else
{
#endif
{
for (unsigned i = 0; i < RTTs.size(); i++)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, DS, 0);
#ifndef ANDROID
}
#ifndef ANDROID
GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
assert(result == GL_FRAMEBUFFER_COMPLETE_EXT);
if (layered)

View File

@ -75,7 +75,7 @@
#if (IRRLICHT_VERSION_MAJOR < 1 || IRRLICHT_VERSION_MINOR < 7 || \
_IRR_MATERIAL_MAX_TEXTURES_ < 8 || !defined(_IRR_COMPILE_WITH_OPENGL_) || \
!defined(_IRR_COMPILE_WITH_B3D_LOADER_)) && !defined(ANDROID)
!defined(_IRR_COMPILE_WITH_B3D_LOADER_)) && !defined(ANDROID) && !defined(USE_GLES2)
#error "Building against an incompatible Irrlicht. Distros, \
please use the included version."
#endif
@ -456,10 +456,12 @@ void IrrDriver::initDevice()
if(m_device)
break;
#ifndef ANDROID_DEVICE
#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2)
params.DriverType = video::EDT_OPENGL;
#else
params.DriverType = video::EDT_OGLES2;
#endif
#if defined(ANDROID_DEVICE)
params.PrivateData = global_android_app;
#endif
params.Stencilbuffer = false;
@ -507,9 +509,12 @@ void IrrDriver::initDevice()
{
UserConfigParams::m_width = MIN_SUPPORTED_WIDTH;
UserConfigParams::m_height = MIN_SUPPORTED_HEIGHT;
#ifndef ANDROID_DEVICE
#if !defined(ANDROID_DEVICE)
#if defined(USE_GLES2)
m_device = createDevice(video::EDT_OGLES2,
#else
m_device = createDevice(video::EDT_OPENGL,
#endif
core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height ),
32, //bits per pixel

View File

@ -1055,7 +1055,7 @@ void PostProcessing::renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB,
const core::matrix4 &rh_matrix,
const core::vector3df &rh_extend)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
glEnable(GL_PROGRAM_POINT_SIZE);
RHDebug::getInstance()->use();
glActiveTexture(GL_TEXTURE0 + RHDebug::getInstance()->m_tu_shr);
@ -1661,8 +1661,9 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
if (!CVS->isARBUniformBufferObjectUsable())
return in_fbo;
#ifndef ANDROID
#if !defined(ANDROID)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
irr_driver->getFBO(FBO_MLAA_COLORS).bind();
renderPassThrough(in_fbo->getRTT()[0],
irr_driver->getFBO(FBO_MLAA_COLORS).getWidth(),
@ -1676,6 +1677,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
applyMLAA();
PROFILER_POP_CPU_MARKER();
}
#if !defined(ANDROID)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif

View File

@ -189,7 +189,7 @@ void IrrDriver::renderGLSL(float dt)
if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && m_spherical_harmonics->has6Textures())
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
#ifndef ANDROID
#if !defined(ANDROID)
if (!CVS->isDefferedEnabled())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
@ -284,14 +284,14 @@ void IrrDriver::renderGLSL(float dt)
}
else
{
#ifndef ANDROID
#if !defined(ANDROID)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
glBindFramebuffer(GL_FRAMEBUFFER, 0);
if (CVS->isDefferedEnabled())
camera->activate();
m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
#ifndef ANDROID
#if !defined(ANDROID)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
}
@ -406,7 +406,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
else
{
// We need a cleared depth buffer for some effect (eg particles depth blending)
#ifndef ANDROID
#if !defined(ANDROID)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
@ -419,7 +419,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
vp.LowerRightCorner.X - vp.UpperLeftCorner.X,
vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y);
glClear(GL_DEPTH_BUFFER_BIT);
#ifndef ANDROID
#if !defined(ANDROID)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
@ -545,7 +545,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
}
if (!CVS->isDefferedEnabled() && !forceRTT)
{
#ifndef ANDROID
#if !defined(ANDROID)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
glDisable(GL_DEPTH_TEST);
@ -696,7 +696,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
{
if (GlowPassCmd::getInstance()->Size)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
(const void*)(GlowPassCmd::getInstance()->Offset * sizeof(DrawElementsIndirectCommand)),
(int)GlowPassCmd::getInstance()->Size,

View File

@ -174,7 +174,7 @@ class ShadowShader : public TextureShader<ShadowShader, 0, int, core::matrix4>
public:
ShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
@ -189,8 +189,8 @@ public:
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
#endif
assignUniforms("layer", "ModelMatrix");
#endif
} // ShadowShader
}; // ShadowShader
@ -200,7 +200,7 @@ class InstancedShadowShader : public TextureShader<InstancedShadowShader, 0, int
public:
InstancedShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
@ -218,8 +218,8 @@ public:
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
#endif
assignUniforms("layer");
#endif
} // InstancedShadowShader
}; // InstancedShadowShader
@ -426,7 +426,7 @@ class RefShadowShader : public TextureShader<RefShadowShader, 1,
public:
RefShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
@ -454,7 +454,7 @@ class InstancedRefShadowShader : public TextureShader<InstancedRefShadowShader,
public:
InstancedRefShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
@ -513,7 +513,7 @@ class NormalVisualizer : public Shader<NormalVisualizer, video::SColor>
public:
NormalVisualizer()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2) //?????
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_GEOMETRY_SHADER, "normal_visualizer.geom",
@ -683,7 +683,7 @@ class GrassShadowShader : public TextureShader<GrassShadowShader, 1, int, core::
public:
GrassShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
@ -711,7 +711,7 @@ class InstancedGrassShadowShader : public TextureShader<InstancedGrassShadowShad
public:
InstancedGrassShadowShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
@ -1174,7 +1174,7 @@ void renderInstancedMeshes1stPass(Args...args)
template<typename T, typename...Args>
void multidraw1stPass(Args...args)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
T::InstancedFirstPassShader::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
@ -1302,11 +1302,10 @@ void renderInstancedMeshes2ndPass(const std::vector<GLuint> &Prefilled_tex, Args
template<typename T, typename...Args>
void multidraw2ndPass(const std::vector<uint64_t> &Handles, Args... args)
{
#if !defined(ANDROID) && !defined(USE_GLES2)
T::InstancedSecondPassShader::getInstance()->use();
#ifndef ANDROID
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
T::Instance));
#endif
uint64_t nulltex[10] = {};
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
{
@ -1314,14 +1313,13 @@ void multidraw2ndPass(const std::vector<uint64_t> &Handles, Args... args)
Expand(nulltex, T::SecondPassTextures, Handles[0], Handles[1],
Handles[2]);
T::InstancedSecondPassShader::getInstance()->setUniforms(args...);
#ifndef ANDROID
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
(const void*)(SolidPassCmd::getInstance()->Offset[T::MaterialType]
* sizeof(DrawElementsIndirectCommand)),
(int)SolidPassCmd::getInstance()->Size[T::MaterialType],
(int)sizeof(DrawElementsIndirectCommand));
#endif
}
#endif
} // multidraw2ndPass
// ----------------------------------------------------------------------------
@ -1333,7 +1331,7 @@ void IrrDriver::renderSolidSecondPass()
uint64_t DiffuseHandle = 0, SpecularHandle = 0, SSAOHandle = 0, DepthHandle = 0;
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
DiffuseHandle = glGetTextureSamplerHandleARB(m_rtts->getRenderTarget(RTT_DIFFUSE),
@ -1384,6 +1382,7 @@ void IrrDriver::renderSolidSecondPass()
renderMeshes2ndPass<GrassMat, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
renderMeshes2ndPass<NormalMat, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
@ -1406,17 +1405,17 @@ void IrrDriver::renderSolidSecondPass()
SpecularHandle, SSAOHandle, DepthHandle);
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir,
irr_driver->getSunDirection());
#ifndef ANDROID
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
(const void*)(SolidPassCmd::getInstance()->Offset[GrassMat::MaterialType]
* sizeof(DrawElementsIndirectCommand)),
(int)SolidPassCmd::getInstance()->Size[GrassMat::MaterialType],
(int)sizeof(DrawElementsIndirectCommand));
#endif
}
}
}
else if (CVS->supportsIndirectInstancingRendering())
else
#endif
if (CVS->supportsIndirectInstancingRendering())
{
renderInstancedMeshes2ndPass<DefaultMaterial>(DiffSpecSSAOTex);
renderInstancedMeshes2ndPass<AlphaRef>(DiffSpecSSAOTex);
@ -1473,7 +1472,7 @@ static void renderInstancedMeshNormals()
template<typename T>
static void renderMultiMeshNormals()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
NormalVisualizer::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
@ -1774,7 +1773,7 @@ void renderInstancedShadow(unsigned cascade, Args ...args)
template<typename T, typename...Args>
static void multidrawShadow(unsigned i, Args ...args)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
T::InstancedShadowPassShader::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
InstanceTypeShadow));
@ -1793,7 +1792,7 @@ static void multidrawShadow(unsigned i, Args ...args)
// ----------------------------------------------------------------------------
void IrrDriver::renderShadows()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
@ -1948,7 +1947,7 @@ void renderRSMShadow(Args ...args)
template<typename T, typename... Args>
void multidrawRSM(Args...args)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
T::InstancedRSMShader::getInstance()->use();
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
InstanceTypeRSM));

View File

@ -247,7 +247,7 @@ class RadianceHintsConstructionShader
public:
RadianceHintsConstructionShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "slicedscreenquad.vert",
@ -278,7 +278,7 @@ class NVWorkaroundRadianceHintsConstructionShader
public:
NVWorkaroundRadianceHintsConstructionShader()
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
loadProgram(OBJECT,GL_VERTEX_SHADER,"slicedscreenquad_nvworkaround.vert",
GL_GEOMETRY_SHADER, "rhpassthrough.geom",
GL_FRAGMENT_SHADER, "rh.frag");

View File

@ -76,10 +76,6 @@ RTT::RTT(size_t width, size_t height)
// All RTTs are currently RGBA16F mostly with stencil. The four tmp RTTs are the same size
// as the screen, for use in post-processing.
#ifdef ANDROID
#define GL_BGRA GL_RGBA
#define GL_BGR GL_RGB
#endif
RenderTargetTextures[RTT_TMP1] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
RenderTargetTextures[RTT_TMP2] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);

View File

@ -64,7 +64,9 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
GLuint id = glCreateShader(type);
std::ostringstream code;
#if !defined(ANDROID) && !defined(USE_GLES2)
code << "#version " << CVS->getGLSLVersion()<<"\n";
#endif
// Some drivers report that the compute shaders extension is available,
// but they report only OpenGL 3.x version, and thus these extensions

View File

@ -178,7 +178,9 @@ GLuint loadShader(const char * file, unsigned type)
{
GLuint Id = glCreateShader(type);
char versionString[20];
#if !defined(ANDROID) && !defined(USE_GLES2)
sprintf(versionString, "#version %d\n", CVS->getGLSLVersion());
#endif
std::string Code = versionString;
if (CVS->isAMDVertexShaderLayerUsable())
Code += "#extension GL_AMD_vertex_shader_layer : enable\n";

View File

@ -47,6 +47,7 @@ class LightspaceBoundingBoxShader
public:
LightspaceBoundingBoxShader()
{
#if !defined(ANDROID) && !defined(USE_GLES2)
loadProgram(OBJECT, GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp",
GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag");
assignSamplerNames(0, "depth", ST_NEAREST_FILTERED);
@ -54,7 +55,6 @@ public:
GLuint block_idx =
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
"BoundingBoxes");
#ifndef ANDROID
glShaderStorageBlockBinding(m_program, block_idx, 2);
#endif
} // LightspaceBoundingBoxShader
@ -67,12 +67,12 @@ class ShadowMatricesGenerationShader
public:
ShadowMatricesGenerationShader()
{
#if !defined(ANDROID) && !defined(USE_GLES2)
loadProgram(OBJECT, GL_COMPUTE_SHADER, "shadowmatrixgeneration.comp");
assignUniforms("SunCamMatrix");
GLuint block_idx =
glGetProgramResourceIndex(m_program,
GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
#ifndef ANDROID
glShaderStorageBlockBinding(m_program, block_idx, 2);
block_idx =
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,

View File

@ -186,6 +186,7 @@ void Skybox::generateCubeMapFromTextures()
glBindTexture(GL_TEXTURE_CUBE_MAP, m_cube_map);
#ifndef ANDROID
#if !defined(USE_GLES2)
if (CVS->isTextureCompressionEnabled())
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
@ -193,6 +194,7 @@ void Skybox::generateCubeMapFromTextures()
GL_UNSIGNED_BYTE, (GLvoid*)rgba[i]);
}
else
#endif
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
GL_SRGB_ALPHA, size, size, 0, GL_BGRA,
@ -321,7 +323,7 @@ Skybox::Skybox(const std::vector<video::ITexture *> &skybox_textures)
{
m_skybox_textures = skybox_textures;
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
#endif

View File

@ -344,7 +344,7 @@ static void setTexture(GLMesh &mesh, unsigned i, bool is_srgb,
getUnicolorTexture(video::SColor(255, 127, 127, 127));
}
compressTexture(mesh.textures[i], is_srgb);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
if (!mesh.TextureHandles[i])
@ -425,7 +425,7 @@ void initTexturesTransparent(GLMesh &mesh)
return;
}
compressTexture(mesh.textures[0], true);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
if (!mesh.TextureHandles[0])

View File

@ -305,7 +305,7 @@ void STKMeshSceneNode::render()
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
if (!mesh.TextureHandles[0])
@ -350,7 +350,7 @@ void STKMeshSceneNode::render()
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
GLuint64 DiffuseHandle =
@ -462,7 +462,7 @@ void STKMeshSceneNode::render()
tmpcol.getBlue() / 255.0f);
compressTexture(mesh.textures[0], true);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
if (!mesh.TextureHandles[0])
@ -502,7 +502,7 @@ void STKMeshSceneNode::render()
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->isAZDOEnabled())
{
if (!mesh.TextureHandles[0])

View File

@ -858,7 +858,7 @@ PROFILER_POP_CPU_MARKER();
poly_count[SOLID_NORMAL_AND_DEPTH_PASS] += SolidPoly;
poly_count[SHADOW_PASS] += ShadowPoly;
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
#endif

View File

@ -38,10 +38,10 @@ public:
CommandBuffer()
{
glGenBuffers(1, &drawindirectcmd);
#ifndef ANDROID_DEVICE
#if !defined(ANDROID) && !defined(USE_GLES2)
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, drawindirectcmd);
#endif
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
{
glBufferStorage(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_MAP_PERSISTENT_BIT | GL_MAP_WRITE_BIT);
@ -51,7 +51,7 @@ public:
{
#endif
glBufferData(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_STREAM_DRAW);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
}
#endif
}

View File

@ -20,8 +20,9 @@
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#ifdef ANDROID_DEVICE
#include "jni/irrlicht/source/Irrlicht/COGLES2Texture.h"
#if defined(ANDROID) || defined(USE_GLES2)
#define _IRR_COMPILE_WITH_OGLES2_
#include "../../lib/irrlicht/source/Irrlicht/COGLES2Texture.h"
#else
#include "../../lib/irrlicht/source/Irrlicht/COpenGLTexture.h"
#endif
@ -33,7 +34,7 @@
GLuint getTextureGLuint(irr::video::ITexture *tex)
{
#ifdef ANDROID_DEVICE
#if defined(ANDROID) || defined(USE_GLES2)
return static_cast<irr::video::COGLES2Texture*>(tex)->getOpenGLTextureName();
#else
return static_cast<irr::video::COpenGLTexture*>(tex)->getOpenGLTextureName();
@ -43,7 +44,7 @@ GLuint getTextureGLuint(irr::video::ITexture *tex)
GLuint getDepthTexture(irr::video::ITexture *tex)
{
assert(tex->isRenderTarget());
#ifdef ANDROID_DEVICE
#if defined(ANDROID) || defined(USE_GLES2)
return 1; //static_cast<irr::video::COGLES2FBODepthTexture*>(tex)->DepthRenderBuffer;
#else
return static_cast<irr::video::COpenGLFBOTexture*>(tex)->DepthBufferTexture;
@ -59,11 +60,6 @@ void resetTextureTable()
unicolor_cache.clear();
}
#ifdef ANDROID
#define GL_BGRA GL_RGBA
#define GL_BGR GL_RGB
#endif
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
{
if (AlreadyTransformedTexture.find(tex) != AlreadyTransformedTexture.end())
@ -109,14 +105,16 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
}
}
#ifndef ANDROID
if (!CVS->isTextureCompressionEnabled())
{
#if !defined(ANDROID) && !defined(USE_GLES2)
if (srgb)
internalFormat = (tex->hasAlpha()) ? GL_SRGB_ALPHA : GL_SRGB;
else
#endif
internalFormat = (tex->hasAlpha()) ? GL_RGBA : GL_RGB;
}
#if !defined(ANDROID) && !defined(USE_GLES2)
else
{
if (srgb)
@ -187,7 +185,7 @@ bool loadCompressedTexture(const std::string& compressed_tex)
*/
void saveCompressedTexture(const std::string& compressed_tex)
{
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
int internal_format, width, height, size, compressionSuccessful;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&internal_format);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, (GLint *)&width);

View File

@ -39,7 +39,7 @@ VAOManager::VAOManager()
{
glGenBuffers(1, &instance_vbo[i]);
glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[i]);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
{
glBufferStorage(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
@ -90,7 +90,7 @@ resizeBufferIfNecessary(size_t &lastIndex, size_t newLastIndex, size_t bufferSiz
GLuint newVBO;
glGenBuffers(1, &newVBO);
glBindBuffer(type, newVBO);
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
{
glBufferStorage(type, bufferSize *stride, 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
@ -293,7 +293,7 @@ void VAOManager::append(scene::IMeshBuffer *mb, VTXTYPE tp)
size_t old_idx_cnt = last_index[tp];
regenerateBuffer(tp, old_vtx_cnt + mb->getVertexCount(), old_idx_cnt + mb->getIndexCount());
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
{
void *tmp = (char*)VBOPtr[tp] + old_vtx_cnt * getVertexPitch(tp);
@ -305,7 +305,7 @@ void VAOManager::append(scene::IMeshBuffer *mb, VTXTYPE tp)
glBindBuffer(GL_ARRAY_BUFFER, vbo[tp]);
glBufferSubData(GL_ARRAY_BUFFER, old_vtx_cnt * getVertexPitch(tp), mb->getVertexCount() * getVertexPitch(tp), mb->getVertices());
}
#ifndef ANDROID
#if !defined(ANDROID) && !defined(USE_GLES2)
if (CVS->supportsAsyncInstanceUpload())
{
void *tmp = (char*)IBOPtr[tp] + old_idx_cnt * sizeof(u16);

View File

@ -1961,10 +1961,12 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
FrameBuffer* fb = mvw->getFrameBuffer();
if (fb != NULL && fb->getRTT().size() > 0)
{
#ifndef ANDROID
#if !defined(ANDROID)
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
rect, core::rect<s32>(0, 0, 512, 512), NULL, SColor(255, 255, 255, 255), true);
#if !defined(ANDROID)
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
}

View File

@ -170,39 +170,47 @@ void MainLoop::run()
IrrlichtDevice* device = irr_driver->getDevice();
m_curr_time = device->getTimer()->getRealTime();
#if defined(ANDROID_DEVICE)
auto sensorManager = ASensorManager_getInstance();
auto accelerometerSensor = ASensorManager_getDefaultSensor(sensorManager,
ASENSOR_TYPE_ACCELEROMETER);
ASENSOR_TYPE_ACCELEROMETER);
auto sensorEventQueue = ASensorManager_createEventQueue(sensorManager,
((android_app*)global_android_app)->looper, LOOPER_ID_USER, NULL, NULL);
ASensorEventQueue_enableSensor(sensorEventQueue,
accelerometerSensor);
((android_app*)global_android_app)->looper,
LOOPER_ID_USER, NULL, NULL);
ASensorEventQueue_enableSensor(sensorEventQueue, accelerometerSensor);
// We'd like to get 60 events per second (in us).
ASensorEventQueue_setEventRate(sensorEventQueue,
accelerometerSensor, (1000L/1)*1000);
ASensorEventQueue_setEventRate(sensorEventQueue, accelerometerSensor,
(1000L/1)*1000);
#endif
while(!m_abort)
{
#if defined(ANDROID_DEVICE)
int ident;
int events;
struct android_poll_source* source;
while ((ident=ALooper_pollAll(0, NULL, &events,
(void**)&source)) >= 0) {
while ((ident = ALooper_pollAll(0, NULL, &events,
(void**)&source)) >= 0)
{
// Process this event.
if (source != NULL) {
if (source != NULL)
{
source->process((android_app*)global_android_app, source);
}
// If a sensor has data, process it now.
if (ident == LOOPER_ID_USER) {
if (accelerometerSensor != NULL) {
if (ident == LOOPER_ID_USER)
{
if (accelerometerSensor != NULL)
{
ASensorEvent event;
while (ASensorEventQueue_getEvents(sensorEventQueue,
&event, 1) > 0) {
&event, 1) > 0)
{
LOGI("accelerometer: x=%f y=%f z=%f",
event.acceleration.x, event.acceleration.y,
event.acceleration.z);
event.acceleration.x, event.acceleration.y,
event.acceleration.z);
post_key(1, event.acceleration.z < 0);
post_key(0, event.acceleration.z > 4);
post_key(3, event.acceleration.y > 2);
@ -212,6 +220,7 @@ void MainLoop::run()
}
}
#endif
PROFILER_PUSH_CPU_MARKER("Main loop", 0xFF, 0x00, 0xF7);
m_prev_time = m_curr_time;