opengl program moving train
#1

i need moving train miniproject using opengl.
Reply
#2
how to write the code for magic square????
Reply
#3
how to write the code for moving train using c programming..????
Reply
#4
code for simulation of train using opengl
Reply
#5
opengl program moving train

Design and Implementation

For developing the train - it's bogies and engine we have defined a simple function. In this simple opengl projects example we are coding this function so we can make any no trains, by just calling it. The following is sample code for drawing train -

void TRAINS(int x1,int y1,int a,int b)
{
int i=0; glBegin(GL_QUADS);
glColor3f(0,0.0,1.0); //ENGINE
glVertex2f(x1,y1); //lengh of engine=60;height of engine=30;
glColor3f(0,0.0,1.0);
glVertex2f(x1+60,y1);
glColor3f(1.0,0.0,0.0);
glVertex2f(x1+60,y1-30);
glColor3f(0,0.0,0.0);
glVertex2f(x1,y1-30);
glEnd();
while(i<3) {
glBegin(GL_QUADS); //BOGIES
glColor3f(1.0,0.0,0.0); //For right train a=795,b=510
glVertex2f(a,b);
glColor3f(1.0,0.0,0.0);
glVertex2f(a+60,b);
glColor3f(1.0,0.0,0.0);
glVertex2f(a+60,b-20);
glColor3f(1.0,0.0,0.0);
glVertex2f(a,b-20);
glEnd();
a+=65; i++;
}
}

This function can be called any where hence easy to create the sample trains. In similar fashion we have different functions for Sky, Environments and Tracks. You can download the free cg source code below. All the things made in the opengl projects example have used primitive opengl objects.

Next level of difficulty is to move the whole Train - bogies and engine. For the motion of train we have logically used the call-list, push-pop matrix and the most important Clock() function. The clock() is defined in <time.h> header so you need to include it as well in the project.

clock_t goal = mseconds + clock(); while (goal > clock());

Our new function will help the train runs according a time level else we may go so fast or so slow. We have fixed a goal and add certain time for it to move the objects. The above code is called in a function and we give the parameter mseconds according to our requirement of speed we want.
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: midpoint ellipse program in opengl, www hdfcbank comrewardcatalogg opengl, n queens opengl, opengl sstf coding**wiki, moving train in computer graphics project with detail, moving train program in c, moving train project in computer graphics,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  opengl source code for butterfly 3 3,241 14-05-2018, 08:57 AM
Last Post: Akshatha k
  program code of solar tracking system using 8051 microcontroller 6 23,104 03-05-2018, 09:30 PM
Last Post: Guest
  project physics class 12 on moving coil galvanometer 3 26,520 04-01-2018, 10:59 AM
Last Post: dhanabhagya
  project report for mancala game in opengl 2 1,241 05-06-2017, 11:24 AM
Last Post: jaseela123d
  computer graphics projects using opengl free download 3 1,371 01-05-2017, 02:33 PM
Last Post: jaseela123d
  opengl source code for cpu scheduling algorithms 1 1,130 25-03-2017, 11:43 AM
Last Post: jaseela123d
  source code of go back n arq on opengl 1 1,147 20-03-2017, 12:08 PM
Last Post: jaseela123d
  seminar report on bullet train 1 990 16-03-2017, 12:51 PM
Last Post: jaseela123d
  queue implementation in opengl 1 548 10-03-2017, 02:48 PM
Last Post: jaseela123d
  six leg kinematic moving machine theory 1 695 09-03-2017, 04:23 PM
Last Post: jaseela123d

Forum Jump: