View Full Version : GUI with menus or better OpenGL ?
Lionheart008
12-09-2008, 13:40
Dear thinBasic and thinAir friends :-)
=> I have a question or basically structure problem to build a thinBasic "window gui" with menus (e.g.: SampleScript/UI/Menu) , a simple script with two, three function and will include a quad view (seperately include four views)... below the menu line...
-> better to use the new "TBGL Entity Skeleton" or build a windows gui with including Open GL structures... ???
This simple question is important for me, then I can start working in the right direction, you know what I mean? ;)
Perhaps somebody can help with open discussions or critics... you are welcome ! :-)
I have add a picture of "Silo", I like this clear GUI, it's good and simple structured !
This is only an example what direction I would like to go...
- The planed 'open source project' has a name "Inka 3D" and I believe everybody who's working with thinBasic will get some profit of knowledge of/with it ::)
- creating some primitives, apply color to them, build or modify new shapes...
I am curious what happens in the next weeks belong to this theme :-)
best regards, have a nice week-end begin, Lionheart
ps: "thinAir" gui I like it too :-)))
Michael Clease
12-09-2008, 14:51
Here is an example with a menu.
as for the other menus i would either build them as textures at runtime and just get mouse position for hit detection or use paint, psp, photoshop whatever you use and draw a textured quad.
Lionheart008
12-09-2008, 16:56
Short reply before short holidays...
Hi dear Abraxas ! :D
- Very Good ! ::) so I can push my example forward ;)
Yes, a similar example I have built some days before, I wanted to get in this direction.. but at that time the new thinBasic version was not released ;-) the new version has some examples I must check, then I will decide me.
I will try this way to take an "TBGL Entity" to build menus and primitives I have in mind.
qt: what does you mean (textures at runtime...):
other menus i would either build them as textures at runtime and just get mouse position for hit detection
- Do you think of textured icons? ???
But doesn't matter... that's two or three numbers/dimension too high for me at the moment ;-) one step after another... I build some menus and then dive after examples or
risc some experiments with it...
Good advices are welcome :-) if you like to improve the script, do it ! :-) best thanks...
best wishes to you, good weekend, finished for today. Lionheart ;D
ps: two picture added with this simple gui and a button row, perhaps a tab function would be better... for more buttons and/or so I can switch between the popup windows..
ErosOlmi
12-09-2008, 18:02
Maybe the attached example made by Petr some time ago can help.
Lionheart008
12-09-2008, 20:17
Hi eros, puh! ;D
Maybe the attached example made by Petr some time ago can help.
Right! :) Hard stuff the "editor" from petr ;-) but I like it... may be I can use something of the function, but it's higher level :o and therefore I must go through the wall with my head, must laugh ::)
thanks for the very interesting example, it will 'motivate' me, I will show to it closer when I am back from short-holidays...
good evening, lionheart
Petr Schreiber
13-09-2008, 13:08
Hi LionHeart,
I am for few days in mountains and you have made another big step forward!
Thanks to all who helped as well!
One thing - the editor Eros attached was concept for my bachelors work, this is reason why it is in Czech language :).
I will try to extract the most important and apply it directly to LionHearts editor.
Petr
Petr Schreiber
13-09-2008, 14:47
Hi LionHeart,
very nice code, I just modified it so you have cursor, grid and 4 view there.
Petr
Lionheart008
15-09-2008, 15:17
hi petr, hi dear all others :-)
thank you very mucho for the big example, I have had a short look at it, very, very interesting stuff, I am thinking to use it for my open source project ('inka 3d'), will build it up and go further development with it... such things I have had in mind some weeks ago, when I have started here in the forum, applause!, great work! :-) !
see you soon, I must have a warm coffee first of all, so I can work here in my cold flat...
lionheart
Lionheart008
16-09-2008, 14:23
dear thinBasic and open gl friends... :)
...a little more with this example to build an tbgl menu example with quad view...
=>! question about 'mouse function to regulate light-intensity' of objects (torus, sphere, box)... - this example does run very well... ::)
'------- mouse function
' -- Mouse input
if TBGL_MouseGetLButton then
LightIntensity += 1
if LightIntensity > 255 then LightIntensity = 255
elseif TBGL_MouseGetRButton then
LightIntensity -= 1
if LightIntensity < 0 then LightIntensity = 0
end if
TBGL_GetWindowClient( hWnd, x, y )
LightX = (TBGL_MouseGetPosX-x/2)/60
LightY = (y/2-TBGL_MouseGetPosY)/60
' I want to use lighting ! ...
tbgl_UseLighting %TRUE
'----------- mouse function ends
to regulate the lightintensity of objects, I have included this second mouse input, but I think it's "NONSENS!" or deplaced here... ;-)
perhaps somebody can help, how I can regulate the light intensity of 'all objects' here in the scene???
ciao und servus, more will come later or tomorrow...
best wishes and greetings, lionheart008
Michael Hartlef
16-09-2008, 14:46
Yes, your mouse code was a little bit out of place. But very close to want you wanted it to do. At least if I understood you correctly. I placed your mouse code inside a sub, extened it with a light changing command and called the sub inside one of the render functions.
SUB SetLight( )
' -- Mouse input
IF TBGL_MOUSEGETLBUTTON THEN
LightIntensity += 1
IF LightIntensity > 255 THEN LightIntensity = 255
ELSEIF TBGL_MOUSEGETRBUTTON THEN
LightIntensity -= 1
IF LightIntensity < 0 THEN LightIntensity = 0
END IF
TBGL_GETWINDOWCLIENT( hWnd, x, y )
LightX = ( TBGL_MOUSEGETPOSX - x / 2 ) / 60
LightY = ( y / 2 - TBGL_MOUSEGETPOSY ) / 60
' I want to use lighting ! ...
TBGL_USELIGHTING %TRUE
' Here you set the light parameters =========>>>
TBGL_SETLIGHTPARAMETER %GL_LIGHT0, %TBGL_LIGHT_AMBIENT, lightIntensity / 255, lightIntensity / 255, lightIntensity / 255, 1
'<==============================================
END SUB
FUNCTION RenderMyImage( hCtrl AS DWORD )
STATIC FrameRate AS DOUBLE
STATIC i AS LONG
TBGL_BACKCOLOR 0, 128, 160
IF TBGL_CANVASBOUND( hCtrl ) THEN
FrameRate = TBGL_GETFRAMERATE
' -- Some useful information for cursor handling
TBGL_GETWINDOWCLIENT hCtrl, ClientDim.x, ClientDim.y
Mouse.x = TBGL_MOUSEGETPOSX
Mouse.y = TBGL_MOUSEGETPOSY
TBGL_RENDERMATRIX3D
TBGL_CLEARFRAME
' Call the new routine ===============>
SetLight( )
'<=====================================
Petr Schreiber
16-09-2008, 14:49
I was just posting this,
good advice Mike!
I did basically the same, just setting diffuse value and working with intensity in range 0..1 directly.
Petr
Lionheart008
16-09-2008, 16:04
:D Yoh! Good input friendly guys!
short reply...you both are very welcome in my little thinBasic castle! this is one reason I like and love this forum! ;D
- I will try the examples and think about the mouse regulations... it's nearly new for me ;-) more questions and more experiments about this topics with "light", "mouse" input will surely come...
see us later, lionHeart008, run to the sun :-)
ps: I love "Hägar, the horrible", here a little gift for you :D
Lionheart008
16-09-2008, 17:00
;D works everything fine :-)
I have only adapted the script for me... I am very satisfied :D
a) left mouse = lighting up
b) right mouse = lighting down
Both codes variations does function very well! Great!
Little picture above, I will still expand my gui-menu-example with new functions...
ciao, freezing LionHeart
ps: coffee, tea, cookies, jogging, dog-walking should help... ;D
Petr Schreiber
16-09-2008, 17:12
Thanks for the update,
and for the cartoon as well :)
You could also attach light to cursor position as well, but I guess it would get a bit confusing.
Petr