Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Meek

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

This topic is 5475 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 } } } }

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!