Author Topic: State of OpenGL ES2.0 support  (Read 37902 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: State of OpenGL ES2.0 support
« Reply #75 on: August 05, 2011, 09:10:05 pm »
color isn't set by jPCT-AE unless you specify some vertex color, which is why it's always black. Try to set it fixed to white or something. I tried that with your code, but the result still looks kind of strange. So i've modified the shader slightly and set the light source to -20 instead of -1 (because otherwise, it's inside the cubes).

I created this:

Code: [Select]
uniform mat4 modelViewProjectionMatrix;
uniform mat4 modelViewMatrix;
 
attribute vec4 position;
attribute vec4 color;
attribute vec3 normal;
 
varying vec3 v_Position;
varying vec4 v_Color;
varying vec3 v_Normal;
 
void main()
{
    v_Position = vec3(modelViewMatrix * position);
    v_Color = vec4(1,1,1,1);
    v_Normal = vec3(modelViewMatrix * vec4(normal, 0.0));
    gl_Position = modelViewProjectionMatrix * position;
}

Code: [Select]
precision mediump float;
uniform vec3 lightPositions[8];
varying vec3 v_Position;
varying vec4 v_Color;
varying vec3 v_Normal;

void main()
{
    float distance = length(lightPositions[0] - v_Position);
    vec3 lightVector = normalize(lightPositions[0] - v_Position);
    float diffuse = dot(v_Normal, lightVector);
    diffuse = diffuse * (10.0 / distance);
    gl_FragColor = v_Color * diffuse;
}

...still not very convincing IMHO, but it might be a starting point. You might as well look out for a simple phong shader instead. I had one lying around here, but i can't find it ATM... :(
« Last Edit: August 05, 2011, 09:43:02 pm by EgonOlsen »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #76 on: August 06, 2011, 01:09:02 pm »
thanks, getting color from vertex is bad solution, but I never wrote any shader, so I need some parts of code to understand how it works :)

Offline dherby

  • byte
  • *
  • Posts: 2
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #77 on: August 31, 2011, 07:09:05 pm »
Any release date for the new version of jPCT-AE supporting OpenGLES 2.0 ?

++
dherby

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #78 on: August 31, 2011, 07:48:47 pm »
here you can download new alpha more than month...

Offline dherby

  • byte
  • *
  • Posts: 2
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #79 on: August 31, 2011, 10:02:35 pm »
Thks for the info. I've already had this version who's working fine but I'm still undecided about the right engine for me.

In fact, I'm looking for a game engine with bone and pose animation support. I've tested jme3.0, libgdx and jPCT. All are good engine but jPCT+bone seems to be the more simple and suitable for my needs.

I've tested all of them with a modified simbad ogre3D model (I've added simple keyframe for lipsync animation).
Here are the result in FPS with a Galaxy S/android 2.3.4 (Bone:"Dance" Anim + Keyframe Blending).

- libgdx 15FPS (GLES 2.0)
- jme3.0 10FPS (GLES 2.0)
- jpct-ae 20 FPS (GLES 1.1)

In addition, I've implemented my own library in C + NDK android for managing pose frame and keyframe animations natively in opengl ES 2.0 (Only one vertex shader computing Bone Position and Keyframe position at the same time).

It's working pretty well and it's fast (approx 30-35FPS) but some optimization are chipset dependent (Power VR) and It's a nightmare to deal with OpenGL graphic context (LiveWallPaper), moreover, I've got some nasty compatible issue with a few smart-phone.

So, I need to come back the right path using only android SDK. Do you think I can expect some FPS improvement with the new GLES 2.0 implementation of jPCT-AE ?

 Thks !
++
dherby
« Last Edit: August 31, 2011, 10:05:05 pm by dherby »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: State of OpenGL ES2.0 support
« Reply #80 on: August 31, 2011, 11:14:58 pm »
FPS most likely won't increase with ES 2.0. It might happen, if you write yourself some dedicated shaders that do only what you need. jPCT-AE's OpenGL ES 2.0 support relies on some default shaders, which might not be optimal in all cases.

Edit: You might get an increase if you would do the skinning in the shader, what Bones doesn't do. Somebody (not me... ;) ) would have to modify Bones for that. I'm not sure, if it's worth it though. You can also try to use the libgdx-support of jPCT-AE (see the wiki)...it might help to increase vertex upload time, but i wouldn't expect too much (if anything) on a current device.
« Last Edit: August 31, 2011, 11:29:24 pm by EgonOlsen »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #81 on: September 14, 2011, 08:51:45 pm »
OGLES 2.0 mode in and3Dbench xl running on HTC sensation :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: State of OpenGL ES2.0 support
« Reply #82 on: September 14, 2011, 09:17:51 pm »
That's an Adreno 220 gpu, right?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #83 on: September 14, 2011, 09:27:17 pm »
yes, I will try also on Samsung Galaxy S2 with Mali-400, but I do not when...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: State of OpenGL ES2.0 support
« Reply #84 on: September 14, 2011, 09:30:18 pm »
I've already ran it myself on an S2. It worked except for some texture problems with non-square textures, but that's a common issue with ES 2.0, which is why jPCT-AE already prints out a warning in this case.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: State of OpenGL ES2.0 support
« Reply #85 on: September 17, 2011, 07:06:17 pm »
I have a Tegra 2 tablet running homeycomb 3.1, let me know if you need to test GL20 routines. I also own a DesireHD running 2.3.5 if that's any help. I also have access to a new OMAP tablet.

edit: An3DBenchXL is working fine on that hardware.
« Last Edit: December 22, 2011, 10:26:02 am by K24A3 »