Posted by
Sven Gothel on
Nov 01, 2012; 3:05pm
URL: https://forum.jogamp.org/How-to-MultiThread-in-JOGL-tp4026697p4026702.html
On 11/01/2012 12:14 PM, moeabdol [via jogamp] wrote:
> Dear All,
> I have been trying so hard to wrap my head around the multithreading concept
> in JOGL. I looked into many documentations and it seems to me that every
> documentation I go through passes me to a next one without me finding a
> complete and simple code that implements multithreaded rendering.
>
> The program that i'm trying ti implement is simple. Within the class that
> implement GLEventListener and inside the display() method I have a simple
> algorithm which is a for loop. Inside the loop am generating random x and y
> coordinates. What I want to do is draw these points as they are being
> determined by the random generator to give the viewer a sense of how the
> points are generated in real-time.
>
> To solve this, I have read documentations on JOGL's website that suggested
> using GLWindow instead of a JFrame to enable concurrency. I did that!
> Moreover, I have created a work class that implements a GLRunnable this class
> includes all the code necessary to do the work of drawing each point following
> is the content of this class
Yours is a complicate issue not to easy answer,
since it's not so much about multi threaded rendering
but a multi threaded data provider, which results shall be rendered.
You have to understand how a [A] GPU performs multi threaded rendering,
then how the [B] API copes w/ it .. and may allow you to utilize it.
[A] GPU performs multi threaded rendering:
One or more threads per fragment (pixel)
[B] No more via the fixed function pipeline (FFP),
since it only accumulates your immediate mode vertices!
You would need to use fragment shader to PRODUCE the data
and 'render' it. The latter is more a 'store the result in framebuffer',
see [A].
Thanks to another very similar question
<
http://forum.jogamp.org/Multi-Threading-JOGL-Problem-td4026441.html#none>
I gave the same similar answer:
<
http://gamedev.stackexchange.com/a/38576>
<
http://forum.jogamp.org/Re-Muti-Threading-JOGL-Problem-td4026442.html#none>
<
http://forum.jogamp.org/Re-Muti-Threading-JOGL-Problem-td4026443.html>
~Sven