所以我正在做一个练习,包括在opengl中绘制一些东西,然后为每个象限着色。我已经完成了它,但是当我在绘制我的函数之前为象限着色时,它会使它大于定义的大小。下面我留下我的代码进行澄清。
在init中,我声明了gcc -o3 Engine.c -o Engine.exe -lpthread
这是在调用的主要方法中
gluOrtho2D(-10,10, -10,10);
如果我把它放在顶部,它会为背景着色,但会增加窗口的空间。
glutDisplayFunc(lineGraph)
我的方法//1 cuadrante
glViewport(125, 375, 250, 250);
glColor3ub(255,255,0);
dibujaFondoCuadrantes();
//2 cuadrante
glViewport(0, 375, 250, 250);
glColor3ub(255,0,0);
dibujaFondoCuadrantes();
//3 cuadrante
glViewport(125, 250, 250, 250);
glColor3ub(0,255,0);
dibujaFondoCuadrantes();
//4 cuadrante - realmente el 4
glViewport(0, 250, 250, 250);
glColor3ub(0,0,255);
dibujaFondoCuadrantes();
有:
dibujaFondoCuadrantes()
我的所有代码:
glBegin(GL_QUADS);
glVertex2f(-10, 0.0);//Esquina izq arriba
glVertex2f(-10, -10);//Esquina izq abajo
glVertex2f(0.0, -10);// Esquina derecha abajo
glVertex2f(0.0, 0.0);//Esquina derecha srriba
glEnd();