matthew
16-03-2007, 00:57
NeHe Lesson 02 will Display a White Triangle and Square.
' NeHe Lesson 02
uses "UI" ' MessageBox Functions
uses "TBGL" ' thinBASIC OpenGL Library
' Create MessageBox
dim fullScreen as long
fullScreen = msgbox(0, "Would you like to Run in Fullscreen Mode?", %MB_YESNO or %MB_ICONINFORMATION, "Start FullScreen?")
select case fullScreen
' Create FullScreen Display, Return Handle.
case %IDYES
dim hWnd as dword
hWnd = tbgl_createwindowex("", 1024, 768, 32, 1)
' Create Windowed Display, Return Handle.
case %IDNO
dim hWnd as dword
hWnd = tbgl_createwindowex("NeHe Lesson 02 - Press 'Esc' to Quit", 640, 480, 16, 0)
end select
tbgl_showwindow ' Show Display
TBGL_GetAsyncKeyState(-1) ' Reset all Keys
' Start Main Loop
while tbgl_iswindow(hWnd)
tbgl_clearframe ' Clear Display
tbgl_camera 0,0,1,0,0,0 ' Default Camera, View From 0,0,1 To 0,0,0.
tbgl_translate -1.5, 0.0, -6.0 ' Move Left 1.5 Units, Into Screen 6 Units.
tbgl_beginpoly %GL_TRIANGLES ' Drawing Using Triangles
TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Vertex -1.0, -1.0, 0.0
TBGL_Vertex 1.0, -1.0, 0.0
TBGL_EndPoly
TBGL_Translate 3.0, 0.0, 0.0 ' Move Right 3 Units
TBGL_BeginPoly %GL_QUADS ' Drawing using Quads
TBGL_Vertex -1.0, 1.0, 0.0
TBGL_Vertex 1.0, 1.0, 0.0
TBGL_Vertex 1.0, -1.0, 0.0
TBGL_Vertex -1.0, -1.0, 0.0
TBGL_EndPoly
tbgl_drawframe ' Display anything
if tbgl_getasynckeystate(%VK_ESCAPE) then exit while
wend
tbgl_destroywindow ' Closes Display
Update
This Lesson was updated on 29th June 2007 when you Run the Application it will now ask you whether you want to use a FullScreen or Windowed Display.
' NeHe Lesson 02
uses "UI" ' MessageBox Functions
uses "TBGL" ' thinBASIC OpenGL Library
' Create MessageBox
dim fullScreen as long
fullScreen = msgbox(0, "Would you like to Run in Fullscreen Mode?", %MB_YESNO or %MB_ICONINFORMATION, "Start FullScreen?")
select case fullScreen
' Create FullScreen Display, Return Handle.
case %IDYES
dim hWnd as dword
hWnd = tbgl_createwindowex("", 1024, 768, 32, 1)
' Create Windowed Display, Return Handle.
case %IDNO
dim hWnd as dword
hWnd = tbgl_createwindowex("NeHe Lesson 02 - Press 'Esc' to Quit", 640, 480, 16, 0)
end select
tbgl_showwindow ' Show Display
TBGL_GetAsyncKeyState(-1) ' Reset all Keys
' Start Main Loop
while tbgl_iswindow(hWnd)
tbgl_clearframe ' Clear Display
tbgl_camera 0,0,1,0,0,0 ' Default Camera, View From 0,0,1 To 0,0,0.
tbgl_translate -1.5, 0.0, -6.0 ' Move Left 1.5 Units, Into Screen 6 Units.
tbgl_beginpoly %GL_TRIANGLES ' Drawing Using Triangles
TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Vertex -1.0, -1.0, 0.0
TBGL_Vertex 1.0, -1.0, 0.0
TBGL_EndPoly
TBGL_Translate 3.0, 0.0, 0.0 ' Move Right 3 Units
TBGL_BeginPoly %GL_QUADS ' Drawing using Quads
TBGL_Vertex -1.0, 1.0, 0.0
TBGL_Vertex 1.0, 1.0, 0.0
TBGL_Vertex 1.0, -1.0, 0.0
TBGL_Vertex -1.0, -1.0, 0.0
TBGL_EndPoly
tbgl_drawframe ' Display anything
if tbgl_getasynckeystate(%VK_ESCAPE) then exit while
wend
tbgl_destroywindow ' Closes Display
Update
This Lesson was updated on 29th June 2007 when you Run the Application it will now ask you whether you want to use a FullScreen or Windowed Display.