Jump to content
  • Advertisement

Archived

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

Kiroke

Drawing rectangles in a for()

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

Hi I''m making a program with that function void DrawBlocks(BLOCK *blocks) { glColor3f(0.0, 1.0, 0.0); for(int i = 0 ; i < nbBlocks - 5; i++) { glPushMatrix(); glTranslatef(blocks.x,blocks[i].y, 0.0); glVertex3f(-3.0, -0.5, 0.0); glVertex3f(-3.0, 0.5, 0.0); glVertex3f(3.0, 0.5, 0.0); glVertex3f(3.0, -0.5, 0.0); glPopMatrix(); } } unfortunately i get a fatal error on the entire program and when i use the microsoft visual C++ debugger i get the crash in that function when it loop for the 18th time. Anyone knows if that thing has somthing to do with the matrix stack? Thx alot Kiroke

Share this post


Link to post
Share on other sites
Advertisement
once you use blocks as a single variable then as an array. accoring to your function def it should be treated like an array, therefore you have to use blocks.x

@$3.1415rin

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Err.. dont you mean blocks.x

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hah.. stupid html tags..

blocks .x

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!