Fickering issues on some Android devices

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Fickering issues on some Android devices

Post by Ats »

How are you calculating the screen position of your vertices in your vertex shader? Simply "modelViewProjectionMatrix * vec4(position, 1.0)"? Or are you using multiple matrix multiplications?
Here's what I'm doing:

Code: Select all

uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat3 normalMatrix;

attribute vec4 position, color; // vertex position & color
attribute vec3 normal;   // vertex normal

varying vec3 N;
varying vec3 v;
varying vec4 v_Color;

void main(void)
{
  v = vec3(modelViewMatrix * position);
  N = normalize(normalMatrix * normal);
  v_Color = color;
  gl_Position = modelViewProjectionMatrix * position;
}
Is the vec4(position, 1.0) necessary?

I'm doing almost nothing with fragment shaders. It displays the things at the correct positions and colors, so I'm happy with that. Coding shaders isn't exactly simple :lol:
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Fickering issues on some Android devices

Post by Kjell »

Hi Ats,
Ats wrote: Tue Dec 27, 2022 1:26 pmHere's what I'm doing
Alright, that's perfectly fine & normal.
Ats wrote: Tue Dec 27, 2022 1:26 pmIs the vec4(position, 1.0) necessary?
Nope, that's not necessary. Internally ZGE uses vec3 for vertex positions, but when you define the attribute as vec4 in your vertex shader it automatically fills the position.w component with a value of 1.

K
Post Reply