Powerbasic Museum 2020-B

IT-Consultant: Patrice Terrier => WinLIFT => Topic started by: Patrice Terrier on December 10, 2010, 06:21:07 PM

Title: OpenGL "Asleep"
Post by: Patrice Terrier on December 10, 2010, 06:21:07 PM
Asleep

The native OpenGL source code of this project, shows you what to do, to create a demoscene mixing 3D and audio altogether.



Note: Turn your loudspeakers on, before to run "Asleep".


Screen shot:

(http://www.zapsolution.com/pictures/Asleep.png)


Culling technic based on z-order sorting:

SUB Quad_Draw(BYVAL Pulse AS LONG)

    LOCAL K AS LONG, x, y, z, sSize, sPulseSize AS SINGLE

'   // The culling section.
    DIM A1(g_nAttracters - 1) AS SINGLE, A2(g_nAttracters - 1) AS LONG
    FOR K = 0 TO g_nAttracters - 1
        A1(K) = alist(K).X * billboardMat(2) + alist(K).Y * billboardMat(6) + alist(K).Z * billboardMat(10)
        A2(K) = K
    NEXT
'   // Sort bazed on the Z-order location.
    ARRAY SORT A1(), TAGARRAY A2()

    FOR K = 0 TO g_nAttracters - 1

        glPushMatrix()
           x = alist(A2(K)).X * billboardMat(0) + alist(A2(K)).Y * billboardMat(4) + alist(A2(K)).Z * billboardMat( 8 )
           y = alist(A2(K)).X * billboardMat(1) + alist(A2(K)).Y * billboardMat(5) + alist(A2(K)).Z * billboardMat( 9 )
           z = A1(K)
           glTranslatef(x, y, z)

           CALL glColor4f(0.95, 0.95, 0.95, 0.5)
           sSize = 200

           IF K = g_nAttracters -1 THEN
              IF (A2(K)+1) <> 6 THEN
                 sPulseSize = sSize + (Pulse * 5)
              ELSE
                 sPulseSize = sSize
              END IF
              DrawQuad(sPulseSize, sPulseSize, 0, mt(A2(K)+1).Texture)
              DrawQuad(sSize, sSize, 0, mt(7).Texture)
           ELSE
              IF (A2(K)+1) <> 6 THEN
                 sPulseSize = sSize + (Pulse * 5)
              ELSE
                 sPulseSize = sSize
              END IF
              DrawQuad(sPulseSize, sPulseSize, 0, mt(A2(K)+1).Texture)

           END IF
        glPopMatrix()
    NEXT

END SUB


...
Title: Re: OpenGL "Asleep"
Post by: Patrice Terrier on August 09, 2011, 03:22:18 PM
The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...