OpenGL frame rate 15fps?


10 posts
by Twinkletoes » Mon Jul 09, 2012 10:06 am
I'm rendering the triangle2 demo and seeing a very low frame rate.

The drawing code takes 4ms, and swapBuffers takes 60-odd ms. This results in a very reliable framerate of 15fps. I assume this is waiting for vsync (which is what I want), but I'd expect 25 or 60 fps.

Does anyone know how to configure EGL for a 60fps framerate?

Bryan
Posts: 206
Joined: Fri May 25, 2012 9:44 pm
by RaTTuS » Mon Jul 09, 2012 10:14 am
what distribution
how did you build
what resolution
what else are you running
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
"That's not right, the badgers have moved the goalposts."
User avatar
Posts: 5003
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by Twinkletoes » Mon Jul 09, 2012 11:00 am
Debian squeeze
Application is C# on mono with a C .so underneath (timing is in the C library)
It's just a port of triangle2 for now.
1920x1080 HDMI out
Other things running:
SSH
Samba
Launched from console - X is not running
Posts: 206
Joined: Fri May 25, 2012 9:44 pm
by Twinkletoes » Mon Jul 09, 2012 11:41 am
Interesting - reduced the julia shader to something more trivial and frame rate went up to 50fps.
Still not at 60 - this seems slow compared to the quake demo I've seen.

Another interesting bug though. The julia shader is now:

uniform vec4 color;
uniform vec2 scale;
uniform vec2 centre;
uniform vec2 offset;
varying vec2 tcoord;
uniform sampler2D tex;

void main(void)
{
float intensity;
vec4 color2;
float ar=(gl_FragCoord.x)*scale.x;
int i=0;
vec2 t2;
t2.x=tcoord.x+(offset.x-centre.x)*(0.5/centre.y);
t2.y=tcoord.y+(offset.y-centre.y)*(0.5/centre.x);
color2 = vec4(0,float(i)*0.0625,0,1);
color2 = color2+texture2D(tex,t2);
gl_FragColor = color2 + color;
}

If I remove the line

float ar=(gl_FragCoord.x)*scale.x;

then the shader still compiles ok, but I get a 502 error when drawing with it. I can't see why this should be - the ar variable isn't used anywhere.
Posts: 206
Joined: Fri May 25, 2012 9:44 pm
by labidus » Mon Jul 16, 2012 1:25 pm
They are something wrong in that shader, the i is no longer used or never been used, i dont know the original shader, but i is always = 0

this mean color2 = vec4(0,float(i)*0.0625,0,1); is always
color2 = vec4(0, 0, 0, 1)... but its like no color, so you can remove it

you can simplify this by using
gl_FragColor = texture2D(tex,t2) + color;

void main(void)
{
vec2 t2;
t2.x = tcoord.x + (offset.x - centre.x) * (0.5 / centre.y);
t2.y = tcoord.y + (offset.y - centre.y) * (0.5 / centre.x);
gl_FragColor = texture2D(tex, t2) + color;
}
Posts: 18
Joined: Fri Jun 01, 2012 11:37 am
by labidus » Mon Jul 16, 2012 1:36 pm
also make sure the center does not content 0 on x or y because it will fail to work
since division by 0 is not possible
Posts: 18
Joined: Fri Jun 01, 2012 11:37 am
by Twinkletoes » Tue Jul 17, 2012 9:58 am
It appears to all be down to the shader and the texture switches. With a simple shader and some mild overclocking (no overvolt) I get up to 62fps. With two full screen textures being drawn (with two draw calls) I only hit about 40fps.
Posts: 206
Joined: Fri May 25, 2012 9:44 pm
by Twinkletoes » Tue Jul 17, 2012 9:58 am
and thanks labidus - I was just cutting down the julia shader, so I hadn't fully optimised, just got rid of the loop.
Posts: 206
Joined: Fri May 25, 2012 9:44 pm
by labidus » Tue Jul 17, 2012 12:19 pm
np, i dont know the julia shader, so I dont know what this shader do :)

one thing that can really drop the fps is to draw texture in blend mode (transparent on)
if your texture does not really have alpha value that make some region transparent, disable the blend operation, this will allow for a higher fps when drawing on the entire screen but i beleive you are doing just some test anyway :)
Posts: 18
Joined: Fri Jun 01, 2012 11:37 am
by Twinkletoes » Wed Jul 18, 2012 1:08 pm
Aha - good tip - will try that
Posts: 206
Joined: Fri May 25, 2012 9:44 pm