Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
OGL-demonstration: planets
Declare Texture%[4],
DisplayList%[3],
Rotation![3],
SelfRot![3],
LightPos&[3]
Declare ruddy!, end%, names$[4]
proc DrawGLScene
oGL(Clear)
oGL(Origin, 0, -2.8, (-50))
oGL(Rotate, ruddy!, 0, 0)
sun
oGL(SetName, 0)
oGL(Texture, Texture%[0], 1)
oGL(Push)
oGL(Rotate, 0, SelfRot![0], 0)
oGL(Sphere, 2.8, 32, 32)
oGL(Pop)
mars
oGL(SetName, 1)
oGL(Texture, Texture%[1], 1)
oGL(Push)
oGL(Rotate, 0, Rotation![1], 0)
oGL(Move, 0.0, 1.2, 20.0)
oGL(Rotate, 0, SelfRot![1], 0)
oGL(Sphere, 1.6, 32, 32)
oGL(Pop)
world
oGL(SetName, 2)
oGL(Texture, Texture%[2], 1)
oGL(Push)
oGL(Rotate, 0, Rotation![2], 0)
oGL(Move, 0.0, 0.8, 10.0)
oGL(Rotate, 0, SelfRot![2], 0)
oGL(Sphere, 2.0, 32, 32)
moon
oGL(SetName, 3)
oGL(Texture, Texture%[3], 1)
oGL(Rotate, 0, Rotation![3], 0)
oGL(Move, 0.0, 1.2, 3.5)
oGL(Sphere, 0.8, 16, 16)
oGL(Pop)
background
oGL(SetName, 4)
oGL(Texture, Texture%[4], 2)
oGL(Rotate, -ruddy!, 0, 0) The background should not rotate
oGL(Move, 0, -35, -30)
oGL(Quad, 94, 70)
oGL(Rotate, ruddy!, 0, 0)
oGL(Show)
ENDPROC
Window Title planets
Window Style 31
CLS
Messagebox(Linksklick on Objekt: Objektname in the Titelleiste
+
Rechtsklick: Titelleiste becomes reset
+
BildHoch/BildRunter tip the system, OpenGL-demonstration qPlanetenq, 64)
oGL(Init, %hWnd, 0, 0, 0, 1)
texture%[0] = oGL(LoadTextureBMP,sun.bmp,3)
texture%[1] = oGL(LoadTextureBMP,mars.bmp,3)
texture%[2] = oGL(LoadTextureBMP,earth.bmp,3)
texture%[3] = oGL(LoadTextureBMP,moon.bmp,3)
texture%[4] = oGL(LoadTextureBMP,space.bmp,3)
Namen$[0] = sun
Namen$[1] = mars
Namen$[3] = moon
Namen$[2] = world
Namen$[4] = stars
Ende% = 0
setTimer 50 max. 20 Frames /sek.
WhileNot end%
WaitInput
If IsKey(27)
end% = 1
EndIf
If IsKey(1)
oGL(StartTest, %MouseX, %MouseY)
DrawGLScene()
SetText %hWnd, names$[oGL(EndTest)]
ElseIf IsKey(2)
SetText %hWnd, planets
ElseIf IsKey(34)
ruddy! = ruddy! + 1
ElseIf IsKey(33)
ruddy! = ruddy! - 1
EndIf
SelfRot![0] = SelfRot![0] + 0.5 sun
SelfRot![1] = SelfRot![1] + 5 mars
SelfRot![2] = SelfRot![2] + 5 world
SelfRot![3] = SelfRot![3] + 5 moon
WhileLoop 0, 3
Case SelfRot![&loop] > 360 : SelfRot![&loop] = 0
EndWhile
Rotation![3] = Rotation![3] - 12.5 moon
Rotation![2] = Rotation![2] + 2.5 world
Rotation![1] = Rotation![1] + 1.5 mars
WhileLoop 1, 3
Case Rotation![&loop] > 360 : Rotation![&loop] = 0
Case Rotation![&loop] < 0 : Rotation![&loop] = 360
EndWhile
DrawGLScene()
EndWhile
killTimer
end