irrlichtopengles2.0 android port: a small bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

irrlichtopengles2.0 android port: a small bug

Postby kine » Fri Dec 10, 2010 3:33 pm

Hi think there is a bug in the svn opengl version:

in COGLES2ExtensionHandler.cpp there is:
Code: Select all
void COGLES2ExtensionHandler::initExtensions( COGLES2Driver* driver,
#ifdef EGL_VERSION_1_0
                                           EGLDisplay display,
#endif
                                                      bool withStencil )
        { ... }

whereas there is no header defined for a version without the EGLDIsplay variable that leads to :

Code: Select all
/home/kine/android-ndk-r4-crystax/samples/irrlicht2/project/jni/COGLES2Driver.cpp: In member function 'bool irr::video::COGLES2Driver::genericDriverInit(const irr::core::dimension2d<unsigned int>&, bool)':
/home/kine/android-ndk-r4-crystax/samples/irrlicht2/project/jni/COGLES2Driver.cpp:236: error: no matching function for call to 'irr::video::COGLES2Driver::initExtensions(irr::video::COGLES2Driver* const, bool&)'
/home/kine/android-ndk-r4-crystax/samples/irrlicht2/project/jni/COGLES2ExtensionHandler.h:132: note: candidates are: void irr::video::COGLES2ExtensionHandler::initExtensions(irr::video::COGLES2Driver*, void*, bool)



I simply added a header copy in my .h file without the EGLDISPLAY variable.


By the way irrlicht built shaders in that ogles version are linked to :"../../media/shaders" ... shouldn't it be a compile option ?

While porting ogles2.0 to android, I also had a problem with the fixed pipeline shaders that won't link. Compile is ok and google reports that It might be a "too much variables declared" error or maybe something else I don't know ( It won't link on my samsung GT I9000 ( a quite recent mobile)). If you're aware of something else that could cause the bug or I'll maybe have to rewrite the whole fixed pipeline in several dedicated shaders. Of course normal shaders and others are looking quite good I must say :D

Hope this helps, and hope someone solves my problem :)

Kine
kine
 
Posts: 18
Joined: Tue Mar 23, 2010 9:40 am

Postby hybrid » Fri Dec 10, 2010 3:56 pm

Ok, the parameter problem is fixed. The configurable path is a good idea, I'll add this to the code as well.
The problem with the shader is probably its size. It's pretty complex and hence might be larger than some implementations can cope with. I've only tested the driver with an emulator and also just for one configuration. Maybe we need to define smaller versions of the shader as well, to fall back to.
hybrid
Admin
 
Posts: 13947
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Postby kine » Thu Jan 06, 2011 12:28 pm

I fixed it by using medium precision floats and ints.

By the way the callback to link the uniforms with irrlicht variables using variable names is buggy for two reasons:

- the uniform names are too long

- the variables string for arrays in the shaders have to be declared with a [0] like for ex: uLightP[0]

it's ok now.


:D
kine
 
Posts: 18
Joined: Tue Mar 23, 2010 9:40 am

Postby hybrid » Thu Jan 06, 2011 2:04 pm

Ok, can you give some code examples of what you fixed? Just to make sure we will add this to the engine later on?
hybrid
Admin
 
Posts: 13947
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Postby kine » Fri Jan 07, 2011 10:39 am

in parralax and normal shaders:
uniform vec4 uLightP[MAX_LIGHTS];
uniform vec4 uLightC[MAX_LIGHTS];

instead of

uniform vec4 uLightPos[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];

checked and arrayed [0] in the irrlicht associated renderers:



Code: Select all
 const char * const COGLES2ParallaxMapRenderer::sBuiltInShaderUniformNames[] =
        {
            "uMvpMatrix",
            "uLightP[0]",
            "uLightC[0]",
            "uEyePos",
            "texture0",
            "texture1",
            "uLightDiffuse",
            "uHeightScale",
            0
        };


& normalRenderer too.

in the fixed pipeline shaders:
uLightAtt[0] instead of ULightAttenuation

and those "arrayed" names


Code: Select all
 const char* const COGLES2FixedPipelineShader::sBuiltInShaderUniformNames[] =
        {
            "uRenderMode",
            "uMvpMatrix",
            "uWorldMatrix",
            "uNormalize",
            "uEyePos",
            "uUseLight[0]",
            "uLightPosition[0]",
            "uLightAmbient[0]",
            "uLightDiffuse[0]",
            "uLightSpecular",
            "uLightDirection",
            "uLightAtt[0]",
            "uLightExponent",
            "uLightCutoff",
            "uAmbientColor",
            "uLighting",
            "uMaterialAmbient",
            "uMaterialEmission",
            "uMaterialDiffuse",
            "uMaterialSpecular",
            "uMaterialShininess",
            "uColorMaterial",
            "uUseTexture[0]",
            "uTextureMatrix[0]",
            "uUseTexMatrix[0]",
            "uClip",
            "uClipPlane",
            "uAlphaTest",
            "uAlphaValue",
            "uFog",
            "uFogType",
            "uFogColor",
            "uFogStart",
            "uFogEnd",
            "uFogDensity",
            "uTextureUnit0",
            "uTextureUnit1",
            0
        };



not sure why uLightPos has to be trunkaten in normal and parralax shaders while uLightPosition in the fixed shader no tough ... maybe it's an overflow somewhere anyway it works on the minimal core specifications for open gl es 2.0 like this.
kine
 
Posts: 18
Joined: Tue Mar 23, 2010 9:40 am


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest