简体   繁体   中英

Creating a Library to Draw 3D Objects using JOGL

So I've run into a bit of a pickle. I'm writing a library using JOGL to display 3D models (and consequently, 2D models) on a GLCanvas. Well, everything was running smoothly until I decided to call the draw method of the individual polygons of an Strixa3DElement into a thread to speed it up a bit. Before, everything drew perfectly to the screen, but VERY slowly. Now, as far as speed goes, it couldn't be better. But it's not drawing anything. Ignoring everything but what the draw method deals with, is there any reason that

https://github.com/NicholasRoge/StrixaGL/blob/master/src/com/strixa/gl/Strixa3DElement.java

shouldn't work?

Edit: Also, for the sake of avoiding concurrency issues in the thread, let's say any given element has no more than 100000 polygons.

It's better to leave render tasks in a gl thread for now.

  • You don't even using Display Lists. Sure, it will be very slow.
  • Even after that, rendering is not the speed problem: you can prepare data for rendering in another thread, leaving render loop clean and fast. (moving out this._performGameLogic etc)
  • You can use VBO, shaders (moving data and render logic from CPU to GPU), offscreen buffers etc etc to improve performance.

If you will continue, you should

  • check GLArrayDataServer class for use with VBO, unit tests and demos while writing you code.
  • not pass GL2 as argument: GLContext.getCurrentGL().getGL2();
  • should try GL2ES2: fixed functions are deprecated, allows using at mobile platforms.
  • join jabber conference

Some answers about JOGL&threads: Resources: Parallelism in Java for OpenGL realtime applications

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM