English
Source / code snippets

@Jonathans 3D-Screensaver in OGL

 

p.specht

One äusserst erhaltenswertes example for OGL-skills of XProfan. I hope, Jonathan is these further publication right. Please ev. circa nachträgliches OK! LG p.woodpecker
'/// RamschWare(tm) by Jonathan ///
Var DotzAnzahl& = 20
Declare Doetze#[DotzAnzahl&], Temp&
Class Dotz = X!, Y!, Z!, VX!, VY!, VZ!, R!, G!, B!, Seg&, Form&, RotoX!, VRotoX!, RotoY!, VRotoY!
Dim Doetze#[], Dotz
Window Style 16+64+256
Window %maxx, %maxy
Randomize
'Doetze create

WhileLoop 0, DotzAnzahl& - 1

    With Doetze#[&loop]

        .R! = @Rnd()
        .G! = @Rnd()
        .B! = @Rnd()
        Temp& = @Rnd(3)

        If Temp& = 0

            .R! = 1

        ElseIf Temp& = 1

            .G! = 1

        ElseIf Temp& = 2

            .B! = 1

        EndIf

        .Seg& = @Rnd(5) + 3
        .VX! = (@Rnd() - .5) / 4
        .VY! = (@Rnd() - .5) / 4
        .VZ! = (@Rnd() - .5) / 4
        .Form& = @Rnd(5)
        .VRotoX! = @Rnd() * 10 - 5
        .VRotoY! = @Rnd() * 10 - 5

    EndWith

EndWhile

Ogl("Init", %hwnd, 0, 0, 0, 1)
Ogl("PosMode", 1)

Proc ZeichneDoetze

    Parameters Doetze#[], DA&
    Ogl("Clear")

    WhileLoop 0, DA& - 1

        With Doetze#[&loop]

            Ogl("Origin", .X!, .Y!, .Z! - 8)
            Ogl("Color", .R!, .G!, .B!, 1)
            Ogl("Rotate", .RotoX!, .RotoY!, 0)

            If .Form& = 0

                Ogl("Sphere", .5, .Seg&, .Seg&)

            ElseIf .Form& = 1

                Ogl("Cuboid", .5, .5, .5)

            ElseIf .Form& = 2

                Ogl("Triangle", .5, .5, .5)

            ElseIf .Form& = 3

                Ogl("Tube", .5, .5, .5, .Seg&)

            ElseIf .Form& = 4

                Ogl("Disk", .5 / 2, .5, .Seg&)

            EndIf

        EndWith

    EndWhile

    Ogl("Show")

ENDPROC

ZeichneDoetze Doetze#[], DotzAnzahl&
SetTimer 30

WhileNot @Iskey(27)

    WhileLoop 0, DotzAnzahl& - 1

        With Doetze#[&loop]

            .X! = .X! + .VX!
            .Y! = .Y! + .VY!
            .Z! = .Z! + .VZ!
            .RotoX! = .RotoX! + .VRotoX!

            If .RotoX! < 360

                .RotoX! = .RotoX! + 360

            EndIf

            If .RotoX! > 360

                .RotoX! = .RotoX! - 360

            EndIf

            .RotoY! = .RotoY! + .VRotoY!

            If .RotoY! < 360

                .RotoY! = .RotoY! + 360

            EndIf

            If .RotoY! > 360

                .RotoY! = .RotoY! - 360

            EndIf

            Ifnot @Between(.X!, -8, 8)

                .VX! = -.VX!

            EndIf

            Ifnot @Between(.Y!, -8, 8)

                .VY! = -.VY!

            EndIf

            Ifnot @Between(.Z!, -8, 8)

                .VZ! = -.VZ!

            EndIf

        EndWith

    EndWhile

    ZeichneDoetze Doetze#[], DotzAnzahl&
    WaitInput

EndWhile

KillTimer
Ogl("Done")
Dispose Doetze#[]
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/09/21  
 



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

493 Views

Untitledvor 0 min.
H.Brill10/29/23
Tango08/06/21
Ernst07/21/21
Sven Bader07/11/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (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