Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Ideaworks 3D Marmalade (Airplay SDK)

Images in Marmalade are too bright  [SOLVED]

Crossplatform Airplay Development

Images in Marmalade are too bright  [SOLVED]

Postby Nathan W » 05 Oct 2011, 09:28

Hi all,

In my app, the user can enter a menu that I made with Marmalade. When the user presses a certain button, I hide the HUD, call ShiVa_Pause and then I display the menu, which currently contains a button and an image. Now the problem is that the images are too bright, much brighter than they should be.

If I remove the ShiVa component from the app, the images are shown normal. So I think that ShiVa is changing some settings and I tried experimenting with setting light on and off in the Marmalade code and changing other settings, but I can't figure out what's the cause of this problem. Can anyone help?

Thanks,
Nathan
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 05 Oct 2011, 09:47

Hi,

Do you have the problem with both ES 1.1 and ES 2.0 rendering back-ends?
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France

Re: Images in Marmalade are too bright

Postby Nathan W » 05 Oct 2011, 10:12

We don't have this problem with ES 2.0.
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 05 Oct 2011, 11:40

Ok, I think this may be related to a Marmalade problem we found some days ago. Could you try putting the following line in your app.icf file and let us know?

Code: Select all
[GL]
CacheState = 0
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France

Re: Images in Marmalade are too bright

Postby Nathan W » 05 Oct 2011, 11:50

I tried, but the images are still too bright.
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 05 Oct 2011, 12:11

Hmmm... so I think the only solution would be to to try setting all GL states to their default values. Particularly, I think about:

Code: Select all
glDisable    ( GL_BLEND ) ;
glBlendFunc  ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
glDisable    ( GL_COLOR_MATERIAL ) ;
glDisable    ( GL_FOG ) ;
glDisable    ( GL_LIGHTING ) ;


And perhaps those ones also:

Code: Select all
glColor4x    ( ... ) ;
glMaterialxv ( GL_FRONT_AND_BACK, GL_EMISSION, ... ) ;
glMaterialxv ( GL_FRONT_AND_BACK, GL_AMBIENT,  ... ) ;
glMaterialxv ( GL_FRONT_AND_BACK, GL_DIFFUSE,  ... ) ;
glMaterialxv ( GL_FRONT_AND_BACK, GL_EMISSION, ... ) ;


Finally, perhaps also reset texture units:

Code: Select all
if ( IwGxGetHWType ( ) == IW_GX_HWTYPE_GL1 )
{
    for ( int32 i = 1 ; i >= 0 ; i-- )
    {
        glActiveTexture ( GL_TEXTURE0 + i ) ;
        glMatrixMode    ( GL_TEXTURE ) ;
        glLoadIdentity  ( ) ;
    }
}

Let me know.
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France

Re: Images in Marmalade are too bright

Postby Nathan W » 05 Oct 2011, 13:34

Hi, thanks for your support. Unfortunately the suggestions didn't work for us. I also have the feeling that changes that we made in settings in Marmalade don't have any effect on how the images are displayed. Could it be that ShiVa has set settings and doesn't allow Marmalade to change them?
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 05 Oct 2011, 13:44

Could it be that ShiVa has set settings and doesn't allow Marmalade to change them?

No, ShiVa is "on top" of the Marmalade layer, so anything ShiVa changes can be set back to the initial value using the Marmalade/OpenGLES API. Once ShiVa_Pause is called, there is absolutely no more calls done by the engine, so it should be possible to restore original settings.

Do you have the same problem if you use a dummy STK file? (the good old spinning cube, or better, an empty game, so only a clear screen will occur engine wise)
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France

Re: Images in Marmalade are too bright

Postby Nathan W » 05 Oct 2011, 14:46

We tried a dummy STK and then the images are displayed well. If we add a simple object, than the images aren't displayed well anymore. Also the background color of the scene seems displayed on top of the screen.

Edit: with OpenGL ES 2.0 everything looks good.
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 05 Oct 2011, 15:34

Really looks like a render state or texture stage state problem... did you try resetting all texture stage settings? (glTexEnvx ( GL_TEXTURE_ENV, ..., ... ))

Also, maybe it could be interesting to post the problem on the Marmalade forum.
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France

Re: Images in Marmalade are too bright

Postby Nathan W » 06 Oct 2011, 17:21

You pointed us at the right direction, but we found a different way to solve the problem.

We applied the following setting in the ICF-file:

[Gx]
UseGLContextShadow=1

In the code:

Right after calling ShiVa_Pause() we call IwGxContextShadowResume() and just before calling ShiVa_Resume() we call IwGxContextShadowSuspend().
Nathan W
Junior Boarder
Junior Boarder
 
Posts: 33

Re: Images in Marmalade are too bright

Postby NiCoX » 06 Oct 2011, 17:34

Wow, nice finding!
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5628
Location: France


Return to Ideaworks 3D Marmalade (Airplay SDK)