PDA

View Full Version : Pyramid



peter
05-12-2013, 00:56
Hi,

A pyramid.


#INCLUDE "a.inc"
#INCLUDE "swgl.inc"


DWord hwnd = OpenWindow 640,480,1
InitGl hwnd


Single r
Long img


img = LoadImage "image/image10.bmp"


While KeyDown(27)=0
glClearColor 0.0, 0.2, 0.5, 1.0
glClear %oGL_COLOR_BUFFER_BIT Or %oGL_DEPTH_BUFFER_BIT
glLoadIdentity


glBindTexture %oGL_TEXTURE_2D, img
glTranslatef -0.1, -0.1, 0.0
glRotatef r, 0.0, 1.0, 0.0
glBegin %oGL_TRIANGLES

glTexCoord2f 1.0, 0.0: glVertex3f( 0.0, 0.5, 0.0)
glTexCoord2f 1.0, 1.0: glVertex3f(-0.5,-0.5, 0.5)
glTexCoord2f 0.0, 1.0: glVertex3f( 0.5,-0.5, 0.5)
glTexCoord2f 0.0, 0.0: glVertex3f( 0.0, 0.5, 0.0)

glTexCoord2f 1.0, 0.0: glVertex3f( 0.5,-0.5, 0.5)
glTexCoord2f 1.0, 1.0: glVertex3f( 0.5,-0.5,-0.5)
glTexCoord2f 0.0, 1.0: glVertex3f( 0.0, 0.5, 0.0)
glTexCoord2f 0.0, 0.0: glVertex3f( 0.5,-0.5,-0.5)

glTexCoord2f 1.0, 0.0: glVertex3f(-0.5,-0.5,-0.5)
glTexCoord2f 1.0, 1.0: glVertex3f( 0.0, 0.5, 0.0)
glTexCoord2f 0.0, 1.0: glVertex3f(-0.5,-0.5,-0.5)
glTexCoord2f 0.0, 0.0: glVertex3f(-0.5,-0.5, 0.5)
glEnd


r +=1


Events
SwapBuffer
SetFps 60
Wend


QuitGl
CloseWindow