Dim x#
Dim y#
dim texture
texture = LoadTexture ("image.jpg")
glEnable (GL_TEXTURE_2D)
glEnable (GL_CULL_FACE)
while true
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glTranslatef(x#,y#,-5.0)
glBindTexture(GL_TEXTURE_2D, texture)
glBegin(GL_QUADS)
' Front face
glTexCoord2f(0.0, 0.0): glVertex3f(-1.0, -1.0, 1.0) ' Bottom left of the texture and quad
glTexCoord2f(1.0, 0.0): glVertex3f( 1.0, -1.0, 1.0) ' Bottom right of the texture and quad
glTexCoord2f(1.0, 1.0): glVertex3f( 1.0, 1.0, 1.0) ' Top right of the texture and quad
glTexCoord2f(0.0, 1.0): glVertex3f(-1.0, 1.0, 1.0) ' Top left of the texture and quad
' Back face
glTexCoord2f(1.0, 0.0): glVertex3f(-1.0, -1.0, -1.0) ' Bottom right of the texture and quad
glTexCoord2f(1.0, 1.0): glVertex3f(-1.0, 1.0, -1.0) ' Top right of the texture and quad
glTexCoord2f(0.0, 1.0): glVertex3f( 1.0, 1.0, -1.0) ' Top left of the texture and quad
glTexCoord2f(0.0, 0.0): glVertex3f( 1.0, -1.0, -1.0) ' Bottom left of the texture and quad
' Top face
glTexCoord2f(0.0, 1.0): glVertex3f(-1.0, 1.0, -1.0) ' Top left of the texture and quad
glTexCoord2f(0.0, 0.0): glVertex3f(-1.0, 1.0, 1.0) ' Bottom left of the texture and quad
glTexCoord2f(1.0, 0.0): glVertex3f( 1.0, 1.0, 1.0) ' Bottom right of the texture and quad
glTexCoord2f(1.0, 1.0): glVertex3f( 1.0, 1.0, -1.0) ' Top right of the texture and quad
' Bottom face
glTexCoord2f(1.0, 1.0): glVertex3f(-1.0, -1.0, -1.0) ' Top right of the texture and quad
glTexCoord2f(0.0, 1.0): glVertex3f( 1.0, -1.0, -1.0) ' Top left of the texture and quad
glTexCoord2f(0.0, 0.0): glVertex3f( 1.0, -1.0, 1.0) ' Bottom left of the texture and quad
glTexCoord2f(1.0, 0.0): glVertex3f(-1.0, -1.0, 1.0) ' Bottom right of the texture and quad
' Right face
glTexCoord2f(1.0, 0.0): glVertex3f( 1.0, -1.0, -1.0) ' Bottom right of the texture and quad
glTexCoord2f(1.0, 1.0): glVertex3f( 1.0, 1.0, -1.0) ' Top right of the texture and quad
glTexCoord2f(0.0, 1.0): glVertex3f( 1.0, 1.0, 1.0) ' Top left of the texture and quad
glTexCoord2f(0.0, 0.0): glVertex3f( 1.0, -1.0, 1.0) ' Bottom left of the texture and quad
' Left face
glTexCoord2f(0.0, 0.0): glVertex3f(-1.0, -1.0, -1.0) ' Bottom left of the texture and quad
glTexCoord2f(1.0, 0.0): glVertex3f(-1.0, -1.0, 1.0) ' Bottom right of the texture and quad
glTexCoord2f(1.0, 1.0): glVertex3f(-1.0, 1.0, 1.0) ' Top right of the texture and quad
glTexCoord2f(0.0, 1.0): glVertex3f(-1.0, 1.0, -1.0) ' Top left of the texture and quad
glEnd()
SwapBuffers ()
If ScanKeyDown(VK_LEFT) Then x# = x# - 0.005 EndIf
If ScanKeyDown(VK_RIGHT) Then x# = x# + 0.005 EndIf
If ScanKeyDown(VK_UP) Then y# = y# - 0.005 EndIf
If ScanKeyDown(VK_DOWN) Then y# = y# + 0.005 EndIf
wend
|