dcromley
17-02-2016, 20:55
(maybe I should have 3 separate posts?)
These are minor things -- maybe just my misunderstanding.
1) Placing the window in the screen Using TBGL_CreateWindowEx doesn't seem to work.
Using the MoveWindow API does work.
2) When using TBGL_RenderMatrix2D,
TBGL_Line uses the coordinates in the TBGL_RenderMatrix2D statement.
TBGL_PrintFont doesn't. Does it use screen coordinates?
3) Are parentheses ever necessary or prohibited? Recommended or not?
e.g. TBGL_UseLighting(%TRUE) or TBGL_UseLighting %TRUE
The script below is commented, showing the issues
Thanks for TB/TBGL!
Uses "TBGL"
Sub TBMain()
Dim hWnd, hFont As DWord, Framerate As Long
String s1 = "ESC to quit"
'-- I want the window to be upper-left in the screen - doesn't work.
hWnd = TBGL_CreateWindowEx(s1, 600, 600, 32,
%TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX, 0, 0)
hFont = TBGL_FontHandle("Courier New", 9)
TBGL_BuildFont(hFont)
TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_POSITION, 100, 100, 0, 1)
TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_DIFFUSE, 1, .5, .5, 1)
TBGL_UseLightSource(%GL_LIGHT0, %TRUE)
TBGL_UseVSync(1)
TBGL_ShowWindow
While TBGL_IsWindow(hWnd)
Framerate = TBGL_GetFrameRate
TBGL_ClearFrame
'-- A Viewport
TBGL_Viewport( 40, 30, 400, 200, %TBGL_PARAM_PIXELS )
'-- I want to print stuff in 2D mode
'-- in the bottom-left corner of the viewport.
TBGL_RenderMatrix2D(0, 0, 400, 200) ' viewport coordinates
TBGL_UseLighting(%FALSE) ' for printing
TBGL_Line(10,10,390,190) ' the 2D line gets inside the viewport (good)
TBGL_PrintFont("Framerate=" & Framerate, 0, 0) ' but the print is outside
TBGL_PrintFont2D("X=100 Y=0", 100, 0)
'-- Printing in 3D mode works as expected.
TBGL_RenderMatrix3D(%TBGL_CUSTOM, 400/200)
TBGL_Camera(0, 0, 5, 0, 0, 0)
TBGL_UseLighting(%TRUE)
TBGL_Rect(-100, -100, -1, 100, 100, -1) ' the whole viewport
TBGL_Sphere(1)
TBGL_UseLighting(%FALSE) ' for printing
TBGL_PrintFont("X=0 Y=0 Z=2", 0, 0, 2) ' print in 3D -
TBGL_DrawFrame
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
End Sub
These are minor things -- maybe just my misunderstanding.
1) Placing the window in the screen Using TBGL_CreateWindowEx doesn't seem to work.
Using the MoveWindow API does work.
2) When using TBGL_RenderMatrix2D,
TBGL_Line uses the coordinates in the TBGL_RenderMatrix2D statement.
TBGL_PrintFont doesn't. Does it use screen coordinates?
3) Are parentheses ever necessary or prohibited? Recommended or not?
e.g. TBGL_UseLighting(%TRUE) or TBGL_UseLighting %TRUE
The script below is commented, showing the issues
Thanks for TB/TBGL!
Uses "TBGL"
Sub TBMain()
Dim hWnd, hFont As DWord, Framerate As Long
String s1 = "ESC to quit"
'-- I want the window to be upper-left in the screen - doesn't work.
hWnd = TBGL_CreateWindowEx(s1, 600, 600, 32,
%TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX, 0, 0)
hFont = TBGL_FontHandle("Courier New", 9)
TBGL_BuildFont(hFont)
TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_POSITION, 100, 100, 0, 1)
TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_DIFFUSE, 1, .5, .5, 1)
TBGL_UseLightSource(%GL_LIGHT0, %TRUE)
TBGL_UseVSync(1)
TBGL_ShowWindow
While TBGL_IsWindow(hWnd)
Framerate = TBGL_GetFrameRate
TBGL_ClearFrame
'-- A Viewport
TBGL_Viewport( 40, 30, 400, 200, %TBGL_PARAM_PIXELS )
'-- I want to print stuff in 2D mode
'-- in the bottom-left corner of the viewport.
TBGL_RenderMatrix2D(0, 0, 400, 200) ' viewport coordinates
TBGL_UseLighting(%FALSE) ' for printing
TBGL_Line(10,10,390,190) ' the 2D line gets inside the viewport (good)
TBGL_PrintFont("Framerate=" & Framerate, 0, 0) ' but the print is outside
TBGL_PrintFont2D("X=100 Y=0", 100, 0)
'-- Printing in 3D mode works as expected.
TBGL_RenderMatrix3D(%TBGL_CUSTOM, 400/200)
TBGL_Camera(0, 0, 5, 0, 0, 0)
TBGL_UseLighting(%TRUE)
TBGL_Rect(-100, -100, -1, 100, 100, -1) ' the whole viewport
TBGL_Sphere(1)
TBGL_UseLighting(%FALSE) ' for printing
TBGL_PrintFont("X=0 Y=0 Z=2", 0, 0, 2) ' print in 3D -
TBGL_DrawFrame
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
End Sub