Search found 1776 matches

by Kjell
Fri Jun 18, 2021 5:44 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, How would you pass the color of a Material to the Shader then? The color of a material already gets passed to a ES2/GL3 shader automatically by ZGE ( uniform vec4 globalColor ) :wink: But if you'd for example want to pass the specular color i'd personally use a function. You could either wri...
by Kjell
Fri Jun 18, 2021 3:29 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, So what if I render several materials at the same time. Would it be better to have an array per shader, or reuse the same array before rendering each material? That's difficult to answer. It really depends on a bunch of factors .. but in general it's probably most convenient to just reuse th...
by Kjell
Fri Jun 18, 2021 10:55 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, But how does compatible works then if those values doesn't exist in ZGE? Just because ZGE doesn't use certain OpenGL features that doesn't mean they don't exist. OpenGL is basically a state machine. If they have default values, then I shouldn't be worried not using them in the ES2/GL3 shader...
by Kjell
Fri Jun 18, 2021 4:52 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, All of those built-in variables are actually pre-calculated using various parameters by the OpenGL driver. gl_FrontLightModelProduct = Material.EmissionColor + Material.AmbientColor * App.AmbientLightColor gl_FrontLightProduct[0].ambient = Material.AmbientColor * Light0.AmbientColor gl_Front...
by Kjell
Thu Jun 17, 2021 8:40 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ville, About the missing alpha in vertex colors, I could initialize this to 1.0 but I also want to understand why this is not needed on desktop. I'm not entirely sure, but i suspect that a Android Activity has a white background by default and any pixel of your front-buffer that isn't fully opaqu...
by Kjell
Wed Jun 16, 2021 1:24 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, By the way, is " #ifdef GL_ES precision mediump float; #endif " mandatory in both, or at all? It's not required, but by default floats are set to precision highp and not every mobile GPU supports that. And i guess if your shader doesn't define any floating-point variables, it's not needed ei...
by Kjell
Fri Jun 04, 2021 3:49 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, Also, with your example, I get your desktop cell shape/color on preview mode, and your android cell on build and run. Same here, which is problematic .. you don't want your preview to look different from your standalone builds. However, i do get the same BitmapCells result as in the editor /...
by Kjell
Fri Jun 04, 2021 2:50 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi guys, Just tried it myself using a simple ( ES 1.0 ) .zgeproj and i'm getting a different BitmapCell on Android as well ( compared to Desktop ). No problems with BitmapNoise and BitmapRect here though. However, i just had a look at the source code and BitmapRect uses legacy OpenGL calls, so it ma...
by Kjell
Fri Jun 04, 2021 12:28 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats,
Ats wrote:
Fri Jun 04, 2021 12:01 pm
where in the ZGE source code could I check how shaders are handled differently from computer to Android?
There's no difference. Shader sources are send to the OpenGL driver in plain-text and compiled by the driver itself. So it just depends on which OpenGL driver a device uses.

K
by Kjell
Fri Jun 04, 2021 9:51 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, The error messages are caused by the fact that the "varying" and "attribute" keywords have been deprecated & replaced by "in" and "out" since GLSL ES 3.0. By the way, all of the official documentation on OpenGL ES can be found here . And in case you're just looking for the reference cards of...
by Kjell
Thu Jun 03, 2021 3:39 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, So now it is displaying, but it's a weird cell bitmap instead of the noise bitmap :shock: No idea what's causing that .. maybe Ville can chime in? And if I add the directive #version 330 (I tried from 100 to 330), the whole screen is white on Android. GLSL ES 3.3 doesn't exist ( yet ). The l...
by Kjell
Thu Jun 03, 2021 1:35 pm
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about ES2/GL3 shaders

Hi Ats, But I really don't understand why the noise bitmap is working on PC, but not on Android. It's just white. Could you try adding a BitmapExpression containing "Pixel.A = 1" to your NoiseBitmap? So, like this: ZZDC<?xml version="1.0" encoding="iso-8859-1" ?> <Bitmap Name="NoiseBitmap" Width="25...
by Kjell
Thu Jun 03, 2021 10:55 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about GLES2 shaders

Hi Ats, I was looking at your phong shader, and while it's really showing the use of Specular and Emission colors, it doesn't show up on ES2/GL3. Right, as mentioned .. it's a shader for legacy OpenGL so it doesn't work ( properly ) with ES2/GL3. I'm going to start over again, and searching for exam...
by Kjell
Thu May 27, 2021 11:28 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about GLES2 shaders

Hi Ats, Let's say, the phong one. That phong shader is written for legacy OpenGL ( GLBase = compatible ). I suspect you changed the "gl_ModelViewProjectionMatrix" part in the fragment shader, but that's not nearly enough to convert it to a modern shader ( GLBase = GL3/ES2 ). Anyway, here's what the ...
by Kjell
Thu May 27, 2021 10:41 am
Forum: General discussion
Topic: Questions about ES2/GL3 shaders
Replies: 61
Views: 2302

Re: Questions about GLES2 shaders

Hi Ats, What would be the logic to update the light shader, so the cube doesn't rotate with his shadows stuck on it? What light shader are you referring to? I looked at all the examples you posted in this thread but i can't find a light shader. I've read many explanations, but since GLES2 is aging f...