PDA

View Full Version : Fraxter3D Demo: Mandelbox Navigator



mike lobanovsky
16-12-2013, 07:54
Hello community,

I'd like to submit this TBGL+GLSL project as my contribution to thinBasic's code base. It isn't particularly Christmas-looking but I'm absolutely sure many of you will have quite a few pleasant moments flying through this beautiful oasis of stunning shapes and amazing colors.

Despite its limited features, Fraxter3D Demo runs perfectly well for me and I hope it will run OK on your platforms too:

http://www.fbsl.net/phpbb2/download/file.php?id=1819



This demo's big brother Fraxter3D Full can be found on the FBSL forum (http://www.fbsl.net/phpbb2/viewtopic.php?p=10414#p10414). It comes in a zip with full sources, compiled executable, and a bunch of loadable shaders for everyone to enjoy:

http://www.fbsl.net/phpbb2/download/file.php?id=1816



Merry Christmas and a happy New Year, friends! http://www.fbsl.net/phpbb2/images/smilies/icon_ml_noel.gif

Petr Schreiber
17-12-2013, 11:37
Holy monkey,

this might the most impressive demo here up to date!


Petr

sblank
27-12-2013, 06:58
I agree with Petr... really, really nice demo!

Stan


Holy monkey,

this might the most impressive demo here up to date!


Petr

mike lobanovsky
27-12-2013, 07:21
Thanks gentlemen,

It was my pleasure to share it with the thinBasic community. Do not hesitate to load the FBSL version too even if it's written in another language. The syntax isn't much different so that somebody may eventually go as far as extending the demo to a complete port. I don't have time enough to do it myself unfortunately though I'm planning to go on working on this project some time in the future if my time schedule permits.

http://www.fbsl.net/phpbb2/images/smilies/icon_ml_noel.gif

ErosOlmi
30-12-2013, 10:13
Dear Mike,

thanks so much for this astonishing script. It goes so far from my imagination of possible scripts made with thinBasic.
It is so fascinating to navigate inside/in/out/up/down such beautiful math structures ... wow

I have one question: when I use arrow keys to move inside the 3D world I get a "beep" at every key pressing.
I didn't see any "beep" command inside the code and I searched all around my thinBasic development source code to see if I left some "beep" somewhere but I didn't find any.
Maybe for some reasons it can come from the graphic card ?

Ciao and thanks again
Eros

Petr Schreiber
30-12-2013, 11:32
Hi Eros!,

I think the beeping is related purely to windows GUI, try to run the script below and press A,D... you will get beep. Try to press W, S - no beep.


Uses "UI"

' -- ID numbers of controls
Begin ControlID
%cCanvas
%bClose
End ControlID

Begin Const
%MAIN_WIDTH = 320
%MAIN_HEIGHT = 240
End Const

' -- Create dialog here
Function TBMain()
Local hDlg As DWord

Dialog New Pixels, 0, "Beep",-1,-1, %MAIN_WIDTH, %MAIN_HEIGHT, _
%WS_POPUP Or %WS_VISIBLE Or %WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX To hDlg

' -- Place controls here
Control Add Button, hDlg, %bClose, "Click to clo&se", %MAIN_WIDTH-105, %MAIN_HEIGHT-30, 100, 25
Control Add Button, hDlg, %bClose+1, "&Wow", 10, %MAIN_HEIGHT-30, 100, 25

Dialog Show Modal hDlg, Call cbDialog

End Function

' -- Callback for dialog
CallBack Function cbDialog()



' -- Test for messages
Select Case CBMSG

Case %WM_INITDIALOG
' -- Put code to be executed after dialog creation here

Case %WM_COMMAND
' -- You can handle controls here

Select Case CBCTL

Case %bClose
If CBCTLMSG = %BN_CLICKED Then
Dialog End CBHNDL
End If

End Select


Case %WM_CLOSE
' -- Put code to be executed before dialog end here

End Select

End Function


I think Windows tries to tell the user there is not control which has &<letter> associated. Because I put &W and &s in the buttons, these keys don't beep, other letters will do.


Petr

mike lobanovsky
30-12-2013, 20:03
Dear Eros,


Thanks a lot for your warm words of appreciation! There are very many beautiful visuals in thinBasic already so my submission will only make its existing code base just a little richer. http://www.fbsl.net/phpbb2/images/smilies/icon_smile.gif

Yes, now that I've turned my audio gear on, I do hear these ugly beeps you mention which I've overlooked before as I usually prefer to concentrate on my work in complete silence. IMO they appear because TB's forms are Dialogs. FBSL forms are just raw windows. Dialogs have prebuilt keyboard response logic while raw windows haven't.

From this standpoint, Petr is correct in his findings. Since there isn't any control on Fraxter3D Demo's main dialog that's responsive to WASD key presses explicitly, the OS reports back with a system beep. Perhaps it might've been suppressed by putting some invisible dummy control on the main dialog that the WASD presses would sink in silently.

I'm sorry for not noticing the bug in time. If somebody else of the peers has the nerve to experiment with my code some more in order to fix it, I would only be glad and thankful but I don't have enough time personally for that at the moment.


Have a Happy New Year, Eros, and good luck with your wonderful project!

http://www.fbsl.net/phpbb2/images/smilies/icon_ml_noel.gif

largo_winch
15-01-2014, 12:25
a) the fraxter demo doesn't work here on my machine (win xp amd notebook), there's an error with "glcreateshader()", see screenshot. perhaps a fil is missing or updated tbgl version? I've downloaded last thinbasic 1.9.11.0.

b) it's not very easy to find a link to last thinbasic version at this entry thinbasic website.

bye, maurice

Petr Schreiber
15-01-2014, 13:30
There is no checking for GLSL support in the example, it could be easily added by testing the handle value in GLSLInit function.

I personally prefer CG over GLSL - it has a bit better support on older cards, especially Intel based ones, which is your case, I presume.


Petr

P.S. Mike, I discovered your note about my wrong declaration of uniform. Post a bug report or send me PM next time please, I found it by accident and could easily miss it.
I just sent corrected version to Eros, fix will be present in next release.

mike lobanovsky
15-01-2014, 15:38
@Maurice

It is my fault as I overlooked to notify the TB audience like I usually do on the FBSL forum that this is a GLSL script and it needs GLSL support and a very good video card to run satisfactorily. I also regret to say that unfortunate owners of on-board SiS video chips will probably be never able to run GLSL-based scripts on their laptops at all.

@Petr

I wasn't stressing this nuisance because it was easy to bypass. The solution didn't add noticeable overhead and the inaccurate declaration was just a nuisance rather than outstanding bug.

OTOH there is also a glitch in TBGL proper that IMHO may be regarded as an ineffective implementation of the library's key function. I'm talking about the TBGL_ShowCursor() toggle which is criticized in the main project file, Fraxter3Demo.tbasic.

Matter is, MS Windows' ShowCursor() API maintains an internal count of cursor toggles whereby the cursor may be shown or hidden only if the current number of off's is equal to the current number of on's for the entire lifetime of an application. The API is a black box except for its return value (difference between on's and off's) and cursor visibility cannot be queried directly either.

The only way to guarantee programmatically 100% that the cursor will be switched on or off at a given point in time is to implement the toggle as follows:


Sub CursorOn()
While ShowCursor(%TRUE) < 0: Wend
End Sub

Sub CursorOff()
While ShowCursor(%FALSE) >= 0: Wend
End Sub

TBGL's cursor toggle doesn't seem to be aware of that and behaves as if it would always rely on a single call to ShowCursor(%TRUE) to pop the cursor, and on a single call to ShowCursor(%FALSE), to hide it. This is of course not correct in a general sense. If this is how the cursor toggle is actually implemented in TBGL then it is a design fault that will be causing program malfunction and therefore should be fixed as soon as possible.

Regards,

Petr Schreiber
15-01-2014, 16:12
Hi Mike,

even the smallest problems matter, better to report them more directly to avoid problems of other users.

Your TBGL_ShowCursor observation is correct, thanks for pointing it out. For further TBGL bugs/requests, please use dedicated section in support (http://www.thinbasic.com/community/project.php?projectid=3).

I already fixed and documented it, so if you need to have it right now... you can:
The latest TBGL version (http://www.thinbasic.com/community/showthread.php?t=10909&p=81635#post81635)

Fix will be present in ThinBasic 1.9.12.0.


Good catch!,
Petr

mike lobanovsky
16-01-2014, 12:37
Petr,

Thanks for the "bleeding edge" updates made in less than overnight. :) Sure I'll be following your advice in case I find any more issues while coding.

Regards,