PDA

View Full Version : Colour Cube



peter
05-12-2013, 18:46
Hello,

Updated a.dll & a.inc

Here's a color cube with mouse movement.


#INCLUDE "a.inc"
#INCLUDE "swgl.inc"


DWord hwnd= OpenWindow 640,480,1
InitGL hwnd


Single xmag, ymag
glClearColor 0.3, 0.3, 0.3, 1.0


While KeyDown(27)=0
glClear %oGL_COLOR_BUFFER_BIT | %oGL_DEPTH_BUFFER_BIT
glLoadIdentity


xmag = xMouse
ymag = yMouse


glRotatef ymag, 1.0, 0.0, 0.0
glRotatef xmag, 0.0, 1.0, 0.0


glBegin %oGL_QUADS
glColor3f(0.0, 1.0, 1.0): glVertex3f(-.3, .3, .3)
glColor3f(0.1, 1.0, 1.0): glVertex3f( .3, .3, .3)
glColor3f(0.1, 0.0, 1.0): glVertex3f( .3, -.3, .3)
glColor3f(0.0, 0.0, 1.0): glVertex3f(-.3, -.3, .3)


glColor3f(1.0, 1.0, 1.0): glVertex3f( .3, .3, .3)
glColor3f(1.0, 1.0, 0.0): glVertex3f( .3, .3, -.3)
glColor3f(1.0, 0.0, 0.0): glVertex3f( .3, -.3, -.3)
glColor3f(1.0, 0.0, 1.0): glVertex3f( .3, -.3, .3)


glColor3f(1.0, 1.0, 0.0): glVertex3f( .3, .3, -.3)
glColor3f(0.0, 1.0, 0.0): glVertex3f(-.3, .3, -.3)
glColor3f(0.0, 0.0, 0.0): glVertex3f(-.3, -.3, -.3)
glColor3f(1.0, 0.0, 0.0): glVertex3f( .3, -.3, -.3)


glColor3f(0.0, 1.0, 0.0): glVertex3f(-.3, .3, -.3)
glColor3f(0.0, 1.0, 1.0): glVertex3f(-.3, .3, .3)
glColor3f(0.0, 0.0, 1.0): glVertex3f(-.3, -.3, .3)
glColor3f(0.0, 0.0, 0.0): glVertex3f(-.3, -.3, -.3)


glColor3f(0.0, 1.0, 0.0): glVertex3f(-.3, .3, -.3)
glColor3f(1.0, 1.0, 0.0): glVertex3f( .3, .3, -.3)
glColor3f(1.0, 1.0, 1.0): glVertex3f( .3, .3, .3)
glColor3f(0.0, 1.0, 1.0): glVertex3f(-.3, .3, .3)


glColor3f(0.0, 0.0, 0.0): glVertex3f(-.3, -.3, -.3)
glColor3f(1.0, 0.0, 0.0): glVertex3f( .3, -.3, -.3)
glColor3f(1.0, 0.0, 1.0): glVertex3f( .3, -.3, .3)
glColor3f(0.0, 0.0, 1.0): glVertex3f(-.3, -.3, .3)
glEnd


Events
SwapBuffer
SetFps 60
Wend


QuitGL
CloseWindow