View Full Version : nurbsproject: tbgl points movement by mouse
christianssen
12-04-2010, 08:37
hello and good morning :)
hi eros, petr, frank, michaels (2x) and all others.
I am looking for example how to move a tbgl point (found a very good 3d nurbs example at the board for my project) or an idea how to move it by mouse (drag and drop) from point A to point B. anybody has done similar example? I am building a nurbs grid and would like to move the points.
http://community.thinbasic.com/index.php?topic=2385.0
bye, denis
Petr Schreiber
12-04-2010, 09:10
Hi Denis,
you can retrieve approximate 3D coordinate of mouse click using:
DIM x, y, z AS SINGLE
...
TBGL_GetPixelInfo(TBGL_MouseGetPosX, TBGL_MouseGetPosY, %TBGL_PINFO_XYZ, x, y, z)
Now you have 3D position of mouse click in variables x, y, z
Now you will go through list of your control points, and if the position is near, you probably clicked that point.
Then you can interpret further mouse moves with left mouse button down as moving the point, or you can just mark it as active and manipulate it by keys from keyboard.
Petr
christianssen
12-04-2010, 11:11
hi petr, thanks for your info! I will check this afternoon with mouse control.
another question: I added some control add options. but how to make this options "transparent" ? the grey background colour remains. not very good. nothing found in manual help or have looked at wrong place.
I will take ui/tbgl dialog for my project.
edit: can you recommend any good thinbasic example with mixing ui/tbgl style ? your tbgl_motionblur (with a ship flying through canyon) example is useful perhaps?
thanks, bye, denis
Petr Schreiber
12-04-2010, 18:54
Hi Denis,
example of mixing UI and TBGL can be easily generated from TBGL_InDialog_EntitySkeleton.taguit template.
The solution of your color problem is simple, just use this for each control:
CONTROL SET COLOR hDlg, %controlId, -1, -2
This will let the foreground color be default, and background color to be "transparent".
You can find this information under CONTROL SET COLOR help topic.
Petr
christianssen
13-04-2010, 09:19
thanks petr for control set color info. I will use for my project the "InDialog_EntitySkeleton" (what a name!) example. my idea is beginning here, last week-end, but without entity, but it doesn't matter, I can modify this one for better tbgl features with entities. tbgl has become a very good evolution, isn't it ?
bye, denis
Petr Schreiber
13-04-2010, 09:35
Interesting project! It looks like some kind of tent.
The name of "InDialog_EntitySkeleton" is a bit odd, but it simplifies differentiating between UI and pure TBGL templates, at least that's what I had in mind when thinking of names.
One note - if you'll need to place box at absolute position, in future, make sure you have packed the transform and draw command in push/pop:
TBGL_PushMatrix
TBGL_Translate(-30, -30, 15)
TBGL_Box(1, 10, 1)
TBGL_PopMatrix
Currently you have the positions relative to last in code:
TBGL_Translate 0,0,14
TBGL_Box 1,40,1
TBGL_Translate 0,0,-28
TBGL_Box 1,5,1
(second box is actually placed at 0+0, 0+0, 14+(-28) => 0, 0, -14)
Petr
christianssen
13-04-2010, 10:26
I have to learn much more, I see ;) thanks petr!
one question: how I can make the tbgl scene brighter ? add second lightsource ?
perhaps you can check my modified version, if it's allright. would be nice. I like tbgl :)
more to come next day or thursday. school time is hard! :P
denis
Petr Schreiber
13-04-2010, 12:05
Hi Denis,
seems allright to me, you can try to fine tune the light source you already have:
TBGL_SetLightParameter %GL_LIGHT0, %TBGL_LIGHT_AMBIENT, 0.5, 0.5, 0.5, 0.0
Good luck in school :)
Petr