Scratchpad

It's the Scratchpad!

"People play games for emotional experiences and intellectual challenges." - u9u9

TextMode(TEXT_OVERLAID)

declare sub drawCube(x, y, z)
declare sub drawSquare(x, xOff, y, yOff, z, zOff)

dim ang#

while true
    ang# = 270

    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
    glLoadIdentity()
    glTranslatef(0,0, -10)
    glRotatef(ang#, ang#, ang#, 0)

    drawCube(2,2,0)

    cls
    print ang#

    DrawText()
    SwapBuffers()
wend

sub drawCube(x, y, z)         
    drawSquare(x, 1, y, 1, z - 1, 0)    'back face
    drawSquare(x - 1, 0, y, 1, z, 1)    'left face
    drawSquare(x + 1, 0, y, 1, z, 1)    'right face
    drawSquare(x, 1, y - 1, 0, z, 1)    'top face
    drawSquare(x, 1, y + 1, 0, z, 1)    'bottom face
    drawSquare(x, 1, y, 1, z + 1, 0)    'front face 
end sub

sub drawSquare(x, xOff, y, yOff, z, zOff)
    glBegin(GL_QUADS)
        glVertex3f(x - xOff, y - yOff, z - zOff)
        glVertex3f(x + xOff, y - yOff, z + zOff)
        glVertex3f(x + xOff, y + yOff, z + zOff)
        glVertex3f(x - xOff, y + yOff, z - zOff)
    glEnd()
end sub

Strange

TextMode(TEXT_OVERLAID)

declare sub drawCube(x, y, z)
declare sub drawSquare(x, xOff, y, yOff, z, zOff)

dim ang#

ang# = 0
while true
    ang# = ang# + 1
    if ang# = 360 then ang# = 0 endif
    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
    glLoadIdentity()
    glTranslatef(0,0, -10)
    glRotatef(ang#, 0, 0, 0)

    drawCube(2,2,0)

    cls
    print ang#

    DrawText()
    SwapBuffers()
    Sleep(1)
wend

sub drawCube(x, y, z)         
    drawSquare(x, 1, y, 1, z - 1, 0)    'back face
    drawSquare(x - 1, 0, y, 1, z, 1)    'left face
    drawSquare(x + 1, 0, y, 1, z, 1)    'right face
    drawSquare(x, 1, y - 1, 0, z, 1)    'top face
    drawSquare(x, 1, y + 1, 0, z, 1)    'bottom face
    drawSquare(x, 1, y, 1, z + 1, 0)    'front face 
end sub

sub drawSquare(x, xOff, y, yOff, z, zOff)
    glBegin(GL_QUADS)
        glVertex3f(x - xOff, y - yOff, z - zOff)
        glVertex3f(x + xOff, y - yOff, z + zOff)
        glVertex3f(x + xOff, y + yOff, z + zOff)
        glVertex3f(x - xOff, y + yOff, z - zOff)
    glEnd()
end sub
page_revision: 6, last_edited: 1257153972|%e %b %Y, %H:%M %Z (%O ago)