2011-10-25 3 views
0

그림에있는 그림을 그리려하고 있습니다. 그래서 무작위로 색깔이있는 사각형을 그릴 수는 있지만, for 루프가 이미지처럼 사각형을 그리는 데 문제가 있습니다. enter image description herefor 루프의 OpenGL 드로잉 사각형

코드 : 당신은 심지어 루프 본문에 ij를 사용하지 않는

for (int i =0; i < image.width; i = i+5) { 
    for (int j = 0; j < image.height; j = j+5) { 

     //will this for loop give me what's in the image? 
     //want to incorporate the code below in here. Modifications? 
     glPushMatrix(); 
     glTranslatef(i, j, 0); 
     glColor3ub(rand()%255, rand()%255, rand()%255); 
     glBegin(GL_QUADS); 
     glVertex2i(0,0); 
     glVertex2i(1,0); 
     glVertex2i(1,1); 
     glVertex2i(0,1); 
     glEnd(); 
     glPopMatrix(); 
    } 
} 
+0

그래서 현재 그 그림은 무엇입니까? – genpfault

+0

내가 for 루프를 넣기 전에, 무작위로 채색 된 사각형을 그려 넣었다. –

답변

3

. xposypos (해당되는 경우)으로 대체하십시오.

+1

There (OP) 당신은화물 컬트 프로그래밍 * 한숨 *의 전시를 볼 수있다. – datenwolf