reserved

12-29-2016, 11:34 AM

Hi :D

at first: English isn’t my first language, so please excuse any mistakes ;>

from a few days i try to draw a 3D moebius strip in visual studio

my first version:

2315

for( double a = 0; a < 2 * PI; a += 0.2 )

{

for( r = - 1; r <= 1; r += 0.5 )

{

glBegin( GL_LINE_STRIP );

x = cos( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

y = sin( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

z = r / 2 * sin( a / 2 );

glVertex3f( x, y, z );

}

glEnd();

}

for( r = - 1; r <= 1; r += 0.5 )

{

for( double a = 0; a < 2 * PI; a += 0.2 )

{

glBegin( GL_LINE_STRIP );

x = cos( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

y = sin( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

z = r / 2 * sin( a / 2 );

glVertex3f( x, y, z );

}

glEnd();

}

my program at this moment:

2314

glBegin(GL_QUAD_STRIP);

for (double a = 0; a < 2 * PI; a += 0.2)

{

for (r = -1; r <= 1; r += 0.5)

{

x = cos(a) *(1 + (r / 2 * cos(a / 2)));

y = sin(a) *(1 + (r / 2 * cos(a / 2)));

z = r / 2 * sin(a / 2);

glVertex3f(x, y, z);

}

}

glEnd();

glBegin(GL_LINE_STRIP);

for (r = -1; r <= 1; r += 0.5)

{

for (double a = 0; a < 2 * PI; a += 0.2)

{

x = cos(a) *(1 + (r / 2 * cos(a / 2)));

y = sin(a) *(1 + (r / 2 * cos(a / 2)));

z = r / 2 * sin(a / 2);

glVertex3f(x, y, z);

}

}

glEnd();

im beginner and i have no idea whats wrong ;c can you help me and give some advices?

thx.

at first: English isn’t my first language, so please excuse any mistakes ;>

from a few days i try to draw a 3D moebius strip in visual studio

my first version:

2315

for( double a = 0; a < 2 * PI; a += 0.2 )

{

for( r = - 1; r <= 1; r += 0.5 )

{

glBegin( GL_LINE_STRIP );

x = cos( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

y = sin( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

z = r / 2 * sin( a / 2 );

glVertex3f( x, y, z );

}

glEnd();

}

for( r = - 1; r <= 1; r += 0.5 )

{

for( double a = 0; a < 2 * PI; a += 0.2 )

{

glBegin( GL_LINE_STRIP );

x = cos( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

y = sin( a ) *( 2 +( r / 2 * cos( a / 2 ) ) );

z = r / 2 * sin( a / 2 );

glVertex3f( x, y, z );

}

glEnd();

}

my program at this moment:

2314

glBegin(GL_QUAD_STRIP);

for (double a = 0; a < 2 * PI; a += 0.2)

{

for (r = -1; r <= 1; r += 0.5)

{

x = cos(a) *(1 + (r / 2 * cos(a / 2)));

y = sin(a) *(1 + (r / 2 * cos(a / 2)));

z = r / 2 * sin(a / 2);

glVertex3f(x, y, z);

}

}

glEnd();

glBegin(GL_LINE_STRIP);

for (r = -1; r <= 1; r += 0.5)

{

for (double a = 0; a < 2 * PI; a += 0.2)

{

x = cos(a) *(1 + (r / 2 * cos(a / 2)));

y = sin(a) *(1 + (r / 2 * cos(a / 2)));

z = r / 2 * sin(a / 2);

glVertex3f(x, y, z);

}

}

glEnd();

im beginner and i have no idea whats wrong ;c can you help me and give some advices?

thx.