View Full Version : little help for axisfork :)
Lionheart008
08-02-2009, 13:15
dear tbgl friends, good morning,
perhaps I have some problems with thinking clear this morning... I would like to build a simple axisfork and a cube for playing and pushing some buttons after it to handle with coordinates of objects... but I have done something wrong with my script... ;(
I am just working with my old notebook and travelling by train, but I cannot see the mistake... I cannot see the axisfork and the cube isn't at the right place...
I send the script, would be nice to check it, I have some tomatoes on my eyes ;)
bye, will come back the next days from a short holiday, Lionheart
best wishes and have a nice day :)
Michael Clease
08-02-2009, 16:03
You have entities with the same number, I would move all the entity equates to the same area so this cant happen.
Ive done this before.
' -- Entity IDs
%eCamera = 1
%eLight
%eBox
'-------------------
begin const
%ENT_AXISFORK = 1
%LST_AXISFORK
end const
BEGIN CONST
' -- Scene IDs
%sScene = 1
' -- Entity IDs
%eCamera = 2
%eLight
%eBox
%ENT_AXISFORK
%LST_AXISFORK
End const
Petr Schreiber
08-02-2009, 16:11
Hi Frank,
Mike is right.
It is good to number scenes, entities and displaylists independently from 1.
So using something like this:
BEGIN CONST
' -- Scene IDs
%sScene = 1
' -- Entity IDs
%eCamera = 1
%eLight
%eBox
%ENT_AXISFORK
' -- Display list IDs
%LST_AXISFORK = 1
END CONST
It will save you lot of trouble when coding. Happy holidays :)
Lionheart008
08-02-2009, 20:47
:D Great
thank you, petr, mike, you are right, I agree with you...
It is good to number scenes, entities and displaylists independently from 1. and
You have entities with the same number, I would move all the entity equates to the same area so this cant happen.
I haven't seen and thought about it while I was working with my notebook... I check it again and show my example when the script will be finished ;)
I will come back with some new ideas and perhaps my first tutorial, it's only my time problem at the moment to realize it (sorry) ... have three jobs at the same time, but I am doing it with much fun and with open new horizons :lol:
good evening, take care, see you, Frank Lionheart di sunny snow Holidays 8)
Lionheart008
10-02-2009, 13:41
;) sorry, new question
... what is the best way to 'animate' an axisfork for a certain time value??? My idea was:
a) push a button (start/stop) to rotate the axisfork, but it's perhaps to complicate to realize it...
never done it before to say "Hello, move some angles or seconds, then Stop please"...
b) push a key (Space bar) or a letter ('S', 'A', 'T') to start/stop the animation...
I add my last exercise here... I want to show the changing of moving objects with printing the changing coordinates when you moving the objects (sphere, cube and so on...)...
I would like only to have some advices or help where I can find more of content about these stuff... I haven't all script with me at holidays (only my laptop)...
ciao and best wishes, Lionheart
Michael Clease
10-02-2009, 15:39
Frank I am not sure what you are asking for ?
... what is the best way to 'animate' an axisfork for a certain time value???
grab the timer value at the start of the animation
keep grabbing slices of timer while you animate until you reach the desired time.
Lionheart008
10-02-2009, 20:54
Hi Michael:)
I try to use the button with dialog to make a start/stop animation for rotating objects and axisfork, I have never done it before... I will tell you more about this chapter when I have managed it after drinking beer and snow fun skiing ;)
ciao , thank you, see you and good evening, Lionheart
Michael Clease
11-02-2009, 00:27
Here you go Frank, just click the button to start and stop.
Lionheart008
11-02-2009, 16:46
hi michael, great, very simple and that's the way I like it :-)))
now I will only to try to pick up a xyz mouse handling for the spheres, objects at all to see how they are changing the coordinates after moving, it may be run with 'getpixelinfo/point inside' but I will try it tomorrow...
wish you a nice day, see you and thanks again, most of the things are the best with simple codes :)
ciao, Lionheart
ps: try to find a way to catch the object coordinates while the animation is running... so you can see sphere is changing its place and xyz coordinates follows (0.01, 1.25, 0.25) .. and much more will come next days :)
nice day
Michael Clease
12-02-2009, 16:49
ps: try to find a way to catch the object coordinates while the animation is running... so you can see sphere is changing its place and xyz coordinates follows (0.01, 1.25, 0.25)
Frank try this TBGL_EntityGetPos
Lionheart008
13-02-2009, 19:11
hi michael, hi all:)
I have done it (work in progress) to go further for one step, but there are two problems for me now:
1) to catch the coordinates of an object (eg. sphere) and printFont the coordinates while the sphere is moving...
2) have done a mistake for the sphere coordinate (have got (5) or (1)), I am sure I have done something wrong...
I will use the 'mouse over' function to check some added functions (fps, coordinates and more) for the objects...
my trouble lines are this one ;) didn't managed it yesterday evening... and searched a solution with F1, but there was no clear answer for me...
TBGL_GetPixelinfo tbgl_MouseGetPosX, tbgl_MouseGetPosY, %TBGL_PINFO_XYZ, x, y, z
' -- Get where sphere is
TBGL_EntityGetPos(%sScene, %eSphere, sx, sy, sz)
' -- Test if point is inside sphere, this can be done in various ways
IF TBGL_PointInside3D ( x, y, z, %TBGL_OBJ_SPHERE, sx, sy, sz, 0.8 ) THEN
foundSphere = TRUE
TBGL_PrintFont "Sphere: "+format$(%eSphere, "#.00"+"#.00"+"#.00" ), x+0.01, y+0.02, z+0.04
ELSE
foundSphere = %FALSE
I would like to move the sphere and want to see how the coordinates are changing with it :)
perhaps somebody can help... would be great...
nice evening, coming back tomorrow and I am very tired by traveling through snowy german autobahn...
ciao und servus, Lionheart
Michael Clease
13-02-2009, 21:09
TBGL_PrintFont "Sphere: "+format$(x, "#.00 ")+format$(y, "#.00 ")+format$(Z, "#.00 "), sx+0.04, sy+0.02, sz+0.04
you was giving it your sphere reference to print ;)
is this what you are looking for ?
Michael Clease
14-02-2009, 01:02
I had a little play and cleaned up some more so I decided to repost the script.
ErosOlmi
14-02-2009, 08:35
Thanks to this script, I've found a little problem in DIM statement.
In function RenderMyImage there is the following line:
local x, y, z, X, Y, Z as single
x, y, z variables are declared twice.
In thinCore engine they are created once but it seems (looking at process memory allocation) memory is allocated twice and not completelly released at the end of the function. Also no runtime error is reported.
I will fix it for the next release.
Ciao
Eros
Michael Hartlef
14-02-2009, 12:30
Maybe it is a conversion from a C program. There you can do this, as C is case sensitive.
ErosOlmi
14-02-2009, 14:47
Well, whatever it is, next thinBasic version will catch it ;)
Lionheart008
14-02-2009, 19:31
hi all :)
thank you michael (abraxas) first of all for the right coordinate code input help for my lovely sphere! :)
I have finished my example some minutes before, so I have this idea in mind some days ago... good to see that help is welcome and I have got some good infos and help... I like and love it! :-D
when you use the mouse you can get infos now for pyramid (left up side), box (right below) and sphere (big one, center area)... when you push the start/stop button take the mouse over the primitives and the coordinates of the objects appear, that was I have intended, good! :-))
more will come... all work in progress...
good evening, best regards, Lionheart
ps: have deleted the X,Y,Z double letters in my script...
old one
local x, y, z, X, Y, Z as single
into new one
local x, y, z as single
ciao und servus 8)
Petr Schreiber
14-02-2009, 21:32
Ciao!,
this script is really nice, but it keeps one terrible secret :shock:
... ok it is not that terrible :D, but it generates openGL error.
In BuildAxisList, you call TBGL_LineWidth inside TBGL_BeginPoly / TBGL_EndPoly.
This is no problem for robust drivers, but to keep it clean, it is enough to move TBGL_LineWidth just before TBGL_BeginPoly.
How to check for OpenGL error? In your debug ( not release ) code use TBGL_GetLastGLError. If it returns non zero length string, something is wrong.
I attach "fixed" ( but it was really just swapping lines ) code.
Lionheart008
16-02-2009, 10:37
good morning :)
ciao petr... thanks for your good input.. I have changed the lines with TBGL_LineWidth and for the endpoly too:) you have forgot it for the end ;)
a) I have added the missing -x and -z axisfork lines so I have planned last week but now I am thinking the example has finished :D
b) 'TBGL_GetLastGLError'??? that's new for me... perhaps I will check it this afternoon... must go at work now.
wish you a nice day, at study and see you, lionheart freezing x-men
ps: little question: what are 'canvas' (UI module) examples are good for? I have done and changed your canvas example with single and double buffer... and have asked myself what can I do with canvas? I can create box, lines and not much more, isn't it? :)
pps: second one: When I am writing a script with my notebook and push 'run' with lovely thinair my notebook gives the usual script error message, but after that my notebook close my win xp os and I have to restart my pc... I have done it the first three, four times, after that I push Strg+Alt+ENT (Delete) to close only the current script file... uaaargh... my desktop computer is ill.. unfortunately... my dvd rom drive is damaged... ;( cannot open it any more...
Petr Schreiber
16-02-2009, 15:24
Hi Frank,
I have changed the lines with TBGL_LineWidth and for the endpoly too:) you have forgot it for the end Wink
{ insert devilish laught here }. No I did not forget. OpenGL/TBGL works like state machine. That means - once you set TBGL_LineWidth 4, then it is 4 until you change it to something else.
So:
TBGL_LineWidth 4
TBGL_BeginPoly ...
...
TBGL_EndPoly
TBGL_LineWidth 4
Is simply not necessary.
TBGL_GetLastGLError - it returns text description of last OpenGL error, if you have german drivers, it will return it in german :)
UI canvas is solution added by Eros. It is not hardware accelerated, but on the other side it works on principle of baking commands to persistant bitmap, so you do not have to handle WM_PAINT and supply all graphics again and again.
I am sure next version will expand its possibilities ;)
Regarding thinAir/thinBasic unstability - better to create new topic along with script which produces error.
Thanks,
Petr
ErosOlmi
16-02-2009, 16:09
pps: second one: When I am writing a script with my notebook and push 'run' with lovely thinair my notebook gives the usual script error message, but after that my notebook close my win xp os and I have to restart my pc... I have done it the first three, four times, after that I push Strg+Alt+ENT (Delete) to close only the current script file... uaaargh... my desktop computer is ill.. unfortunately... my dvd rom drive is damaged... ;( cannot open it any more...
Ciao Lionheart.
As Petr suggested, please open a new post in bug about the problems you are having.
Possibly attaching the script source code (or part of it) that is crashing your system.
Also important is to know if it crashed only when the script is executed from inside thinAir or also when script is executed by the shell, ie double clicking on it in Explorer.
Again, what anti-virus do you use (it can make a lot of difference)
I use thinAir / thinBasic every day under many different OS and never occurred to me such a situation.
So it is important for us to understand the exact situation under which you are working.
Ciao
Eros
Lionheart008
17-02-2009, 19:39
hi eros, hi all...
my 'kaspersky antivirus' don't work anymore... I will buy it the next day (ca. 30 euro) and check my notebook behaviour new... scan all my directories. my scripts cause crashes with thinair/thinbasic module (and sometimes with 'silo 3d' too) and when I am double clicking by explorer... strg+alt+delete helps me at this time;) But this strange behaviour I have only with my notebook (Winxp SP 1)... not with my mainly pc... I will tell you more, when I have checked all my files on hd :)
may be it's not thinair module but my notebook has its own mind:)
best thanks, good evening, Lionheart
ps: I have deleted my old avira antivirus on my notebook win xp os, this morning everything is working fine... tomorrow I will use the new kaspersky antivirus software, I have made good experience with it :-D