Draw without using display(....)

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

Draw without using display(....)

Tor Einar
Hi, im new to JOGL and was wondering if its possible to get a object from the GLCanvas (or some other defined object)
to use for drawing.

Example:

drawSomething(something)
       myPredefinedGLObject.glBegin()
       myPredefinedGLObject.glVertex2d(something)
       myPredefinedGLObject.glEnd()


OR
drawSomething(something)
      GL gl = myPredefinedObject.getGL()
      .......
     .......

Instead of using
display(GLAutoDrawable glDrawable)
      ......


The reason for me asking is abstraction. I want to use a drawable interface with methods for drawing different shapes.
Then i can implement a Android drawable, OpenGL drawable ... whatever drawable and use this without thinking about the graphic engine behind.

Kind regards Tor Einar
Reply | Threaded
Open this post in threaded view
|

Re: Draw without using display(....)

gouessej
Administrator
Hi

You can use GLEventListener even under Android, I don't see the problem.

You can perform OpenGL calls without using GLEventListener but it's a bad idea, it's dangerous, it consists in reinventing the wheel, it is only useful in very particular cases. I did that in Ardor3D because it supports multiple renderers including 2 of them not using JOGL, I had to respect its framework based on FrameHandler. I had to handle myself the GLContext (make it current, draw, release it or just draw, never manipulate it and use GLAutoDrawable.invoke()) and to take care of a few special cases. Don't start from scratch, look at our source code if you really want to do that and you'll see it is not trivial.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Draw without using display(....)

Tor Einar
In reply to this post by Tor Einar
Thanks, guess i can figure something out :)
I cant seam to find any android tutorials / demos tough :(

Kind Regards Tor Einar
Reply | Threaded
Open this post in threaded view
|

Re: Draw without using display(....)

Sven Gothel
Administrator
On 02/14/2014 07:20 PM, Tor Einar [via jogamp] wrote:
> Thanks, guess i can figure something out :)
> I cant seam to find any android tutorials / demos tough :(

Pls check JOGL unit tests (src/test),
there are android package names containing the activity and their
launcher-activity.

Then we also have a demo within jogl-demos.

~Sven



signature.asc (894 bytes) Download Attachment