#### Archived

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

# Why isnt this working...

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

## Recommended Posts

int x=0, z=0; for(x=-100; x<=100; x+=5) { for(z=-100; z<=100; z+=5) { glBegin(GL_QUADS); glColor3ub(0, 255, 0); glVertex3f((float)x, -1.0f, (float)z); // Left And Up 1 Unit (Top Left) glVertex3f((float)x, -1.0f, (float)z); // Right And Up 1 Unit (Top Right) glVertex3f((float)x, -1.0f, (float)z); // Right And Down One Unit (Bottom Right) glVertex3f((float)x, -1.0f, (float)z); glEnd(); } } it is suppose to create a bunch of 3d tiles but its not doing anything... Don''t click me! Killer Eagle Software

##### Share on other sites
You're specifying the same vertex four times. There is no variation in the four vertices that you send to glVertex3f. You send (x, -1.0f, z) four times. The vertices must be different, or no quad will be drawn.

Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You're Already Here | The Best Film Reviews ]

[edited by - iNsAn1tY on November 2, 2002 6:50:15 PM]

##### Share on other sites
Umm... you''re creating all your vertices on the same point.
Consider the first iteration:

// x=-100, z=-100glBegin(GL_QUADS); glColor3ub(0, 255, 0);glVertex3f(-100.0f, -1.0f, -100.0f); // Left And Up 1 Unit (Top Left)glVertex3f(-100.0f, -1.0f, -100.0f); // Right And Up 1 Unit (Top Right)glVertex3f(-100.0f, -1.0f, -100.0f); // Right And Down One Unit (Bottom Right)glVertex3f(-100.0f, -1.0f, -100.0f); glEnd();

And this can''t work very well...

##### Share on other sites
quote:
Original post by Anonymous Poster
Umm... you''re creating all your vertices on the same point.
Consider the first iteration:

// x=-100, z=-100glBegin(GL_QUADS); glColor3ub(0, 255, 0);glVertex3f(-100.0f, -1.0f, -100.0f); // Left And Up 1 Unit (Top Left)glVertex3f(-100.0f, -1.0f, -100.0f); // Right And Up 1 Unit (Top Right)glVertex3f(-100.0f, -1.0f, -100.0f); // Right And Down One Unit (Bottom Right)glVertex3f(-100.0f, -1.0f, -100.0f); glEnd();

And this can''t work very well...

Ah, HA! your right i forgot to do this
for(x=-100; x<=100; x+=5)
{
for(z=-100; z<=100; z+=5)
{
glColor3ub(0, 255, 0);
glVertex3f((float)x-5, -1.0f, (float)z-5); // Left And Up 1 Unit (Top Left)
glVertex3f((float)x, -1.0f, (float)z-5); // Right And Up 1 Unit (Top Right)
glVertex3f((float)x, -1.0f, (float)z); // Right And Down One Unit (Bottom Right)
glVertex3f((float)x-5, -1.0f, (float)z);
glEnd();
}
}

Don''t click me!
Killer Eagle Software

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 17
• 18
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633362
• Total Posts
3011528
• ### Who's Online (See full list)

There are no registered users currently online

×