View Full Version : Shape to use for tree branches
02-20-2007, 02:08 AM
Hi, I'm visualizing the growth of a tree. At the moment I draw the branches using a gluCylinder. Now I want the branches not to be straight but be curved. I can draw successive cylinders at different orientations, but that leaves holes on the outside of the curve, if you know what I mean.
So now I'm looking for a good shape that allows me to draw a branch with one fluid surface without holes. Does anyone know a good object shape to do that?
02-20-2007, 07:02 AM
You'll have to define such shape by yourself.
Imagine that you could draw a set of circles (not cylinders) that define a profile of a branch - you just need to connect every pair of such circles with a GL_TRIANGLE_STRIP.
Are you using matrix stack to draw branches?
Your best bet now would be to implement transformations yourself (at least local transformations for tree itself) and pre-calculate all vertex coordinates into one coordinate space before drawing a tree.
02-20-2007, 02:32 PM
This is something best done using a modeller.
Perhaps create many instances of the animation and just send each instance to GL. You might want to throw in keyframe interpolation in the mix.
Making a tree with cylinders must difficult to do.
02-21-2007, 03:39 AM
Tnx! I'll try the triangle strip, maybe I'll look into NURBS as well, I like the smooth look that brings but it might be a bit overkill for what I want to do. Yes, I use the matrix stack for the branches, I'll look into your suggestion!
V-man: unfortunately, the assignment is to do it with OpenGL, animation is not an option. I need to implement a dL-system that visualizes the tree growth.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.