Some minor changes for emscripten support.

This commit is contained in:
Martín Lucas Golini
2013-11-08 15:53:54 -03:00
parent 0e2b3d0812
commit 10def04538
5 changed files with 26 additions and 9 deletions

View File

@@ -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

View File

@@ -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 $@

View File

@@ -131,7 +131,7 @@ void cBatchRenderer::Flush() {
if ( NULL != mTexture ) {
mTF->Bind( mTexture );
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) , alloc );
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) , alloc );
} else {
GLi->Disable( GL_TEXTURE_2D );
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );

View File

@@ -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
}

View File

@@ -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),