Odd rendering errors on Android
Moderator: Moderators
Odd rendering errors on Android
I have pretty much finished a new game! But when running it on Android some weird things happen. It seems transparency isn't rendered correctly. (Or things are rendered in an incorrect order. Below is a screenshot of how it looks on my PC and one of how it looks on my Galaxy Tab 3. Any idea what might be causing this?
- Attachments
-
- Screenshot_2016-09-01-14-32-09.png (177.34 KiB) Viewed 23844 times
-
- Screenshot_2016-09-01_14-35-05.png (267.19 KiB) Viewed 23844 times
Re: Odd rendering errors on Android
Not sure what is going on. Can you tell me how that planet in the bottom right corner is rendered. Is it one mesh with transparent texture on top of another mesh?
Re: Odd rendering errors on Android
Exactly. There is also a transparent sprite on top of it (the aura-effect). This seems to hide the asteroids behind it. (Which are normal meshes.)
Re: Odd rendering errors on Android
Can you please make a new small test project that shows this problem with as few components as possible and upload it here? I would greatly simplify for me when trying to debug this.
Re: Odd rendering errors on Android
Here you go! This shows the same effect. Also, any other objects behind those auras seem to be hidden. Perhaps the problem is with the rendering order.
Thanks for helping me!
Thanks for helping me!
- Attachments
-
- GfxTest.zgeproj
- (472.54 KiB) Downloaded 524 times
Re: Odd rendering errors on Android
I checked the ZGE sources and note that depthsorting is not implemented correctly for Android and I'm not sure when I have time to fix that.
If you still want this to work, I would try the following
1. Use the ANDROID define (it is defined when building for Android) to disable certain effects.
Example:
2. Take advantage of the fact that the default render order in ZGE is based on categories. So if you keep your "background" models as category 0 then you can be certain they are rendered before any other categories. Then use larger Category values for foreground models.
There is possibly some other problems going on in that screenshot you posted. I'll see if I have time to test some more.
If you still want this to work, I would try the following
1. Use the ANDROID define (it is defined when building for Android) to disable certain effects.
Example:
Code: Select all
if(!ANDROID) //Only create halo when not on Android
createModel(HaloModel);
There is possibly some other problems going on in that screenshot you posted. I'll see if I have time to test some more.
Re: Odd rendering errors on Android
I see. Thanks for having a look!
So if I re-sort things to use categories instead, transparent textures should work? In that case that shouldn't be a problem.
So if I re-sort things to use categories instead, transparent textures should work? In that case that shouldn't be a problem.
Re: Odd rendering errors on Android
..yes, this would be great... I noticed strange behaviour of transparent images when stacked, on Android only, on Windows it looks good.I checked the ZGE sources and note that depthsorting is not implemented correctly for Android and I'm not sure when I have time to fix that.
Thanks for the workaround, I'll see if I can make use of it
Re: Odd rendering errors on Android
Where in the code can I investigate depthsorting for Android?
Because each time I release a PC and Android version, I remember why I had to make weird choices in order to make it kind of work on both versions... And it's not helping me advancing
Because each time I release a PC and Android version, I remember why I had to make weird choices in order to make it kind of work on both versions... And it's not helping me advancing
Re: Odd rendering errors on Android
The depth sort is happening in ZApplication.pas, in procedure TZApplication.RenderModels.
The problem iirc is that these lines are not supported on GLES:
glGetFloatv(GL_PROJECTION_MATRIX, @Matrix);
glGetFloatv(GL_MODELVIEW_MATRIX, @TmpM);
Maybe Kjell has some knowledge that could help solve this?
The problem iirc is that these lines are not supported on GLES:
glGetFloatv(GL_PROJECTION_MATRIX, @Matrix);
glGetFloatv(GL_MODELVIEW_MATRIX, @TmpM);
Maybe Kjell has some knowledge that could help solve this?
Re: Odd rendering errors on Android
Hej Ville,
K
Those calls are supported in ES 1.1, so that shouldn't be the problem ( since i think Ats is using "Compatible" GLBase ). Regardless, you should "route" those calls through GLDrivers.pas .. so that ES 2.0 uses GLDriverProgrammable / MPtrs.
K
Re: Odd rendering errors on Android
Thanks Kjell.
@Ats: What happens if you change the code from this (line 690 in ZApplication.pas):
To simply this:
edit: Or update from github, I just made a new commit.
@Ats: What happens if you change the code from this (line 690 in ZApplication.pas):
Code: Select all
{$ifndef android}
glGetFloatv(GL_PROJECTION_MATRIX, @Matrix);
glGetFloatv(GL_MODELVIEW_MATRIX, @TmpM);
Matrix := MatrixMultiply(TmpM,Matrix);
{$else}
Matrix := IdentityHmgMatrix;
{$endif}
Code: Select all
glGetFloatv(GL_PROJECTION_MATRIX, @Matrix);
glGetFloatv(GL_MODELVIEW_MATRIX, @TmpM);
Matrix := MatrixMultiply(TmpM,Matrix);
Re: Odd rendering errors on Android
It works perfectly. Thanks
Here's the new Android lib
Here's the new Android lib
- Attachments
-
- libzgeandroid.zip
- (253.21 KiB) Downloaded 425 times
Re: Odd rendering errors on Android
Hi VilleK,
I'm experiencing a new bug on a new Android phone that my father bought recently. ZGE applications don't even open on it.
It's a Huawei mate 20 pro (LYA-L29).
I compiled the latest libzgeandroid.so, and it's working perfectly on other phones.
So I launched the ADB to see what's going on. Here's the result:
Do you have an idea what might happen?
(It's even crashing with old ZGE android tests)
Edit:
The only occurence of glTexImage2DMultisample in ZGE is in ZOpenGL.pas line 1481
glTexImage2DMultisample : procedure(target: GLenum; samples: GLsizei; internalformat: GLint; width: GLsizei; height: GLsizei; fixedsamplelocations: GLboolean); {$IFDEF WIN32}stdcall; {$ELSE}cdecl; {$ENDIF}
While the glTexImage2DMultisample internet definition state:
void glTexImage2DMultisample( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
Could that be related?
I'm experiencing a new bug on a new Android phone that my father bought recently. ZGE applications don't even open on it.
It's a Huawei mate 20 pro (LYA-L29).
I compiled the latest libzgeandroid.so, and it's working perfectly on other phones.
So I launched the ADB to see what's going on. Here's the result:
Code: Select all
03-17 15:52:28.393 13643 13643 E ZgeAndroid: /storage/emulated/0
03-17 15:52:28.393 13643 13643 E ZgeAndroid: /data/user/0/com.txori.omeganaut/files/
03-17 15:52:28.393 13643 13643 E ZgeAndroid: /data/user/0/com.txori.omeganaut/lib/
03-17 15:52:28.416 13643 13643 E ZgeAndroid: Found JNI_OnLoad function, calling now...
03-17 15:52:28.416 13643 13643 E ZgeAndroid: glDepthRange
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glGenLists
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glMateriali
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glIndexMask
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glListBase
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glBegin
03-17 15:52:28.417 13643 13643 E ZgeAndroid: glCallList
03-17 15:52:28.418 13643 13643 E ZgeAndroid: glColor3f
03-17 15:52:28.418 13643 13643 E ZgeAndroid: glColor3fv
03-17 15:52:28.418 13643 13643 E ZgeAndroid: glColor4fv
03-17 15:52:28.418 13643 13643 E ZgeAndroid: glEnd
03-17 15:52:28.418 13643 13643 E ZgeAndroid: glColorMaterial
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glDeleteLists
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glDrawBuffer
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glGetTexImage
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glPolygonMode
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glPopAttrib
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glPushAttrib
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glRasterPos2f
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glTexCoord2f
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glVertex2f
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glVertex3f
03-17 15:52:28.419 13643 13643 E ZgeAndroid: glTexGeni
03-17 15:52:28.421 13643 13643 E ZgeAndroid: glTexImage2DMultisample
03-17 15:52:28.421 13643 13643 E ZgeAndroid: File missing: /data/user/0/com.txori.omeganaut/files/config.dat
03-17 15:52:28.421 13643 13727 E ZgeAndroid: audiocallback started
03-17 15:52:28.423 13643 13643 E ZgeAndroid: JNI_OnLoad
03-17 15:52:28.426 13643 13643 E ZgeAndroid: Found JNI_OnLoad function, calling now...
03-17 15:52:28.440 13643 13643 E ZgeAndroid: CPUs: 8
03-17 15:52:28.445 13643 13643 E ZgeAndroid: JNI_OnLoad
03-17 15:52:28.598 13643 13643 E ZgeAndroid: GLBase: 1.1
03-17 15:52:28.634 13643 13751 E ZgeAndroid: Found JNI_OnLoad function, calling now...
03-17 15:52:28.635 13643 13751 E ZgeAndroid: glDepthRange
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glGenLists
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glMateriali
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glIndexMask
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glListBase
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glBegin
03-17 15:52:28.636 13643 13751 E ZgeAndroid: glCallList
03-17 15:52:28.637 13643 13751 E ZgeAndroid: glColor3f
03-17 15:52:28.637 13643 13751 E ZgeAndroid: glColor3fv
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glColor4fv
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glEnd
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glColorMaterial
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glDeleteLists
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glDrawBuffer
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glGetTexImage
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glPolygonMode
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glPopAttrib
03-17 15:52:28.638 13643 13751 E ZgeAndroid: glPushAttrib
03-17 15:52:28.639 13643 13751 E ZgeAndroid: glRasterPos2f
03-17 15:52:28.639 13643 13751 E ZgeAndroid: glTexCoord2f
03-17 15:52:28.639 13643 13751 E ZgeAndroid: glVertex2f
03-17 15:52:28.639 13643 13751 E ZgeAndroid: glVertex3f
03-17 15:52:28.639 13643 13751 E ZgeAndroid: glTexGeni
03-17 15:52:28.651 13643 13751 E ZgeAndroid: glTexImage2DMultisample
--------- beginning of crash
(It's even crashing with old ZGE android tests)
Edit:
The only occurence of glTexImage2DMultisample in ZGE is in ZOpenGL.pas line 1481
glTexImage2DMultisample : procedure(target: GLenum; samples: GLsizei; internalformat: GLint; width: GLsizei; height: GLsizei; fixedsamplelocations: GLboolean); {$IFDEF WIN32}stdcall; {$ELSE}cdecl; {$ENDIF}
While the glTexImage2DMultisample internet definition state:
void glTexImage2DMultisample( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
Could that be related?
Re: Odd rendering errors on Android
If you try building an empty ZGE app, or with just a "trace("test");" in OnLoaded does it work?
What are the crash messages?
What are the crash messages?