View Full Version : Rendering RaceTrack By The Use Of The Co-ordinates From The File

01-22-2014, 11:36 AM
I've in plan to develop simple 3D Bike racing game with the minimal features as it can be. And with the some knowledge of Opengl , i have started from drawing the RaceTrack. In my program, the the co-ordinates of the racetrack from the file gets loaded successfully. And i have used to quad to draw the racetrack and i've set the projection mode into the perspective view with field of view 45, near plane 1.0f and far plane 50.0f. And in the code present at the downward when i loop the for loop from i = 1 t0 i =8 or less looping near to i =(0- 30/ 0-4)0, i gets the racetrack rendered successfully. As there are 338 co-ordinates in my racetrack, when i tried to render all the co-ordinates at a time by looping from i = 0 to i = 338, the problem occurs in my code.The whole screen gets colored in green color. And in my program, i've also enabled the gl_depth by using the glEnable and in the glInitMode. The main code for rendering the racetrack is provided below.

//Color it 5 into y axis
glColor3f(0.0f, 1.0f, 0.0f);

//now using the functionality of glulookat for respective section viewing
gluLookAt(0.0f, 10.0f, 5.0f, 0.0f, -3.0f, -12.0f,0.0f, 1.0f, 0.0f );

glTranslatef(0.0f, -3.0f, 0.0f);

//Taking the things in anticlockwise direction

int value[4] ={0,1,3,2};
for(int i = 0; i < 8; i++)


value[0] = value[3];
value[1] = value[2];
value[2] += 2;
value[3] += 2;


I can't figured out what is missing in it or in my project. Any suggestion will be highly appreciable. Sorry,if i haven't posted in proper way, as it is the first post in these forum. Need help.