Error message check added for egl setup.
Updated to latest OpenGL driver code to fix AntiAlias etc. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@3178 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
6afbf25467
commit
253a79d605
|
@ -102,6 +102,7 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|||
EglSurface = eglCreateWindowSurface(EglDisplay, config, NULL, NULL);
|
||||
if (EGL_NO_SURFACE==EglSurface)
|
||||
{
|
||||
testEGLError();
|
||||
os::Printer::log("Could not create surface for OpenGL-ES1 display.");
|
||||
}
|
||||
|
||||
|
@ -161,6 +162,7 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|||
//! destructor
|
||||
COGLES1Driver::~COGLES1Driver()
|
||||
{
|
||||
RequestedLights.clear();
|
||||
deleteMaterialRenders();
|
||||
deleteAllTextures();
|
||||
|
||||
|
@ -225,36 +227,6 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
// Reset The Current Viewport
|
||||
glViewport(0, 0, screenSize.Width, screenSize.Height);
|
||||
|
||||
// This needs an SMaterial flag to enable/disable later on, but should become default sometimes
|
||||
// glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
||||
// glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
setAmbientLight(SColorf(0.0f,0.0f,0.0f,0.0f));
|
||||
#ifdef GL_separate_specular_color
|
||||
if (FeatureAvailable[IRR_separate_specular_color])
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||
#endif
|
||||
// TODO ogl-es
|
||||
// glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
||||
glClearDepthf(1.0f);
|
||||
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glFrontFace( GL_CW );
|
||||
|
||||
if (AntiAlias>1)
|
||||
{
|
||||
if (MultiSamplingExtension)
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
}
|
||||
// currently disabled, because often in software, and thus very slow
|
||||
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
||||
// glEnable(GL_POINT_SMOOTH);
|
||||
|
||||
UserClipPlane.reallocate(MaxUserClipPlanes);
|
||||
UserClipPlaneEnabled.reallocate(MaxUserClipPlanes);
|
||||
for (i=0; i<MaxUserClipPlanes; ++i)
|
||||
|
@ -263,6 +235,25 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
UserClipPlaneEnabled.push_back(false);
|
||||
}
|
||||
|
||||
for (i=0; i<ETS_COUNT; ++i)
|
||||
setTransform(static_cast<E_TRANSFORMATION_STATE>(i), core::IdentityMatrix);
|
||||
|
||||
setAmbientLight(SColorf(0.0f,0.0f,0.0f,0.0f));
|
||||
#ifdef GL_EXT_separate_specular_color
|
||||
if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||
#endif
|
||||
// TODO ogl-es
|
||||
// glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
||||
|
||||
glClearDepthf(1.0f);
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
||||
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glFrontFace( GL_CW );
|
||||
|
||||
// create material renderers
|
||||
createMaterialRenderers();
|
||||
|
||||
|
@ -1762,8 +1753,8 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
if ((material.Shininess != 0.0f) &&
|
||||
(material.ColorMaterial != video::ECM_SPECULAR))
|
||||
{
|
||||
#ifdef GL_separate_specular_color
|
||||
if (FeatureAvailable[IRR_separate_specular_color])
|
||||
#ifdef GL_EXT_separate_specular_color
|
||||
if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||
#endif
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, material.Shininess);
|
||||
|
@ -1773,9 +1764,9 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
color[3] = material.SpecularColor.getAlpha() * inv;
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
|
||||
}
|
||||
#ifdef GL_separate_specular_color
|
||||
#ifdef GL_EXT_separate_specular_color
|
||||
else
|
||||
if (FeatureAvailable[IRR_separate_specular_color])
|
||||
if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
|
||||
#endif
|
||||
}
|
||||
|
@ -1963,8 +1954,18 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
// thickness
|
||||
if (resetAllRenderStates || lastmaterial.Thickness != material.Thickness)
|
||||
{
|
||||
glPointSize(material.Thickness);
|
||||
glLineWidth(material.Thickness);
|
||||
if (AntiAlias)
|
||||
{
|
||||
// glPointSize(core::clamp(static_cast<GLfloat>(material.Thickness), DimSmoothedPoint[0], DimSmoothedPoint[1]));
|
||||
// we don't use point smoothing
|
||||
glPointSize(core::clamp(static_cast<GLfloat>(material.Thickness), DimAliasedPoint[0], DimAliasedPoint[1]));
|
||||
glLineWidth(core::clamp(static_cast<GLfloat>(material.Thickness), DimSmoothedLine[0], DimSmoothedLine[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
glPointSize(core::clamp(static_cast<GLfloat>(material.Thickness), DimAliasedPoint[0], DimAliasedPoint[1]));
|
||||
glLineWidth(core::clamp(static_cast<GLfloat>(material.Thickness), DimAliasedLine[0], DimAliasedLine[1]));
|
||||
}
|
||||
}
|
||||
|
||||
// Anti aliasing
|
||||
|
@ -1982,12 +1983,15 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
else
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
}
|
||||
if (AntiAlias >= 2)
|
||||
if ((material.AntiAliasing & EAAM_LINE_SMOOTH) != (lastmaterial.AntiAliasing & EAAM_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) != (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH))
|
||||
{
|
||||
if (material.AntiAliasing & EAAM_POINT_SMOOTH)
|
||||
// often in software, and thus very slow
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
|
|
|
@ -109,13 +109,23 @@ COGLES1ExtensionHandler::COGLES1ExtensionHandler() :
|
|||
pGlFramebufferRenderbufferOES(0), pGlFramebufferTexture2DOES(0),
|
||||
pGlGenerateMipMapOES(0),
|
||||
#endif
|
||||
EGLVersion(0), Version(0), MaxTextureUnits(0), MaxLights(0), MaxAnisotropy(1),
|
||||
MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxIndices(65535), MaxTextureSize(1),
|
||||
MaxTextureLODBias(0.f), CommonProfile(false), MultiTextureExtension(false),
|
||||
MultiSamplingExtension(false), StencilBuffer(false)
|
||||
EGLVersion(0), Version(0), MaxTextureUnits(0), MaxLights(0),
|
||||
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0),
|
||||
MaxMultipleRenderTargets(1), MaxIndices(65535), MaxTextureSize(1),
|
||||
MaxTextureLODBias(0.f), CommonProfile(false),
|
||||
MultiTextureExtension(false), MultiSamplingExtension(false),
|
||||
StencilBuffer(false)
|
||||
{
|
||||
for (u32 i=0; i<IRR_OGLES_Feature_Count; ++i)
|
||||
FeatureAvailable[i]=false;
|
||||
DimAliasedLine[0]=1.f;
|
||||
DimAliasedLine[1]=1.f;
|
||||
DimAliasedPoint[0]=1.f;
|
||||
DimAliasedPoint[1]=1.f;
|
||||
DimSmoothedLine[0]=1.f;
|
||||
DimSmoothedLine[1]=1.f;
|
||||
DimSmoothedPoint[0]=1.f;
|
||||
DimSmoothedPoint[1]=1.f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,7 +214,7 @@ void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver,
|
|||
#endif
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val);
|
||||
MaxTextureSize=static_cast<u32>(val);
|
||||
#ifdef EXT_texture_lod_bias
|
||||
#ifdef GL_EXT_texture_lod_bias
|
||||
if (FeatureAvailable[IRR_EXT_texture_lod_bias])
|
||||
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &MaxTextureLODBias);
|
||||
#endif
|
||||
|
@ -213,7 +223,10 @@ void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver,
|
|||
glGetIntegerv(GL_MAX_CLIP_PLANES, &val);
|
||||
MaxUserClipPlanes = static_cast<u8>(val);
|
||||
}
|
||||
MaxAuxBuffers=static_cast<u8>(val);
|
||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
||||
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, DimSmoothedLine);
|
||||
glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, DimSmoothedPoint);
|
||||
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
if (FeatureAvailable[IRR_OES_draw_texture])
|
||||
|
|
|
@ -126,9 +126,18 @@ namespace video
|
|||
u8 MaxAnisotropy;
|
||||
u8 MaxUserClipPlanes;
|
||||
u8 MaxAuxBuffers;
|
||||
u8 MaxMultipleRenderTargets;
|
||||
u32 MaxIndices;
|
||||
u32 MaxTextureSize;
|
||||
f32 MaxTextureLODBias;
|
||||
//! Minimal and maximal supported thickness for lines without smoothing
|
||||
GLfloat DimAliasedLine[2];
|
||||
//! Minimal and maximal supported thickness for points without smoothing
|
||||
GLfloat DimAliasedPoint[2];
|
||||
//! Minimal and maximal supported thickness for lines with smoothing
|
||||
GLfloat DimSmoothedLine[2];
|
||||
//! Minimal and maximal supported thickness for points with smoothing
|
||||
GLfloat DimSmoothedPoint[2];
|
||||
bool CommonProfile;
|
||||
bool MultiTextureExtension;
|
||||
bool MultiSamplingExtension;
|
||||
|
|
Loading…
Reference in New Issue