Jump to content
  • Advertisement

Archived

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

10011010

unwanted connected polygons

This topic is 5274 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

//////////////// say i do this: glBegin(GL_QUAD_STRIP); glVertex3i(0,0,0); glVertex3i(1,0,0); glVertex3i(0,1,0); glVertex3i(1,1,0); glVertex3i(0,2,0); glVertex3i(1,2,0); glVertex3i(0,3,0); glVertex3i(1,3,0); glVertex3i(0,4,0); glVertex3i(1,4,0); glEnd(); ////////////// and then i do this: glBegin(GL_QUAD_STRIP) glVertex3i(20,0,0); glVertex3i(21,0,0); glVertex3i(20,1,0); glVertex3i(21,1,0); glVertex3i(20,2,0); glVertex3i(21,2,0); glVertex3i(20,3,0); glVertex3i(21,3,0); glVertex3i(20,4,0); glVertex3i(21,4,0); glEnd(); when i run the prog there is a line drawn between the 2 sets of quads. this isnt only with quad_strips. i wrote a function to draw a chessboard (8x8 quads) but it didnt work because it connected all the quads together by a line. how do i stop this? i just want to draw separated shapes: i.e. 1.draw a shape 2. draw another which is in no way connected to the 1st one 3. repeat how do i do this?

Share this post


Link to post
Share on other sites
Advertisement
My guess is that you aren''t given an adequate number of vertices to finish the last quad, but I''m not sure. That''s the only thing that makes sense though.

Share this post


Link to post
Share on other sites
nope, i wish it were that simple. check this out:

*********************************************************
class Tile
{
int xpos;
int ypos;

void DrawSelf(int x,int y);
}

void Tile::DrawSelf(int x, int y)
{
glBegin(GL_QUADS);
glVertex3i(x,y,0);
glVertex3i(x+1,y,0);
glVertex3i(x+1,y+1,0);
glVertex3i(x,y+1,0);
glEnd();
}

// this one i had as a member of a class TileMap, and it had a member Tile grid[8,8]
// just dont feel like writing the class now for this example

void DrawBoard(int x, int y)
{
int tempy=y;

for(i=0;i<7;i++)
{
for(j=0;j<7;j++)
{
grid[i,j].DrawSelf(x,y);
y++;
}
x++;y=tempy;
}


int main()
{
//setup openGL stuff .......

DrawBoard();
}
*********************************************************

now it looks like it will draw 64 quads, 8x8, and it does, BUT there are all these diagonal lines running from the first column to all the rest of them, these lines i need to get rid of!

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!