glVertexAttrib doesnt work often enough

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

glVertexAttrib doesnt work often enough

Teapot
I'm testing shader in/out by drawing a triangle that jerk around and change color violently. It updates like once every 30 seconds instead. What did I do wrong?

Full source: http://pastebin.com/WJWWvUrh
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

gouessej
Administrator
At first, use an animator instead of a loop with a useless call to Thread.sleep(). Then, we'll see if something else is still wrong.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

Teapot
This post was updated on .
How do I set up the animator to render once and render only when asked so I can do other things inbetween?

EDIT:
Forgot the important bit: Using the animator doesnt seems to help. opengl reponds fluidly as expected but the very triangle doesnt. It should change shape&color constantly. Full source: http://pastebin.com/Lcz9MmZ8
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

gouessej
Administrator
Why do you enable v-sync? Why do you use FPSAnimator? Please use the most simple animator first (Animator) in order to help us to find the real culprit. If you limit the frame rate, don't be surprised of getting fewer frames per second. I remind you that System.currentTimeMillis() and nanoTime() don't use the most accurate timer under Windows.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

Sven Gothel
Administrator
In reply to this post by Teapot
On 03/22/2014 08:53 PM, Teapot [via jogamp] wrote:
> How do I set up the animator to render once and render only when asked so I
> can do other things inbetween?

Rendering on demand w/ an animator
can be achieved by simply pause/resume the animator,
i.e. start w/ paused, then resume/pause.

Note that the update/refresh rendering as caused by the underlying
windowing toolkit will always happen if an attached animator is not animating
or not existing.

~Sven



signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

Sven Gothel
Administrator
In reply to this post by Teapot
On 03/24/2014 10:35 AM, Sven Gothel wrote:
> On 03/22/2014 08:53 PM, Teapot [via jogamp] wrote:
>> How do I set up the animator to render once and render only when asked so I
>> can do other things inbetween?
>
> Rendering on demand w/ an animator
> can be achieved by simply pause/resume the animator,
> i.e. start w/ paused, then resume/pause.

Note: A simple display() call might be even easier
w/ an attached but paused animator or no animator at all :)

>
> Note that the update/refresh rendering as caused by the underlying
> windowing toolkit will always happen if an attached animator is not animating
> or not existing.
>
> ~Sven


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

Teapot
In reply to this post by gouessej
It runs. Full source: http://pastebin.com/6dqSpATJ

I've tested them both. v-sync doesnt help. FPSAnimator doesnt help. Animator without v-sync does fix the problem. Now the question is, "Why?"

> Why do you enable v-sync?
Because I got no clues how opengl work and I'm absolutely in love with vsync. Tearing is a big no-no and I have so many calculations inbetween renders it was a mess without. You sure I wont need it using opengl?

> Why do you use FPSAnimator?
The first guide that show up when I googled "jogl Animator" use FPSAnimator. Animator... FPSAnimator... Bah, close enough. Who'd have thought? :D

> I remind you that System.currentTimeMillis() and nanoTime() don't use the most accurate timer under Windows.
They're good enough as far as I'm concerned. Whatever I'm doing I'm sure as hell is not a hard real time problem.

> Swen wrote:
> A simple display() call might be even easier w/ an attached but paused animator or no animator at all :)
I tried but it caused the same problem I had. It seems that invoking display() directly somehow mess up the shaders.
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttrib doesnt work often enough

gouessej
Administrator
Under Windows, several developers complained about obtaining a frame rate twice lower than expected (requested: 60, real: 30) with FPSAnimator, that's why I don't use it. I'm not really sure you need v-sync, you can just pause a plain Animator and resume it when you want as Sven suggested.
Julien Gouesse | Personal blog | Website