Fix glBlendFunc reset after stencil rendering and other minor fixes.
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@3807 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
558b56fc30
commit
9fb95f9009
@ -1639,7 +1639,6 @@ namespace video
|
||||
{
|
||||
if (!CurrentTexture[i])
|
||||
continue;
|
||||
//Thibault : strange Blue artifact on textures in exemple 02
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
|
||||
#ifdef GL_EXT_texture_lod_bias
|
||||
@ -1695,10 +1694,8 @@ namespace video
|
||||
}
|
||||
testGLError();
|
||||
|
||||
// TODO ogl-es
|
||||
// fillmode
|
||||
// if (resetAllRenderStates || (lastmaterial.Wireframe != material.Wireframe) || (lastmaterial.PointCloud != material.PointCloud))
|
||||
// glPolygonMode(GL_FRONT_AND_BACK, material.Wireframe ? GL_LINE : material.PointCloud? GL_POINT : GL_FILL);
|
||||
// for ogl-es this is emulated by other polygon primitives during rendering
|
||||
|
||||
// shademode
|
||||
if (resetAllRenderStates || (lastmaterial.GouraudShading != material.GouraudShading))
|
||||
@ -1752,7 +1749,7 @@ namespace video
|
||||
testGLError();
|
||||
|
||||
// zwrite
|
||||
// if (resetAllRenderStates || lastmaterial.ZWriteEnable != material.ZWriteEnable)
|
||||
// if (resetAllRenderStates || lastmaterial.ZWriteEnable != material.ZWriteEnable)
|
||||
{
|
||||
if (material.ZWriteEnable && (AllowZWriteOnTransparent || !material.isTransparent()))
|
||||
{
|
||||
@ -1884,38 +1881,18 @@ namespace video
|
||||
// Anti aliasing
|
||||
if (resetAllRenderStates || lastmaterial.AntiAliasing != material.AntiAliasing)
|
||||
{
|
||||
// if (FeatureAvailable[IRR_ARB_multisample])
|
||||
{
|
||||
if (material.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
else if (lastmaterial.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
|
||||
//TODO : OpenGL ES 2.0 Port GL_MULTISAMPLE
|
||||
//if ((AntiAlias >= 2) && (material.AntiAliasing & (EAAM_SIMPLE|EAAM_QUALITY)))
|
||||
// glEnable(GL_MULTISAMPLE);
|
||||
//else
|
||||
// glDisable(GL_MULTISAMPLE);
|
||||
}
|
||||
if (AntiAlias >= 2)
|
||||
{
|
||||
//TODO : OpenGL ES 2.0 Port GL_LINE_SMOOTH
|
||||
//if (material.AntiAliasing & EAAM_LINE_SMOOTH)
|
||||
// glEnable(GL_LINE_SMOOTH);
|
||||
//else if (lastmaterial.AntiAliasing & EAAM_LINE_SMOOTH)
|
||||
// glDisable(GL_LINE_SMOOTH);
|
||||
//if (material.AntiAliasing & EAAM_POINT_SMOOTH)
|
||||
// // often in software, and thus very slow
|
||||
// glEnable(GL_POINT_SMOOTH);
|
||||
//else if (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH)
|
||||
// glDisable(GL_POINT_SMOOTH);
|
||||
// other settings cannot be changed in ogl-es
|
||||
}
|
||||
}
|
||||
testGLError();
|
||||
|
||||
setWrapMode(material);
|
||||
|
||||
//Thibault : Strange blue Artifact in exemple 01
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
testGLError();
|
||||
}
|
||||
@ -2174,11 +2151,6 @@ namespace video
|
||||
// GLint shadeModel;
|
||||
//TODO : OpenGL ES 2.0 Port glGetIntegerv
|
||||
//glGetIntegerv(GL_SHADE_MODEL, &shadeModel);
|
||||
// GLint blendSrc, blendDst;
|
||||
//TODO : OpenGL ES 2.0 Port glGetIntegerv
|
||||
//glGetIntegerv(GL_BLEND_SRC, &blendSrc);
|
||||
//glGetIntegerv(GL_BLEND_DST, &blendDst);
|
||||
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
@ -2227,10 +2199,9 @@ namespace video
|
||||
glDepthMask(depthMask);
|
||||
//TODO : OpenGL ES 2.0 Port glShadeModel
|
||||
//glShadeModel(shadeModel);
|
||||
if (! BlendEnabled)
|
||||
if (!BlendEnabled)
|
||||
glDisable(GL_BLEND);
|
||||
//TODO :
|
||||
//glBlendFunc(blendSrc, blendDst);
|
||||
glBlendFunc(getGLBlend(SourceFactor), getGLBlend(DestFactor));
|
||||
testGLError();
|
||||
}
|
||||
|
||||
@ -2654,7 +2625,7 @@ namespace video
|
||||
}
|
||||
}
|
||||
|
||||
u32 getGLBlend(E_BLEND_FACTOR factor)
|
||||
u32 COGLES2Driver::getGLBlend(E_BLEND_FACTOR factor)
|
||||
{
|
||||
u32 r = 0;
|
||||
switch (factor)
|
||||
|
@ -348,6 +348,7 @@ namespace video
|
||||
|
||||
void enableBlend();
|
||||
void disableBlend();
|
||||
u32 COGLES2Driver::getGLBlend(E_BLEND_FACTOR factor);
|
||||
void blendFunc(E_BLEND_FACTOR sFactor, E_BLEND_FACTOR dFactor);
|
||||
|
||||
private:
|
||||
|
@ -107,29 +107,20 @@ namespace irr
|
||||
|
||||
/* Matrices Upload */
|
||||
core::matrix4 world = Driver->getTransform( ETS_WORLD );
|
||||
//statusOk &= setVertexShaderConstant( "uWorldMatrix", world.pointer(), 16 );
|
||||
//glUniformMatrix4fv(locWorldMatrix, 1, false, world.pointer() );
|
||||
setUniform( WORLD_MATRIX, world.pointer() );
|
||||
|
||||
core::matrix4 worldViewProj = Driver->getTransform( video::ETS_PROJECTION );
|
||||
worldViewProj *= Driver->getTransform( video::ETS_VIEW );
|
||||
worldViewProj *= Driver->getTransform( ETS_WORLD );
|
||||
//statusOk &= setVertexShaderConstant( "uMvpMatrix", worldViewProj.pointer(), 16 );
|
||||
//glUniformMatrix4fv(locMvpMatrix, 1, false, worldViewProj.pointer());
|
||||
setUniform( MVP_MATRIX, worldViewProj.pointer() );
|
||||
|
||||
/* Textures Upload */
|
||||
//statusOk &= setVertexShaderConstant("uTextureUnit", (f32*)TextureUnits, MAX_TEXTURE_UNITS);
|
||||
//statusOk &= setVertexShaderConstant( "uTextureUnit0", ( f32* ) & TextureUnits[0], 1 );
|
||||
setUniform( TEXTURE_UNIT0, &TextureUnits[0] );
|
||||
//statusOk &= setVertexShaderConstant( "uTextureUnit1", ( f32* ) & TextureUnits[1], 1 );
|
||||
setUniform( TEXTURE_UNIT1, &TextureUnits[1] );
|
||||
|
||||
//statusOk &= setVertexShaderConstant( "uUseTexture", ( f32* )UseTexture, MAX_TEXTURE_UNITS );
|
||||
setUniform( USE_TEXTURE, UseTexture, MAX_TEXTURE_UNITS );
|
||||
//statusOk &= setVertexShaderConstant( "uUseTexMatrix", ( f32* )UseTexMatrix, MAX_TEXTURE_UNITS );
|
||||
setUniform( USE_TEXTURE_MATRIX, UseTexMatrix, MAX_TEXTURE_UNITS );
|
||||
//statusOk &= setVertexShaderConstant( "uTextureMatrix", ( f32* )TextureMatrix, MAX_TEXTURE_UNITS * 16 );
|
||||
setUniform( TEXTURE_MATRIX, TextureMatrix, MAX_TEXTURE_UNITS );
|
||||
core::matrix4 invWorld;
|
||||
|
||||
@ -180,23 +171,14 @@ namespace irr
|
||||
}
|
||||
}
|
||||
//statusOk &= setVertexShaderConstant( "uLighting", ( f32* ) & Lighting, 1 );
|
||||
//statusOk &= setVertexShaderConstant( "uUseLight", ( f32* )UseLight, MAX_LIGHTS );
|
||||
setUniform( USE_LIGHT, UseLight, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightPosition", ( f32* )LightPosition, MAX_LIGHTS * 4 );
|
||||
setUniform( LIGHT_POSITION, LightPosition, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightDirection", ( f32* )LightDirection, MAX_LIGHTS * 3 );
|
||||
setUniform( LIGHT_DIRECTION, LightDirection, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightAmbient", ( f32* )LightAmbient, MAX_LIGHTS * 4 );
|
||||
setUniform( LIGHT_AMBIENT, LightAmbient, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightDiffuse", ( f32* )LightDiffuse, MAX_LIGHTS * 4 );
|
||||
setUniform( LIGHT_DIFFUSE, LightDiffuse, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightSpecular", ( f32* )LightSpecular, MAX_LIGHTS * 4 );
|
||||
setUniform( LIGHT_SPECULAR, LightSpecular, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightAttenuation", ( f32* )LightAttenuation, MAX_LIGHTS * 3 );
|
||||
setUniform( LIGHT_ATTENUATION, LightAttenuation, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightExponent", LightExponent, MAX_LIGHTS );
|
||||
setUniform( LIGHT_EXPONENT, LightExponent, MAX_LIGHTS );
|
||||
//statusOk &= setVertexShaderConstant( "uLightCutoff", LightCutoff, MAX_LIGHTS );
|
||||
setUniform( LIGHT_CUTOFF, LightCutoff, MAX_LIGHTS );
|
||||
|
||||
AmbientColor = Driver->getAmbientLight();
|
||||
@ -224,7 +206,7 @@ namespace irr
|
||||
}
|
||||
|
||||
/* Eye/Camera Position in ObjectSpace */
|
||||
if ( Clip || RenderMode == 10 || RenderMode == 11 ) // Need clipping or reflection
|
||||
if ( Clip || RenderMode == EMT_SPHERE_MAP || RenderMode == EMT_REFLECTION_2_LAYER ) // Need clipping or reflection
|
||||
{
|
||||
if ( !Lighting )
|
||||
Driver->getTransform( ETS_WORLD ).getInverse( invWorld );
|
||||
@ -233,17 +215,12 @@ namespace irr
|
||||
Driver->getTransform( video::ETS_VIEW ).getInverse( inverseView );
|
||||
inverseView.transformVect( viewPos );
|
||||
invWorld.transformVect( viewPos );
|
||||
//setVertexShaderConstant( "uEyePos", &viewPos.X, 3 );
|
||||
setUniform( EYE_POSITION, &viewPos.X );
|
||||
}
|
||||
|
||||
//statusOk &= setVertexShaderConstant( "uClip", ( f32* ) & Clip );
|
||||
setUniform( CLIP, &Clip );
|
||||
//statusOk &= setVertexShaderConstant( "uClipPlane", ( f32* ) & ClipPlane );
|
||||
setUniform( CLIP_PLANE, &ClipPlane );
|
||||
//statusOk &= setVertexShaderConstant( "uRenderMode", ( f32* ) & RenderMode );
|
||||
setUniform( RENDER_MODE, &RenderMode );
|
||||
//statusOk &= setVertexShaderConstant( "uNormalize", ( f32* ) & Normalize, 1 );
|
||||
|
||||
return statusOk ;
|
||||
};
|
||||
@ -273,7 +250,7 @@ namespace irr
|
||||
if ( UseTexture[i] )
|
||||
{
|
||||
UseTexMatrix[i] = false;
|
||||
core::matrix4 texMat = material.getTextureMatrix( i );
|
||||
const core::matrix4& texMat = material.getTextureMatrix( i );
|
||||
if ( !texMat.isIdentity() )
|
||||
{
|
||||
UseTexMatrix[i] = true;
|
||||
@ -287,7 +264,6 @@ namespace irr
|
||||
{
|
||||
ColorMaterial = material.ColorMaterial;
|
||||
setUniform( COLOR_MATERIAL, &ColorMaterial );
|
||||
|
||||
}
|
||||
if ( MaterialAmbient != material.AmbientColor )
|
||||
{
|
||||
|
@ -24,7 +24,6 @@ namespace video
|
||||
{
|
||||
public:
|
||||
COGLES2Renderer2d( COGLES2Driver* driver, io::IFileSystem* fs );
|
||||
virtual ~COGLES2Renderer2d() {};
|
||||
|
||||
void useTexture( bool param );
|
||||
void useAlphaTest( bool param );
|
||||
|
Loading…
x
Reference in New Issue
Block a user