PDA

View Full Version : bike modeling



taztoooz
02-15-2009, 04:38 PM
http://stormhawks.ytv.com/default.aspx?obj=VEHICLE&id=2
samples or anything close to this is great

taztoooz
02-15-2009, 04:54 PM
i am trying to draw the wheels for this bike and i am using solidtorus

glutSolidTorus(0.5, 1.0, 100 ,100);
}
but the wheel does not look real at all
how can i make the inner color different to the outer and make it look like a real wheel

Rosario Leonardi
02-15-2009, 05:25 PM
I think you are going in the wrong direction.. :-\
It's very hard (if not impossible) to draw a complex mesh like the one you link with openGL primitive.
You should create your model in a CCD program like Maya, Blender and then read the the model with the texture.

taztoooz
02-15-2009, 05:36 PM
i agree with you but thats the course i am taking
i wish i can use 3d max
i dont think our teacher is expecting something brilliant
thats why i will add you the description too

A suitable motorcycle-type frame with two wheels. The front part that steers the
skimmer should contain the front wheel, two handle bars, a shaft connecting the wheel
and handle bars, and a windscreen (not necessarily transparent). A main skimmer
frame should contain the rear wheel, twin jet engines, and a seat. The two wings can be
arranged in a compact folded-up position on the sides immediately behind the front
wheel.

taztoooz
02-15-2009, 07:02 PM
why even when i // the draw rims the inner circles still appear
i am not getting maybe the push pop right or can somebody tell me whats wrong?


#include <gl\glut.h>

void myDisplay();
void resize(int w, int h);
void myKeyboard(unsigned char key, int x , int y);
void Skimmer();
void axis();
void DrawWheels();
void DrawRims();


GLint angle1 = 0;
GLint angle2 = 0;
GLint angle3 = 0;

int main(int argc, char ** argv)
{
// initialize the display window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(800, 800);
glutInitWindowPosition(100, 100);
glutCreateWindow("Camera ");

// Callback functions
glutDisplayFunc(myDisplay);
glutReshapeFunc(resize);
glutKeyboardFunc(myKeyboard);


// opengl loop
glutMainLoop();

return 0;
}

void myDisplay()
{
glClearColor(0.66, 0.83, 0.91, 1);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 8, 0, 0, 0, 0, 1 , 0);

glTranslatef(0, 0, -8);

Skimmer();
glutSwapBuffers();
}
void DrawWheels()
{
glColor3f(0, 0, 0);
glutSolidTorus(0.3, 1.0, 100 ,100);
}

void DrawRims()
{
glColor3f(0.75, 0.75, 0.75);
glutSolidTorus(100, 0.1, 100 ,100);
}

void Skimmer()
{
// draw front wheel & front Rims
glPushMatrix();
glTranslatef(-6, 0, 0);
DrawWheels();
//DrawRims();
glPopMatrix();


glPushMatrix();
glTranslatef(3, 0, 0);
DrawWheels();
DrawRims();
glPopMatrix();






glPopMatrix();

glRotatef(angle1, 1, 0, 0);
glRotatef(angle2, 0, 1, 0);
glRotatef(angle3, 0, 0, 1);
axis();


}

void axis()
{
glBegin(GL_LINES);
// x axis
glColor3f(1, 0, 0);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);

// y axis
glColor3f(0, 1, 0);
glVertex3f(0, 0, 0);
glVertex3f(0, 5, 0);

// z axis
glColor3f(0, 0, 1);
glVertex3f(0, 0, 0);
glVertex3f(0, 0, 5);

glEnd();
}

void resize(int w, int h)
{
if(h == 0)
h = 1;


glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, (GLfloat)w/(GLfloat)h, 1, 100);
glMatrixMode(GL_MODELVIEW);
}

void myKeyboard(unsigned char key, int x, int y)
{
if (key == 27)
exit(0);

switch (key)
{
case 'q' : axis(); break;
case 'x':
angle1 = (angle1 +5 )% 360;
break;
case 'X':
angle1 = (angle1 - 5)%360;
break;
case 'y':
angle2 = (angle2 +5)%360;
break;
case 'Y':
angle2 = (angle2 -5)%360;
break;
case 'z':
angle3 = (angle3 +5)%360;
break;
case 'Z':
angle3 = (angle3 - 5)%360;
break;
case 'c':
case 'C':
angle1= 0;
angle2= 0;
angle3 = 0;
break;

}
myDisplay();

}