void paintGL()
{
makeCurrent();
glViewport(0,0,500,500);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,500,0,500,0,-100);
//glOrtho(-1,1,1,1,0,-1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0,1,0,1);
glColor3f(1,0,0);
const int x = 100;
int y = 100;
const int dx = 26;
const int dy = 16;
glBegin(GL_LINES);
for(int i = 0;i<10;++i)
{
glVertex3f(x,y,0);
glVertex3f(x+dx,y,0);
glVertex3f(x+dx,y,0);
glVertex3f(x+dx,y+dy,0);
glVertex3f(x+dx,y+dy,0);
glVertex3f(x,y+dy,0);
glVertex3f(x,y+dy,0);
glVertex3f(x,y,0);
y+=18;
}
//glVertex3f(90,90,0);
glEnd();
swapBuffers();
}
void paintGL()
{
makeCurrent();
glViewport(0,0,500,500);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,500,0,500,0,-100);
//glOrtho(-1,1,1,1,0,-1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0,1,0,1);
glColor3f(1,0,0);
const int x = 100;
int y = 100;
const int dx = 26;
const int dy = 16;
glBegin(GL_LINES);
for(int i = 0;i<10;++i)
{
glVertex3f(x,y,0);
glVertex3f(x+dx,y,0);
glVertex3f(x+dx,y,0);
glVertex3f(x+dx,y+dy,0);
glVertex3f(x+dx,y+dy,0);
glVertex3f(x,y+dy,0);
glVertex3f(x,y+dy,0);
glVertex3f(x,y,0);
y+=18;
}
//glVertex3f(90,90,0);
glEnd();
swapBuffers();
}
To copy to clipboard, switch view to plain text mode
Bookmarks