Code: Select all
Prototype glOrtho(a.d,b.d,c.d,d.d,e.d,f.d) : Prototype gluPerspective(a.d,b.d,c.d,d.d)
Global glOrtho_.glOrtho = 0*OpenLibrary(0, "OpenGL32.dll") + GetFunction(0, "glOrtho"), gluPerspective_.gluPerspective = 0*OpenLibrary(1, "glu32.dll") + GetFunction(1, "gluPerspective"), StartTime.d = GetTickCount_(), pfd.PIXELFORMATDESCRIPTOR\dwFlags = #PFD_DOUBLEBUFFER | #PFD_SUPPORT_OPENGL, hdc = GetDC_ (CreateWindow_("edit", 0, #WS_POPUP|#WS_VISIBLE|#WS_MAXIMIZE,0, 0, 0 , 0, 0, 0, 0, 0) ) : t=SetPixelFormat_ (hdc, ChoosePixelFormat_ ( hdc, pfd) , pfd ) + wglMakeCurrent_ (hdc, wglCreateContext_(hdc) ) + ShowCursor_(#False) + InitSound() + glClearColor_(0.4,0.0,0.6,0.0) + glViewport_(0.0,0.0,GetSystemMetrics_(0),GetSystemMetrics_(1)) + glMatrixMode_($1701) + glLoadIdentity_() + gluPerspective_(45.0,800.0/600.0,1.0,500.0) + glMatrixMode_($1700) + glEnable_($0B44) + glEnable_($0B71) + glDepthMask_(1) + glDisable_($0B44)
Procedure OGLRect(x1.f, y1.f, x2.f, y2.f, r.f, g.f, b.f) : t = glMatrixMode_($1701) + glLoadIdentity_() + glOrtho_(0,1024, 0,768,-2048, 2048) + glMatrixMode_($1700) + glLoadIdentity_() + glColor3f_(r, g, b) + glRectf_(x1, y1, x2, y2) + glMatrixMode_($1701) + glLoadIdentity_() + gluPerspective_(45.0,800.0/600.0,1.0,500.0) + glMatrixMode_($1700)
EndProcedure : Procedure CreateCube( x.d, y.d, z.d)
Protected dRotate.d = (GetTickCount_() - StartTime) / 10, t = glLoadIdentity_() + glTranslatef_(x.d,y.d,z.d) + glRotatef_(dRotate, dRotate,dRotate, 0), *datad.Double = ?dat_cube : For loop = 0 To 1 + (0 * ((loop < 2) And glBegin_(Int(PeekD(*datad)))))
For i = 0 To (Int(PeekD(*datad+8))-1) + 0 * (((Not (Abs(PeekD(*datad+16+32*i)-1) < 0.01)) + (Not (glColor3dv_(*datad+24+32*i)))) And glVertex3dv_(*datad+24+32*i)) : Next
*datad + (16 + Int(PeekD(*datad+8)) * 32) + 0 * (glEnd_()) : Next
EndProcedure : Procedure DrawCube(n.l, *p.Double)
ProcedureReturn (CreateCube(PeekD(*p)+6, PeekD(*p+8)+2.5, -45 + Sin((GetTickCount_()-StartTime)/666)*10 )) + (n > 1 And DrawCube(n-1, *p + 16)) : EndProcedure
Repeat : Until (0 * ((0* (glClear_($00004000 | $00000100) + DrawCube(42, ?dat_cube + $3A0) + OGLRect(0, 0, 1024, 100, 0, 0, 0) + OGLRect(0, 668, 1024, 768, 0, 0, 0) + Sleep_(10) + SwapBuffers_ ( hdc ) )))) Or ((GetAsyncKeyState_(#VK_ESCAPE) And ShowCursor_(#True)) And TerminateProcess_(GetCurrentProcess_(), 0))
dat_cube: ! dq 7.0, 10.0, 1.0, 1.0, 0.0, 0.0, 2.0, -1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 2.0, 1.0, 1.0, -1.0, 2.0, -1.0, 1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, -1.0, -1.0, 1.0, 2.0, -1.0, -1.0, -1.0, 2.0, 1.0, -1.0, -1.0, 2.0, 1.0, -1.0, 1.0, 5.0, 18.0, 1.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 1.0, 2.0, -1.0, -1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 2.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 2.0, 1.0, 1.0, -1.0, 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, -1.0, -1.0, 1.0, 0.6, 0.6, 0.6, 2.0, -1.0, 1.0, -1.0, 1.0, 0.1, 0.1, 0.1, 2.0, -1.0, -1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 2.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 2.0, -1.0, -1.0, 1.0, -22.5, 0.0, -20.5, 2.0,-18.5, 2.0, -16.5, 2.0, -14.5, 0.0, -18.5, -2.0, -16.5, -2.0, -20.5, -4.0, -22.5, -6.0, -20.5, -6.0, -18.5, -6.0, -16.5, -6.0, -14.5, -6.0, -10.5, 2.0, -8.5, 2.0, -6.5, 2.0, -4.5, 2.0, -2.5, 2.0, -10.5 ,0.0, -10.5, -2.0,-8.5, -2.0, -6.5, -2.0, -4.5, -2.0, -2.5, -4.0, -10.5, -6.0, -8.5, -6.0, -6.5, -6.0, -4.5, -6.0, 4.5, 2.0, 6.5, 2.0, 8.5, 2.0, 10.5, 2.0, 2.5, 0.0, 2.5, -2.0, 4.5, -2.0, 6.5, -2.0, 8.5, -2.0, 2.5, -4.0, 10.5, -4.0, 4.5, -6.0, 6.5, -6.0, 8.5, -6.0