Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: how to draw stem, twig, leaf?

666 views
Skip to first unread message

Jean-Christophe

unread,
Oct 31, 2011, 7:58:24 AM10/31/11
to
On 31 oct, 09:49, "Wonjun, Choi"

> I need to increase the size of stem, the count
> of twig and the count of leaf.
> To increase the size of stem.
> glNewList(STEM, GL_COMPILE);
> glPushMatrix();
> glRotatef(-90, 1, 0, 0);
> gluCylinder(cylquad, 0.1, 0.07, increase_count, 10, 2 );
> glPopMatrix();
> glEndList();

Okay, so now I understand your question,
wich is indeed an OpenGL related question !
( it would have been far better if you
formulated it correctly the first time )
So you have to post it back to <comp.graphics.api.opengl>

The point is that you created a glNewList(STEM,GL_COMPILE)
so you can't change the values of 'increase_count' stem
once the list has been created. Each time you will call
the drawing thru this pre-compiled list, its parameters
will still have the values given at the time you created it.

A solution will be to NOT use a precompiled list so you
can change whatever you want at the time of the drawing.
This mean that, instead of calling glCallList(STEMANDLEAVES)
you call a function which dynamically does the actual drawing :

void DrawStem( int increase_count )
{
glPushMatrix();
glRotatef(-90, 1, 0, 0);
gluCylinder(cylquad, 0.1, 0.07, increase_count, 10, 2 );
// etc ...
glPopMatrix();
}

I suggest that you formulate your question cristal-clear,
and don't post tons of code, otherwise
nobody will take the time to unscramble it.

HTH

Wonjun, Choi

unread,
Oct 31, 2011, 2:20:41 PM10/31/11
to
how can I attach the twig to the particular joint of stem?

Wonjun, Choi

unread,
Oct 31, 2011, 9:39:27 PM10/31/11
to
// the count of stem's joint
void DrawStem( int increase_count )
{
GLUquadricObj *cylquad = gluNewQuadric();
int i;
glPushMatrix();
glRotatef(-90, 1, 0, 0);
gluCylinder(cylquad, 0.1, 0.07, increase_count, 10, 2 );
// etc ...
glPopMatrix();

}

// the count of twig
void Drawtwig()
{
I don't know how to draw this part!

}
// the count of leaf
void Drawleaf()
{
glBegin(GL_TRIANGLES);
glNormal3f(-0.1, 0, 0.25);
glVertex3f(0, 0, 0);
glVertex3f(0.25, 0.25, 0.1);
glVertex3f(0, 0.5, 0);

glNormal3f(0.1, 0, 0.25);
glVertex3f(0, 0, 0);
glVertex3f(0, 0.5, 0);
glVertex3f(-0.25, 0.25, 0.1);
glEnd();
}

Wonjun, Choi

unread,
Oct 31, 2011, 10:41:29 PM10/31/11
to
..

Wonjun, Choi

unread,
Nov 1, 2011, 3:28:27 AM11/1/11
to
I cannot write no more issue.. in here.

Wonjun, Choi

unread,
Nov 1, 2011, 3:32:05 AM11/1/11
to
sorry I was confused..

Wonjun, Choi

unread,
Nov 3, 2011, 4:58:32 AM11/3/11
to
I want to draw like the attached screenshot by using opengl fractal
example.

how can I do this?

the attached screenshot: http://ompldr.org/vYjN1ZQ

opengl fractal example : http://www.opengl.org/resources/code/samples/glut_examples/contrib/contrib.html
0 new messages