What are the ways to draw 3D trees using Java and OpenGL?

I know how to draw basic objects using JOGL or LWJGL to connect to OpenGL. I would like this to create some kind of geometry for the trees, similar to what SpeedTree is known for. Obviously, I do not expect the same quality as SpeedTree.

I want the trees not to look repetitive. The speed is not a concern, I do not expect that you will need more than 100 trees on the screen at a time.

Are there free tree drawing libraries in Java? Or a sample code or demo? Is there anything in other languages ​​in which I can carry or learn?

+6
java c ++ c opengl procedural-generation
source share
9 answers

There are thousands of methods. The best question will determine the "best" in a more limited way. We say β€œbetter”, as in drawing speed (suitable for thousands or millions of trees)? Best, at its best? and etc.

+2
source share

2D or 3D?
In 2D, the general way is to use L-systems.
I also tried the OO approach, defining objects for the trunk, branches, leaves, all extending the abstract class and implementing the Genotype interface (to change the type of trees).
Not sure if it is effective (many objects created, especially if I am animating a tree), but it’s interesting to do.

+2
source share

Here are some resources that might be helpful:

  • gamedev related thread - contains helpful hints / suggestions
  • ngPlant is an open source procedural tool. It is not written in Java, but you can find ideas in your algorithms.
+1
source share

If you are using eclipse / SWT, try Draw 2D.

0
source share

If you are serious about getting beautiful, fast trees, there is a C ++ SpeedTree commercial library. It uses many long-time games (e.g. GTA, Elder Scrolls).

0
source share

A combination of OpenSceneGraph and SpeedTree worked for me.

0
source share

I know two libraries that allow you to use OpenGl with java.

LWJGL (lightweight Java game library Java), which is the best because of its simplicity and its similarities using opengl with c / C ++.

JOGL If you want to mix swing components with opengl, this might be the best choice, I never used it, but several years ago it was known that it was pretty buggy, I don’t know if it has matured since then.

As for drawing trees, there are many ways to do this, as another poster said, you can be more specific.

edit: I assume that I misunderstood the question, oh well: / You can load into a 3d tree model and display this.

0
source share

http://www.codeplex.com/LTrees has some source code. this is c ++ though.

0
source share

All Articles