I will check during the weekend whether I can work around this limitation.
Petr
More than one TBGL-display quite easy to achieve - but needs UI-Canvas.
Example shows how two different "scenes" can be displayed in two different canvas-controls at same time.
Not using scene/entity-system here but is doable rendering different scenes to different output also.
Even works in seperate dialogs.
If displaying same scene from different points of view then camera-entity has to be placed according to the current view.
Edit: limitation removedUses "UI", "TBGL" ' -- ID numbers of controls Begin ControlID %lCanvas1 %lCanvas2 %bClose %myTimer End ControlID Begin Const %MAIN_WIDTH = 640 %MAIN_HEIGHT = 480 %timeOut = 20 ' -- Determines graphics refresh rate in milliseconds End Const Function TBMain() Local hDlg As DWord Dialog New Pixels, 0, "Dialog with TBGL",-1,-1, %MAIN_WIDTH, %MAIN_HEIGHT, _ %WS_POPUP Or %WS_VISIBLE Or _ %WS_CLIPCHILDREN Or %WS_CAPTION Or _ %WS_SYSMENU Or %WS_MINIMIZEBOX Or %WS_MAXIMIZEBOX, 0 To hDlg ' -- Place controls: Control Add Label, hDlg, %lCanvas1, "", 5, 5, %MAIN_WIDTH/2-10, %MAIN_HEIGHT-40 Control Set Color hDlg, %lCanvas1, %BLACK, %BLACK Control Add Label, hDlg, %lCanvas2, "", %Main_Width/2+5, 5, %MAIN_WIDTH/2-10, %MAIN_HEIGHT-40 Control Set Color hDlg, %lCanvas2, %BLACK, %BLACK Control Add Button, hDlg, %bClose, "Close", 5, %MAIN_HEIGHT-30, %MAIN_WIDTH - 10, 25 Dialog Show Modal hDlg, Call dlgCallback End Function CallBack Function dlgCallback() Static hCtrl As DWord Select Case CBMSG Case %WM_INITDIALOG ' just init timer Dialog Set Timer CBHNDL, %myTimer, %timeOut, %NULL Case %WM_TIMER Control Handle CBHNDL, %lCanvas1 To hCtrl RenderMyImage(hCtrl, %lCanvas1) Control Handle CBHNDL, %lCanvas2 To hCtrl RenderMyImage(hCtrl, %lCanvas2) Case %WM_CLOSE Control Handle CBHNDL, %lCanvas1 To hCtrl If TBGL_CanvasBound(hCtrl) Then TBGL_ReleaseCanvas(hCtrl) Control Handle CBHNDL, %lCanvas2 To hCtrl If TBGL_CanvasBound(hCtrl) Then TBGL_ReleaseCanvas(hCtrl) Dialog Kill Timer CBHNDL, %myTimer Case %WM_COMMAND Select Case CBCTL Case %bClose If CBCTLMSG = %BN_CLICKED Then Dialog End CBHNDL End Select End Select End Function Sub RenderMyImage( ByVal hCtrl As DWord, ByVal ID_Canvas As Long ) TBGL_BindCanvas(hCtrl) ' no need to update canvas-proprtions... If TBGL_CanvasBound(hCtrl) Then TBGL_UseLighting(%TRUE) TBGL_UseLightSource(%GL_LIGHT0, %TRUE) TBGL_SetLightParameter(%GL_LIGHT0, %TBGL_LIGHT_POSITION, 15, 10, 15, 1) TBGL_ClearFrame TBGL_Camera(5, 5, 5, 0, 0, 0) If ID_Canvas = %lCanvas1 Then ' show "scene 1" TBGL_Box(1, 1, 1) Else ' show "scene 2" TBGL_Sphere(1) EndIf TBGL_DrawFrame EndIf End Sub
Last edited by ReneMiner; 06-09-2013 at 10:26.
I think there are missing some Forum-sections as beta-testing and support
I will check during the weekend whether I can work around this limitation.
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hmm,
I don't see any problem changing LOC and SIZE property, could you please post failing example?
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
I threw it all out and have not saved the "old" version.
Maybe I did it wrong? The effect was the canvases did not correctly resize (used CONTROL SET RESIZE) and without that switch I did not try out. Maybe this switch interfered also when I used CONTROL SET LOC.
That's also the reason why I tried to create multiple TBGL-displays at all: As long as Dialogs & Controls are not Objects with clearly defined Events, Methods and Properties they are way too cumbersome to handle and not applicable for a bigger project so I need to create own "Control-Objects"
I already was that frustrated about UI-handling that I erased all I've written - and more than once - lots of hours thinking and typing just flushed down to neverland.
Especially annoying that I can not use Dialogs nor Control-Properties directly, but always have to send them "TO" some local variable in advance with half a dozen parameters just to get some simple value out there and need always a few lines just for one simple action because the result is not returned directly.
Also these make code so unreadable - I have some idea, start to write and get stuck when it comes to UI - always have to look up and down again - my code then is such chaos that I can not read myself what I wrote and loose overview of situation and used calls so it becomes impossible to continue and I have to stop and start all over.
Last edited by ReneMiner; 05-09-2013 at 18:43.
I think there are missing some Forum-sections as beta-testing and support
Hi Rene,
I think CONTROL SET RESIZE could clash a bit with CONTROL SET LOC/SIZE - it is one or another.
I agree the "TO syntax" is a bit impractical sometimes -that is why Eros added Control_GetHandle, Control_GetWidth, Control_GetHeight, Control_GetText and others... which behave like normal functions.
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks