English
Source / code snippets

demonstration Opengl planets

 

CompileMarkSeparation
Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
OpenGL-Demo: Planeten
Declare Texture%[4],
DisplayList%[3],
Rotation![3],
SelfRot![3],
LightPos&[3]
Declare rot!, Ende%, Namen$[4]

proc DrawGLScene

    oGL(Clear)
    oGL(Origin, 0, -2.8, (-50))
    oGL(Rotate, rot!, 0, 0)
    Sonne
    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)
    Erde
    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)
    Mond
    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)
    Hintergrund
    oGL(SetName, 4)
    oGL(Texture, Texture%[4], 2)
    oGL(Rotate, -rot!, 0, 0)   Der Hintergrund soll nicht rotieren
    oGL(Move, 0, -35, -30)
    oGL(Quad, 94, 70)
    oGL(Rotate, rot!, 0, 0)
    oGL(Show)

EndProc

WindowTitle Planeten
WindowStyle 31
CLS
Messagebox(Linksklick auf Objekt: Objektname in der Titelleiste
+
Rechtsklick: Titelleiste wird zurückgesetzt
+
BildHoch/BildRunter kippen das System, OpenGL-Demo 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] = Sonne
Namen$[1] = Mars
Namen$[3] = Mond
Namen$[2] = Erde
Namen$[4] = Sterne
Ende% = 0
setTimer 50  max. 20 Frames /sek.

WhileNot ende%

    WaitInput

    If IsKey(27)

        Ende% = 1

    EndIf

    If IsKey(1)

        oGL(StartTest, %MouseX, %MouseY)
        DrawGLScene()
        SetText %hWnd, namen$[oGL(EndTest)]

    ElseIf IsKey(2)

        SetText %hWnd, Planeten

    ElseIf IsKey(34)

        rot! = rot! + 1

    ElseIf IsKey(33)

        rot! = rot! - 1

    EndIf

    SelfRot![0] = SelfRot![0] + 0.5   Sonne
    SelfRot![1] = SelfRot![1] + 5     Mars
    SelfRot![2] = SelfRot![2] + 5     Erde
    SelfRot![3] = SelfRot![3] + 5     Mond

    WhileLoop 0, 3

        Case SelfRot![&loop] > 360 : SelfRot![&loop] = 0

    EndWhile

    Rotation![3] = Rotation![3] - 12.5  Mond
    Rotation![2] = Rotation![2] +  2.5  Erde
    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

./../../references-fonction/XProfan/killtimer/'>killTimer
end
 
07/16/07  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.047 Views

Untitledvor 0 min.
H.Brill10/29/23
Sven Bader07/09/21
HofK04/21/18
RudiB.06/04/11

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie