diff --git a/premake4.lua b/premake4.lua index 64272cde5..8ba9d801b 100644 --- a/premake4.lua +++ b/premake4.lua @@ -312,7 +312,7 @@ function build_link_configuration( package_name, use_ee_icon ) add_cross_config_links() configuration "emscripten" - if _OPTIONS["with-gles1"] then + if _OPTIONS["with-gles1"] and not _OPTIONS["with-gles2"] then linkoptions{ "-s LEGACY_GL_EMULATION=1" } end diff --git a/projects/emscripten/make.sh b/projects/emscripten/make.sh index 46ea26d47..af9becf0d 100755 --- a/projects/emscripten/make.sh +++ b/projects/emscripten/make.sh @@ -1,6 +1,6 @@ #!/bin/sh cd $(dirname "$0") -premake4 --file=../../premake4.lua --with-gles2 --with-static-eepp --with-static-freetype --platform=emscripten --with-backend=SDL gmake +premake4 --file=../../premake4.lua --with-gles1 --with-gles2 --with-static-eepp --with-static-freetype --platform=emscripten --with-backend=SDL gmake cd ../../make/emscripten/ sed -i 's/-rcs/rcs/g' *.make emmake make $@ diff --git a/src/eepp/graphics/cbatchrenderer.cpp b/src/eepp/graphics/cbatchrenderer.cpp index 695d999a4..f60ed0f65 100755 --- a/src/eepp/graphics/cbatchrenderer.cpp +++ b/src/eepp/graphics/cbatchrenderer.cpp @@ -131,7 +131,7 @@ void cBatchRenderer::Flush() { if ( NULL != mTexture ) { mTF->Bind( mTexture ); - GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) , alloc ); + GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) , alloc ); } else { GLi->Disable( GL_TEXTURE_2D ); GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY ); diff --git a/src/eepp/graphics/renderer/cgl.cpp b/src/eepp/graphics/renderer/cgl.cpp index 2b4d5cb15..fb1146636 100644 --- a/src/eepp/graphics/renderer/cgl.cpp +++ b/src/eepp/graphics/renderer/cgl.cpp @@ -43,7 +43,7 @@ cGL * cGL::CreateSingleton( EEGL_version ver ) { } case GLv_3CP: { - #if defined( EE_GL3_ENABLED ) + #if defined( EE_GL3_ENABLED ) || defined( EE_GLES2 ) ms_singleton = eeNew( cRendererGL3CP, () ); break; #endif @@ -234,7 +234,7 @@ bool cGL::PointSpriteSupported() { bool cGL::ShadersSupported() { #ifdef EE_GLES - return ( GLv_ES2 == Version() || GLv_3 == Version() ); + return ( GLv_ES2 == Version() || GLv_3 == Version() || GLv_3CP == Version() ); #else return IsExtension( EEGL_ARB_shading_language_100 ) && IsExtension( EEGL_ARB_shader_objects ) && IsExtension( EEGL_ARB_vertex_shader ) && IsExtension( EEGL_ARB_fragment_shader ); #endif @@ -451,6 +451,7 @@ void cGL::LineSmooth() { } void cGL::LineSmooth( const bool& Enable ) { + #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN if ( Enable ) { GLi->Enable( GL_LINE_SMOOTH ); } else { @@ -458,11 +459,15 @@ void cGL::LineSmooth( const bool& Enable ) { } BitOp::WriteBitKey( &mStateFlags, GLSF_LINE_SMOOTH, Enable ? 1 : 0 ); + #endif } void cGL::LineWidth(GLfloat width) { if ( width != mLineWidth ) { - if ( GLv_3CP != Version() ) { + #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN + if ( GLv_3CP != Version() ) + #endif + { glLineWidth( width ); } mLineWidth = width; @@ -587,7 +592,7 @@ const int& cGL::QuadVertexs() const { } void cGL::BindVertexArray ( GLuint array ) { -#if !defined( EE_GLES ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#if !defined( EE_GLES ) if ( mCurVAO != array ) { glBindVertexArray( array ); @@ -597,13 +602,13 @@ void cGL::BindVertexArray ( GLuint array ) { } void cGL::DeleteVertexArrays ( GLsizei n, const GLuint *arrays ) { -#if !defined( EE_GLES ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#if !defined( EE_GLES ) glDeleteVertexArrays( n, arrays ); #endif } void cGL::GenVertexArrays ( GLsizei n, GLuint *arrays ) { -#if !defined( EE_GLES ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#if !defined( EE_GLES ) glGenVertexArrays( n, arrays ); #endif } diff --git a/src/eepp/graphics/renderer/crenderergl3cp.cpp b/src/eepp/graphics/renderer/crenderergl3cp.cpp index fc2a2a2e3..a49aad1d1 100644 --- a/src/eepp/graphics/renderer/crenderergl3cp.cpp +++ b/src/eepp/graphics/renderer/crenderergl3cp.cpp @@ -37,12 +37,24 @@ const char * EEGL3CP_PLANES_NAME[] = { "dgl_ClipPlane[5]" }; +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN + const GLchar * EEGL3CP_SHADER_BASE_VS = #include "shaders/basegl3cp.vert" const GLchar * EEGL3CP_SHADER_BASE_FS = #include "shaders/basegl3cp.frag" +#else + +const GLchar * EEGL3CP_SHADER_BASE_VS = +#include "shaders/basegl3.vert" + +const GLchar * EEGL3CP_SHADER_BASE_FS = +#include "shaders/basegl3.frag" + +#endif + cRendererGL3CP::cRendererGL3CP() : mProjectionMatrix_id(0), mModelViewMatrix_id(0),