Добавил:
Maestro
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Текстовый документ (2)
.txt 1.
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef -1.5, 0, -6
glBegin bmTriangles
glVertex3f 0, 1, 0
glVertex3f -1, -1, 0
glVertex3f 1, -1, 0
glEnd
glTranslatef 3, 0, 0
glBegin bmQuads
glVertex3f -1, 1, 0
glVertex3f 1, 1, 0
glVertex3f 1, -1, 0
glVertex3f -1, -1, 0
glEnd
DrawGLScene = True
2.
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef 0, 0, -16
glRotatef y, 0, 1, 0
glBegin bmPolygon
glColor3f 0.5, 0.5, 1
glVertex3f -1, 2, 0
glVertex3f -2, 2, 0
glVertex3f -2, 0, 0
glVertex3f 0, 2.5, 0
glVertex3f 1, 2, 0
glVertex3f 2, 2, 0
glVertex3f 2, 1, 0
glVertex3f 2.5, 0, 0
glVertex3f 2, -1, 0
glVertex3f 2, -2, 0
glVertex3f 1, -2, 0
glVertex3f 0, -2.5, 0
glVertex3f -1, -2, 0
glVertex3f -2, -2, 0
glVertex3f -2, -1, 0
glVertex3f -2.5, 0, 0
glVertex3f -2, 1, 0
glEnd
DrawGLScene = True
3.
Option Explicit
Dim z As GLfloat
Dim rx As GLfloat
Dim ry As GLfloat
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Keys(KeyCode) = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Keys(KeyCode) = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillGLWindow
End Sub
Public Function DrawGLScene() As Boolean
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef 0, 0, z
glRotatef rx, 1, 0, 0
glRotatef ry, 0, 1, 0
If Keys(vbKeyUp) Then z = z + 0.1
If Keys(vbKeyDown) Then z = z - 0.1
If Keys(vbKeyQ) Then rx = rx + 0.1
If Keys(vbKeyA) Then rx = rx - 0.1
If Keys(vbKeyW) Then ry = ry + 0.1
If Keys(vbKeyS) Then ry = ry - 0.1
glColor3f 1, 0, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 1, 1, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 0.5, 1, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 1, 0.5, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 0, 1, 0
glBegin bmQuads
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glEnd
DrawGLScene = True
End Function
4.
glColor3f 0.5, 0.5, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 1, 0.5
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 0, 1
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 0.5, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -10
glEnd
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef -1.5, 0, -6
glBegin bmTriangles
glVertex3f 0, 1, 0
glVertex3f -1, -1, 0
glVertex3f 1, -1, 0
glEnd
glTranslatef 3, 0, 0
glBegin bmQuads
glVertex3f -1, 1, 0
glVertex3f 1, 1, 0
glVertex3f 1, -1, 0
glVertex3f -1, -1, 0
glEnd
DrawGLScene = True
2.
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef 0, 0, -16
glRotatef y, 0, 1, 0
glBegin bmPolygon
glColor3f 0.5, 0.5, 1
glVertex3f -1, 2, 0
glVertex3f -2, 2, 0
glVertex3f -2, 0, 0
glVertex3f 0, 2.5, 0
glVertex3f 1, 2, 0
glVertex3f 2, 2, 0
glVertex3f 2, 1, 0
glVertex3f 2.5, 0, 0
glVertex3f 2, -1, 0
glVertex3f 2, -2, 0
glVertex3f 1, -2, 0
glVertex3f 0, -2.5, 0
glVertex3f -1, -2, 0
glVertex3f -2, -2, 0
glVertex3f -2, -1, 0
glVertex3f -2.5, 0, 0
glVertex3f -2, 1, 0
glEnd
DrawGLScene = True
3.
Option Explicit
Dim z As GLfloat
Dim rx As GLfloat
Dim ry As GLfloat
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Keys(KeyCode) = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Keys(KeyCode) = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillGLWindow
End Sub
Public Function DrawGLScene() As Boolean
glClear clrColorBufferBit Or clrDepthBufferBit
glLoadIdentity
glTranslatef 0, 0, z
glRotatef rx, 1, 0, 0
glRotatef ry, 0, 1, 0
If Keys(vbKeyUp) Then z = z + 0.1
If Keys(vbKeyDown) Then z = z - 0.1
If Keys(vbKeyQ) Then rx = rx + 0.1
If Keys(vbKeyA) Then rx = rx - 0.1
If Keys(vbKeyW) Then ry = ry + 0.1
If Keys(vbKeyS) Then ry = ry - 0.1
glColor3f 1, 0, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 1, 1, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 0.5, 1, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 1, 0.5, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -4
glEnd
glColor3f 0, 1, 0
glBegin bmQuads
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glEnd
DrawGLScene = True
End Function
4.
glColor3f 0.5, 0.5, 0
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 1, 0.5
glBegin bmTriangles
glVertex3f 1, 1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 0, 1
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f -1, 1, -7
glVertex3f 0, 0, -10
glEnd
glColor3f 1, 0.5, 0
glBegin bmTriangles
glVertex3f -1, -1, -7
glVertex3f 1, -1, -7
glVertex3f 0, 0, -10
glEnd
Соседние файлы в предмете Компьютерная Графика