实验一 1.1
This commit is contained in:
BIN
freeglut.dll
Normal file
BIN
freeglut.dll
Normal file
Binary file not shown.
48
lab1/1.cpp
Normal file
48
lab1/1.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#include<GL/glut.h>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void myDisplay()
|
||||||
|
{
|
||||||
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
|
||||||
|
glColor4f(0.0, 1.0, 0.0, 0.0);
|
||||||
|
glRectf(50.0, 50.0, 400.0, 400.0);
|
||||||
|
|
||||||
|
glColor3f(1.0, 1.0, 0.0);
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f(50.0, 50.0);
|
||||||
|
glVertex2f(400.0, 400.0);
|
||||||
|
glVertex2f(400.0, 50.0);
|
||||||
|
glVertex2f(50.0, 400.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glColor3f(1.0, 0.0, 0.0);
|
||||||
|
glPointSize(20.0);
|
||||||
|
glBegin(GL_POINTS);
|
||||||
|
glVertex2f(15.0, 15.0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(0.0, 0.0, 1.0);
|
||||||
|
glVertex2i(200, 300);
|
||||||
|
glVertex2i(100, 100);
|
||||||
|
glVertex2i(300, 100);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
}
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
glutInit(&argc, argv);
|
||||||
|
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
|
||||||
|
glutInitWindowPosition(100, 100);
|
||||||
|
glutInitWindowSize(500, 500);
|
||||||
|
glutCreateWindow("ÀÖÒâ");
|
||||||
|
glutDisplayFunc(&myDisplay);
|
||||||
|
glutMainLoop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
lab1/1.exe
Normal file
BIN
lab1/1.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user