• Welcome to Theos PowerBasic Museum 2017.

MagicBall (OpenGL layered animation)

Started by Patrice Terrier, October 16, 2008, 09:26:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

Move the ball to the screen location you want, preferably over a dark background but it looks good also on a lighter one.

Try changing this to see the result:

FUNCTION GLsphere() AS LONG
    LOCAL K, Done, ListSphere AS LONG, sBuf AS STRING
    LOCAL s1, s2, s3, edge AS SINGLE

    '// Load the sphere mesh
    ListSphere = glGenLists(1)
    CALL glNewlist(ListSphere, %GL_COMPILE)
    DO WHILE Done = 0
       INCR K
       sBuf = LTRIM$(Bufin("Encounter.bbm", Done))
       IF ASC(LTRIM$(sBuf)) = 39 THEN sBuf = "" ' "'"
       IF LEN(sBuf) THEN

          IF (K mod
8) = 0 THEN ' <--- Change to either 8, 11, 13, 15, 21
             s1 = VAL(PARSE$(sBuf, 1))
             s2 = VAL(PARSE$(sBuf, 2))
             s3 = VAL(PARSE$(sBuf, 3))
             CALL glVertex3f(s1, s2, s3)

             CALL glPushMatrix()
                edge = 0.15
                CALL glBegin(%GL_QUADS)
                   CALL glTexCoord2f(0.0, 0.0): CALL glVertex3f(-edge + s1,-edge + s2, s3)
                   CALL glTexCoord2f(1.0, 0.0): CALL glVertex3f( edge + s1,-edge + s2, s3)
                   CALL glTexCoord2f(1.0, 1.0): CALL glVertex3f( edge + s1, edge + s2, s3)
                   CALL glTexCoord2f(0.0, 1.0): CALL glVertex3f(-edge + s1, edge + s2, s3)
                CALL glEnd()
             CALL glPopMatrix()

          END IF

       END IF
    LOOP

    CALL glEndList()
    FUNCTION = ListSphere
END FUNCTION


...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

Jürgen

The way you coded your Macig2.zip demo would cause major issue when running on VISTA with the UAC mode enabled.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com