Need Help Doing 3D version of Lesson 21 Mini-Game

Started by
0 comments, last by Meek 20 years, 6 months ago
I felt inspired to do a 3D version of your tutorial 21 mini game. The texture map will be underneath a plane of Quads. The Quads and mapping will be underneath a plane of line grids. However, as I''m still a newbie, I cannot seem to put the grib of lines(using your line drawing code) onto the Quads, let alone texture mapping. Can you help me with some pointers or even codes? My code now is: void CGameWorld::DrawTile() { float size = 10.0; int loop1; int loop2; int loopA; int loopB; //Draw plane of Quads for(loop1=0; loop1<9;loop1++) { for(loop2=0; loop2<9;loop2++) { glBegin(GL_QUADS); glVertex3f(loop2*size,0.0,loop1*size); glVertex3f(loop2*size+size,0.0,loop1*size); glVertex3f(loop2*size+size,0.0,loop1*size+size); glVertex3f(loop2*size,0.0,loop1*size+size); glEnd(); } } for (loopA=0; loopA<9; loopA++) // Loop From Left To Right { for (loopB=0; loopB<9; loopB++) // Loop From Top To Bottom { if (loopA<10) // Dont Draw To Far Right { glBegin(GL_LINES); // Start Drawing Horizontal Cell Borders glLineWidth(2.0f); // Set Line Width For Cells To 2.0f glColor3f(0.0f,0.5f,1.0f); // Set Line Color To Blue glVertex2d(20+(loopB*60),70+(loopB*40));// Left Side Of Horizontal Line glVertex2d(80+(loopA*60),70+(loopA*40));// Right Side Of Horizontal Line glEnd(); // Done Drawing Horizontal Cell Borders } if (loopB<10) // Dont Draw To Far Down { glBegin(GL_LINES); // Start Drawing Verticle Cell Borders glLineWidth(2.0f); // Set Line Width For Cells To 2.0f glColor3f(0.0f,0.5f,1.0f); // Set Line Color To Blue glVertex2d(20+(loopA*60),70+(loopB*40));// Left Side Of Horizontal Line glVertex2d(20+(loopA*60),110+(loopB*40));// Right Side Of Horizontal Line glEnd(); // Done Drawing Verticle Cell Borders } } } }
Advertisement
glVertex2d(20+(loopB*60),70+(loopB*40));// Left Side Of Horizontal Line
glVertex2d(80+(loopA*60),70+(loopA*40));// Right Side Of Horizontal Line

Correct is:

glVertex2d(20+(loopA*60),70+(loopB*40));// Left Side Of Horizontal Line
glVertex2d(80+(loopA*60),70+(loopB*40));// Right Side Of Horizontal Line


This topic is closed to new replies.

Advertisement