theo2005 , this is opengl not directx .... the problem is the movement of the plane ... not the rotation...
the plane is moving on its own .. using the animate funciton
and the rotation is done by the keys , i want the plane to move in the respective direction even after the key pressed rotation
- Viewing Profile: Posts: max.lavince
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 7
- Profile Views 487
- Member Title Member
- Age 20 years old
- Birthday April 4, 1993
-
Gender
Male
-
Location
noida, India
113
Neutral
User Tools
Contacts
max.lavince hasn't added any contacts yet.
Latest Visitors
Posts I've Made
In Topic: need help with a game m developing
02 July 2012 - 09:47 AM
In Topic: need help with a game m developing
28 June 2012 - 01:17 PM
this is the screen shot ...
im thinking of putting in a skybox for the 3d world effect .... but first i need to solve this movement issue.
im thinking of putting in a skybox for the 3d world effect .... but first i need to solve this movement issue.
In Topic: need help with a game m developing
27 June 2012 - 09:51 AM
to antiHUMANDesigns--
thanks for responding ....
the plane is moving on its own n if i press a key i want the plane to rotate.
Now if i rotate the plane without any translations .... the plane kinda moves according to what i desire but not entirely - it does not face the other side ....the tip doesnt rotate rather the object rotates yu know how it is.
n if i translate it then the plane rotates as in the tip rotate but the plane yet moves in the z axis only ....
which looks a little stupid ( lol ).
i was thinking i create an axis and with the help of the axis ... the plane judges which way to rotate and move ... but its just a thought not sure how to go forward in that plan ..
thanks for responding ....
the plane is moving on its own n if i press a key i want the plane to rotate.
Now if i rotate the plane without any translations .... the plane kinda moves according to what i desire but not entirely - it does not face the other side ....the tip doesnt rotate rather the object rotates yu know how it is.
n if i translate it then the plane rotates as in the tip rotate but the plane yet moves in the z axis only ....
which looks a little stupid ( lol ).
i was thinking i create an axis and with the help of the axis ... the plane judges which way to rotate and move ... but its just a thought not sure how to go forward in that plan ..
In Topic: need help with a game m developing
27 June 2012 - 09:05 AM
// as the function name suggests this function creates the environment, basically its just the plane and a couple of buildings and a road... simple polygons
void environment(void)
{
// i was just trying something with the rotatef codes , i dont actually plan on using this ... i just wish to rotate my object and not the world.
glRotatef(worldx,1.0,0.0,0.0);
glRotatef(worldy,0.0,1.0,0.0);
glRotatef(worldz,0.0,0.0,1.0);
glColor3f(0.4,0.2,0.2);
glTranslatef(0.0,0.0,-100.0);
//+VE Z-AXIS
drawbuilding(70,-30,15,10,64,10);
genroad();
glBegin(GL_POLYGON);
glColor3f(0.1,0.1,0.0);
glVertex3f(100,-30,250);
glVertex3f(100,-30,0);
glVertex3f(-100,-30,0);
glVertex3f(-100,-30,250);
glEnd();
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(eyex,eyey,eyez,lookx,looky,lookz,0.0,1.0,0.0);
environment();
makejetplane();
attributes();
//maketplane();
Sleep(5);
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(90.0, (GLfloat) w/(GLfloat) h, 1.0, 200.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 'q':
exit(0);
break;
case 'w':
movz+=1.0;
glTranslatef(0.0,0.0,movz);
glutPostRedisplay();
break;
case 'a':
zpoz-=5.0;
rolll = 1;
glutPostRedisplay();
break;
case 'd':
zrpoz+=5.0;
rollr = 1;
glutPostRedisplay();
break;
case 't':
//worldx-=0.5;
xpoz += 5.0;
pitchu=1;
glutPostRedisplay();
break;
case 'g':
xrpoz -=5.0;
pitchd=1;
glutPostRedisplay();
break;
case 'f':
yawl=1;
rolll=1;
ypoz+=2.0;
zpoz-=1.0;
if(zpoz<=-45.0)zpoz=-45.0;
glutPostRedisplay();
break;
//rolll=0;
case 'h':
yawr=1;
rollr=1;
yrpoz+=2.0;
zrpoz+=1.0;
if(zrpoz>=90.0)zrpoz=90.0;
glutPostRedisplay();
break;
//rollr=0;
//CAMERA CONTROLS
case 'j':
lookx-=5;
glutPostRedisplay();
break;
case 'l':
lookx+=5;
glutPostRedisplay();
break;
default:
break;
}
}
//ANIMATION
void animate()
{
movz+=0.1;
//movement+=0.1;
eyez+=0.1;
lookz+=0.11;
glutPostRedisplay();
}
oid makejetplane()
{
if(pitchu>0)
{
glTranslatef(movx,movy,movz);
glRotatef(xpoz,1.0,0.0,0.0);
glTranslatef(-movx,-movy,-movz);
} //glRotatef(xpoz,1.0,0.0,0.0);
if(pitchd>0)
{
glTranslatef(movx,movy,movz);
glRotatef(xrpoz,1.0,0.0,0.0);
glTranslatef(-movx,-movy,-movz);
}
// glRotatef(xrpoz,-1.0,0.0,0.0);
if(yawl>0)
{
glTranslatef(movx,movy,movz);
glRotatef(ypoz,0.0,1.0,0.0);
glTranslatef(-movx,-movy,-movz);
}//glRotatef(ypoz,0.0,1.0,0.0);
if(yawr>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(yrpoz,0.0,-1.0,0.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(yrpoz,0.0,-1.0,0.0);
if(rolll>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(zpoz,0.0,0.0,1.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(zpoz,0.0,0.0,1.0);
if(rollr>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(zrpoz,0.0,0.0,1.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(zrpoz,0.0,0.0,1.0);
// BODY
and rest are just the vertex3f codes ...
i've posted everything please guys help me out here.
and apologies for any rookie mistakes as it has just been 3-4 weeks since i've learnt opengl.
Thanks
void environment(void)
{
// i was just trying something with the rotatef codes , i dont actually plan on using this ... i just wish to rotate my object and not the world.
glRotatef(worldx,1.0,0.0,0.0);
glRotatef(worldy,0.0,1.0,0.0);
glRotatef(worldz,0.0,0.0,1.0);
glColor3f(0.4,0.2,0.2);
glTranslatef(0.0,0.0,-100.0);
//+VE Z-AXIS
drawbuilding(70,-30,15,10,64,10);
genroad();
glBegin(GL_POLYGON);
glColor3f(0.1,0.1,0.0);
glVertex3f(100,-30,250);
glVertex3f(100,-30,0);
glVertex3f(-100,-30,0);
glVertex3f(-100,-30,250);
glEnd();
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(eyex,eyey,eyez,lookx,looky,lookz,0.0,1.0,0.0);
environment();
makejetplane();
attributes();
//maketplane();
Sleep(5);
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(90.0, (GLfloat) w/(GLfloat) h, 1.0, 200.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 'q':
exit(0);
break;
case 'w':
movz+=1.0;
glTranslatef(0.0,0.0,movz);
glutPostRedisplay();
break;
case 'a':
zpoz-=5.0;
rolll = 1;
glutPostRedisplay();
break;
case 'd':
zrpoz+=5.0;
rollr = 1;
glutPostRedisplay();
break;
case 't':
//worldx-=0.5;
xpoz += 5.0;
pitchu=1;
glutPostRedisplay();
break;
case 'g':
xrpoz -=5.0;
pitchd=1;
glutPostRedisplay();
break;
case 'f':
yawl=1;
rolll=1;
ypoz+=2.0;
zpoz-=1.0;
if(zpoz<=-45.0)zpoz=-45.0;
glutPostRedisplay();
break;
//rolll=0;
case 'h':
yawr=1;
rollr=1;
yrpoz+=2.0;
zrpoz+=1.0;
if(zrpoz>=90.0)zrpoz=90.0;
glutPostRedisplay();
break;
//rollr=0;
//CAMERA CONTROLS
case 'j':
lookx-=5;
glutPostRedisplay();
break;
case 'l':
lookx+=5;
glutPostRedisplay();
break;
default:
break;
}
}
//ANIMATION
void animate()
{
movz+=0.1;
//movement+=0.1;
eyez+=0.1;
lookz+=0.11;
glutPostRedisplay();
}
oid makejetplane()
{
if(pitchu>0)
{
glTranslatef(movx,movy,movz);
glRotatef(xpoz,1.0,0.0,0.0);
glTranslatef(-movx,-movy,-movz);
} //glRotatef(xpoz,1.0,0.0,0.0);
if(pitchd>0)
{
glTranslatef(movx,movy,movz);
glRotatef(xrpoz,1.0,0.0,0.0);
glTranslatef(-movx,-movy,-movz);
}
// glRotatef(xrpoz,-1.0,0.0,0.0);
if(yawl>0)
{
glTranslatef(movx,movy,movz);
glRotatef(ypoz,0.0,1.0,0.0);
glTranslatef(-movx,-movy,-movz);
}//glRotatef(ypoz,0.0,1.0,0.0);
if(yawr>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(yrpoz,0.0,-1.0,0.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(yrpoz,0.0,-1.0,0.0);
if(rolll>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(zpoz,0.0,0.0,1.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(zpoz,0.0,0.0,1.0);
if(rollr>0)
{
glTranslatef(movx,movy,movz) ;
glRotatef(zrpoz,0.0,0.0,1.0);
glTranslatef(-movx,-movy,-movz); }
//glRotatef(zrpoz,0.0,0.0,1.0);
// BODY
and rest are just the vertex3f codes ...
i've posted everything please guys help me out here.
and apologies for any rookie mistakes as it has just been 3-4 weeks since i've learnt opengl.
Thanks
In Topic: need help with a game m developing
23 June 2012 - 12:12 PM
Thanks for responding.... Ahh I've got into this bad habit.
I'll work on it....
Its quite a large code
I'm not sure which part should I post here.
I'll post something soon probably by tomorrow, as I'm online through mobile at the moment
I'll work on it....
Its quite a large code
I'm not sure which part should I post here.
I'll post something soon probably by tomorrow, as I'm online through mobile at the moment
- Home
- » Viewing Profile: Posts: max.lavince

Find content