mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 10:36:30 +03:00
Fixed blend func on OpenGL ES.
--HG-- branch : dev
This commit is contained in:
@@ -93,6 +93,8 @@ class EE_API Renderer {
|
||||
|
||||
void blendFunc( unsigned int sfactor, unsigned int dfactor );
|
||||
|
||||
void blendFuncSeparate( unsigned int sfactorRGB, unsigned int dfactorRGB, unsigned int sfactorAlpha, unsigned int dfactorAlpha );
|
||||
|
||||
void viewport( int x, int y, int width, int height );
|
||||
|
||||
void lineSmooth( const bool& enable );
|
||||
|
||||
@@ -16,13 +16,13 @@ void BlendMode::setMode( const EE_BLEND_MODE& blend, bool force ) {
|
||||
switch (blend) {
|
||||
case ALPHA_NORMAL:
|
||||
if ( GLi->isExtension( EEGL_EXT_blend_func_separate ) )
|
||||
glBlendFuncSeparateEXT( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||
GLi->blendFuncSeparate( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||
else
|
||||
GLi->blendFunc(GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
case ALPHA_BLENDONE:
|
||||
if ( GLi->isExtension( EEGL_EXT_blend_func_separate ) )
|
||||
glBlendFuncSeparateEXT( GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE );
|
||||
GLi->blendFuncSeparate( GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE );
|
||||
else
|
||||
GLi->blendFunc(GL_SRC_ALPHA , GL_ONE);
|
||||
break;
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef void (APIENTRY * pglRenderbufferStorage) (GLenum target, GLenum internal
|
||||
typedef void (APIENTRY * pglFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef GLenum (APIENTRY * pglCheckFramebufferStatus) (GLenum target);
|
||||
typedef void (APIENTRY * pglBindRenderbuffer) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (APIENTRY * pglBlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
|
||||
Renderer * GLi = NULL;
|
||||
|
||||
@@ -230,14 +231,21 @@ void Renderer::init() {
|
||||
writeExtension( EEGL_ARB_vertex_array_object , isExtension( "GL_OES_vertex_array_object" ) );
|
||||
}
|
||||
|
||||
if ( !isExtension( EEGL_EXT_blend_func_separate ) ) {
|
||||
writeExtension( EEGL_EXT_blend_func_separate , isExtension( "GL_OES_blend_func_separate" ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef EE_GLES2
|
||||
writeExtension( EEGL_EXT_framebuffer_object , 1 );
|
||||
writeExtension( EEGL_ARB_vertex_buffer_object , 1 );
|
||||
writeExtension( EEGL_ARB_shader_objects , 1 );
|
||||
writeExtension( EEGL_ARB_vertex_shader , 1 );
|
||||
writeExtension( EEGL_ARB_fragment_shader , 1 );
|
||||
if ( GLv_ES2 == version() ) {
|
||||
writeExtension( EEGL_EXT_framebuffer_object , 1 );
|
||||
writeExtension( EEGL_ARB_vertex_buffer_object , 1 );
|
||||
writeExtension( EEGL_ARB_shader_objects , 1 );
|
||||
writeExtension( EEGL_ARB_vertex_shader , 1 );
|
||||
writeExtension( EEGL_ARB_fragment_shader , 1 );
|
||||
writeExtension( EEGL_EXT_blend_func_separate , 1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN
|
||||
@@ -471,6 +479,16 @@ void Renderer::blendFunc ( unsigned int sfactor, unsigned int dfactor ) {
|
||||
glBlendFunc( sfactor, dfactor );
|
||||
}
|
||||
|
||||
void Renderer::blendFuncSeparate( unsigned int sfactorRGB, unsigned int dfactorRGB, unsigned int sfactorAlpha, unsigned int dfactorAlpha ) {
|
||||
static pglBlendFuncSeparate eeglBlendFuncSeparate = NULL;
|
||||
|
||||
if ( NULL == eeglBlendFuncSeparate )
|
||||
eeglBlendFuncSeparate = (pglBlendFuncSeparate)getProcAddress( "glBlendFuncSeparate" );
|
||||
|
||||
if ( NULL != eeglBlendFuncSeparate )
|
||||
eeglBlendFuncSeparate( sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha );
|
||||
}
|
||||
|
||||
void Renderer::setShader( ShaderProgram * Shader ) {
|
||||
#ifdef EE_SHADERS_SUPPORTED
|
||||
if ( NULL != Shader ) {
|
||||
|
||||
@@ -1057,7 +1057,7 @@ void UIWindow::setTitle( const String& text ) {
|
||||
}
|
||||
|
||||
mTitle->setEnabled( false );
|
||||
mTitle->setVisible( true );
|
||||
mTitle->setVisible( !( mStyleConfig.WinFlags & UI_WIN_NO_BORDER ) );
|
||||
}
|
||||
|
||||
fixTitleSize();
|
||||
|
||||
@@ -950,7 +950,7 @@ void EETest::createDecoratedWindow() {
|
||||
if ( "Hide Border" == txt ) {
|
||||
win->setWinFlags( win->getWinFlags() | UI_WIN_NO_BORDER );
|
||||
menuItem->setText( "Show Border" );
|
||||
} else if ( "Show Border" ) {
|
||||
} else if ( "Show Border" == txt ) {
|
||||
win->setWinFlags( win->getWinFlags() & ~UI_WIN_NO_BORDER );
|
||||
menuItem->setText( "Hide Border" );
|
||||
} else if ( "Close" == txt ) {
|
||||
|
||||
Reference in New Issue
Block a user