Drawing rectangles in a for()

Started by
4 comments, last by Kiroke 22 years, 3 months ago
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.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 </i>
Kirokewww.geocities.com/kiroke2
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
Err.. dont you mean blocks.x
Hah.. stupid html tags..

blocks .x
are you forgetting GLbegin(GL_QUADS)/GLend(); by any chance??

http://www.lectersoft.com
http://www.lectersoft.com
L

O

L

yeah thx... too much concentration leeds to the worst evident errors.

Kiroke
Kirokewww.geocities.com/kiroke2

This topic is closed to new replies.

Advertisement