PDA

View Full Version : Effects, stars, colors example :)



Lionheart008
19-11-2008, 09:26
good morning dear thinbasic friends,

- as I am looking for some new stars and effect examples for learning I have done a new tbgl example with nehe basically functionality ;) and improved it...

- I will push this example for my exercises with tbgl :)

a) push "B", "Page-up", "page-down", "arrow-up", "arrow-down", "T" for Twinkle Effects and "left arrow" / "right arrow" for increasing / decreasing effects :)

b) push "arrow-up" / "arrow-down" to see how the star effects skip /rotate down ...

have fun with it, I like this exercise very mucho ;D

best wishes, have a nice day, Lionheart

Lionheart008
02-12-2008, 15:39
hello, I have improved my last stars-effect example with rotating functions, more distance and few more ;) perhaps anybody can check it if it does run ...

bye, Lionheart

ps: I am still living :) and will check the new power of thinbasic 1.7.0.0 !
private life has caught me closer as I wished :)

my New EDIT for the effect Script: I have updated the last version :) with the right fps function... god will ;)

(script status quo: 9. dec. 2008)

Petr Schreiber
02-12-2008, 17:11
Hi Frank,

nice demo, maybe it would be good to sync it with actual FPS, it runs too fast on my PC :D


Petr

Lionheart008
02-12-2008, 18:55
hi petr,
hi all...

yep! - have done it:) the update you see in my last post...

a) perhaps this version isn't so fast, now with fps and changed some other things...

AND...

b) I have built in a very nice cube with effects... ;D

bye, Lionheart

ps:

question...


tbgl_PrintBMP FORMAT$(FrameRate, "0")+" FPS", 0, 1, %TBGL_ALIGN_RIGHT_UP

c) it's possible to build in this one into the script ??? (print on screen???)... it's doesn't work really good... hmh...

Petr Schreiber
02-12-2008, 20:13
Hi Frank,

I am in torturing mood, so I will post here just few suggestions to achieve result you need, instead of complete solution :)

#1] Problem with font "not working"
Make sure you do not confuse TTF fonts and fonts created from bitmaps.
In your code you build 3D representation of TTF font, and then you try to print it


tbgl_PrintBMP FORMAT$(FrameRate, "0")+" FPS", 0, 1, %TBGL_ALIGN_RIGHT_UP

... which serves to different purpose.

So make sure you:
- use TBGL_LoadBMPFont function to load font from texture
- reset matrix before rendering font in the end
- use TBGL_PrintBMP as you want

... I have working sample here, so I am not guiding you to the marsh. You must trust me and try to implement this on your own

#2] FPS synchronization
The code you posted is not yet synchronized properly.
Statement like:


.Dist -= 0.015


will substract 0.015 from dist ( that is good ). But if it runs on PC on 1000FPS, it will subtract 1000*0.015 in one second, while on PC where it runs 60FPS it will subtract 60*0.015 per second. That means different speed on different PCs - so it runs as you intented only on your PC.

Solution is to scale such a movements for current framerate ( FPS ) or time delta between frames ;)

If you'll have problem to find the solution, I will help you - but it is always better to do it on your own, you will remember it ... not forever, but for long time definitely :)


Thanks,
Petr

Lionheart008
02-12-2008, 21:15
short reply: ok for step one:) so I have updated the script...

- fps as bmp font created ;) changed the different modes of ttf and bmp...


So make sure you:
- use TBGL_LoadBMPFont function to load font from texture
- reset matrix before rendering font in the end
- use TBGL_PrintBMP as you want

... I have working sample here, so I am not guiding you to the marsh. You must trust me and try to implement this on your own

- and I will check up my mind to find a solution for fps synchronization... never done it before, I will look after this new chapter...

thanks again, best regards, Lionhead, leader of new x-men menbership

Lionheart008
09-12-2008, 21:37
hi all :)

I have tried to sync the fps... so I have found the right stuff to do that ;)

new version I add here, perhaps somebody can check it if it's run not too fast on your pc machine :) otherwise I have to check it again why fps synchronization failed ... :(

bye, Lionheart

ps: please see my second post above where you can find the new script update :)