MOlOX

12-13-2009, 02:25 PM

hi,

i've 'so newbie' question. If you can help, i will be glad

Think we have 10 points V1, V2, V3, V4, V5, V6, V7 ,V8, V9, V10

When i draw these lines , everything is OK

To goal is , rotate these points on x-axis and form 3d object

when i use this code sniplet, it is ok

for(int i= 0 ; i< 360; i++)

{

glRotatef(1,1,0,0);

glBegin(GL_LINES);

glVertex3f(0,0,0);

glVertex3f(10,0,0);

glVertex3f(10,10,0);

glVertex3f(0,10,0);

glEnd();

}

This code draws object that i want, but ofcourse it does not form 3d solid object.

So lathing is needed to form 3d object.

So i thought this way to do lathing the object

points i know are v1,v2,v3,v4,v5,v6,v7,v8,v9,v10

and if we say, points X degrees rotated on x-axis are v1',v2',v3',v4',v5',v6',v7',v8',v9',v10'

and again , points 2X degress rotated on x-axis are v1'',v2'',v3'',v4'',v5'',v6'',v7'',v8'',v9'',v10''

and so on for k.X = 360 degress

than i thought if i draw GL_QUADS on v1,v2,v1',v2' and v1',v1'',v2',v2'' then v1'',v1''',v2'',v2''' , so on until 360 degrees completed

then draw GL_QUADS on v2,v3,v2',v3' , v2',v3',v2'',v3'' and then v2'',v3'',v2''',v3''' for 360 degrees

and so on to the v9,v10 series

so when i draw all quads object lathing would be completed.

The Question / Problem is i dont know new coordinates of v1,v2,v3,v4,..... points' X degrees rotated coordiates v1',v2',v3'.....

(and likewise 2x rotated v1'',v2'',v3'',v4'',....)

so i tried to use glRotatef function to accomplish this.

for (int v = 0; v< 10 ; k++)

{

for (int i = 0; i< 360 ; i++)

{

glBegin(GL_QUADS);

//first 2 points of Quad with unrotated vertexes

glVertex3f(v[v].x,v[v].y,v[v].z);

glVertex3f(v[v + 1].x,v[v + 1].y,v[v + 1].z);

//rotate X degrees to get to 360 degress in total

glRotatef(1,1,0,0);

//3rd and 4th vertexes are points that are rotated 1 degrees on x-axis

glVertex3f(v[v].x,v[v].y,v[v].z);

glVertex3f(v[v + 1].x,v[v + 1].y,v[v + 1].z);

glEnd();

}

}

But as far as i get, glRotatef(1,1,0,0); does nothing between glbegin and glend , so i could not able to do lathing 360 degrees of point by drawing quads.

if somehow i could calculate v1' , v1'' (x degrees rotated on x-axis) of point v1

than i would have all points i need , so i can draw GL_QUAD and i would have been able to lathe object.

What can i do in this situation. Find math library, which calculates v[x,y,z] => [x Degrees rotate on any axis] => v'(x',y',z')

or can you advice something else for lathing

Thank you very much

i've 'so newbie' question. If you can help, i will be glad

Think we have 10 points V1, V2, V3, V4, V5, V6, V7 ,V8, V9, V10

When i draw these lines , everything is OK

To goal is , rotate these points on x-axis and form 3d object

when i use this code sniplet, it is ok

for(int i= 0 ; i< 360; i++)

{

glRotatef(1,1,0,0);

glBegin(GL_LINES);

glVertex3f(0,0,0);

glVertex3f(10,0,0);

glVertex3f(10,10,0);

glVertex3f(0,10,0);

glEnd();

}

This code draws object that i want, but ofcourse it does not form 3d solid object.

So lathing is needed to form 3d object.

So i thought this way to do lathing the object

points i know are v1,v2,v3,v4,v5,v6,v7,v8,v9,v10

and if we say, points X degrees rotated on x-axis are v1',v2',v3',v4',v5',v6',v7',v8',v9',v10'

and again , points 2X degress rotated on x-axis are v1'',v2'',v3'',v4'',v5'',v6'',v7'',v8'',v9'',v10''

and so on for k.X = 360 degress

than i thought if i draw GL_QUADS on v1,v2,v1',v2' and v1',v1'',v2',v2'' then v1'',v1''',v2'',v2''' , so on until 360 degrees completed

then draw GL_QUADS on v2,v3,v2',v3' , v2',v3',v2'',v3'' and then v2'',v3'',v2''',v3''' for 360 degrees

and so on to the v9,v10 series

so when i draw all quads object lathing would be completed.

The Question / Problem is i dont know new coordinates of v1,v2,v3,v4,..... points' X degrees rotated coordiates v1',v2',v3'.....

(and likewise 2x rotated v1'',v2'',v3'',v4'',....)

so i tried to use glRotatef function to accomplish this.

for (int v = 0; v< 10 ; k++)

{

for (int i = 0; i< 360 ; i++)

{

glBegin(GL_QUADS);

//first 2 points of Quad with unrotated vertexes

glVertex3f(v[v].x,v[v].y,v[v].z);

glVertex3f(v[v + 1].x,v[v + 1].y,v[v + 1].z);

//rotate X degrees to get to 360 degress in total

glRotatef(1,1,0,0);

//3rd and 4th vertexes are points that are rotated 1 degrees on x-axis

glVertex3f(v[v].x,v[v].y,v[v].z);

glVertex3f(v[v + 1].x,v[v + 1].y,v[v + 1].z);

glEnd();

}

}

But as far as i get, glRotatef(1,1,0,0); does nothing between glbegin and glend , so i could not able to do lathing 360 degrees of point by drawing quads.

if somehow i could calculate v1' , v1'' (x degrees rotated on x-axis) of point v1

than i would have all points i need , so i can draw GL_QUAD and i would have been able to lathe object.

What can i do in this situation. Find math library, which calculates v[x,y,z] => [x Degrees rotate on any axis] => v'(x',y',z')

or can you advice something else for lathing

Thank you very much