Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Clyde on September 19, 2006

Title: Has Pixel Toaster been converted for FB
Post by: Clyde on September 19, 2006
As Pixel Toaster is the successor to TinyPTC from searches I've made for syncing with tiny ptc in Google.
I wondered if anybody knew or has converted it over to FreeBasic, it sounds really cool?

Here's the web address if anyone fancies trying to make it FB portable. I would have ago but my skills are limited when it comes to .a / .o

http://www.pixeltoaster.com/

My reason for asking, is that I thought it would be cool for us people who use tinyptc for rendering. No worries if it's not possible.

Cheers and much appreciated,
Clyde
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 19, 2006
I dunno about everyone else, but I feel the only thing PixelToaster has to offer is a cool name.  We've already shown we can build our own libraries, we should have the DarkPixelFactory lib that does what we want.
Now if only Rbraz will show me how to build freebasic libs with visual studio... :D

Jim
Title: Re: Has Pixel Toaster been converted for FB
Post by: Rbz on September 20, 2006
Quote
Now if only Rbraz will show me how to build freebasic libs with visual studio...


That's what I'll try to do, coding the framework in C a create a compatible library for FB, anyway what you will need to do is create a static library and rename it to libXXXX.a

 :cheers:
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 20, 2006
It's just a re-named static .lib file?  Easy-peasy then :)

Jim
Title: Re: Has Pixel Toaster been converted for FB
Post by: Rbz on September 20, 2006
Yeah, very easy and simple  :)

I'm wondering if you will code it yourself (framework + ogl stuff) or we will work together ?  ;D
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 21, 2006
It should probably be a C version of the OpenGL framework you posted before, with some tweaks to avoid having to call an init function.  If you want a crack at it, be my guest, otherwise I'll see what I can do.

Apart from ptc functionality, and Shockwave's wish-list (Alt-Enter, vbl sync in a window), is there anything else people want adding?  Once you have OpenGL in there you can do all kinds of fast things.  Or maybe some graphics file loaders? bmp/jpg etc?

Jim
Title: Re: Has Pixel Toaster been converted for FB
Post by: Rbz on September 21, 2006
Cool !!   Will be really cool if you code it, if there's anything that I can help, please let me know :)

Title: Re: Has Pixel Toaster been converted for FB
Post by: Shockwave on September 21, 2006
There's a truck load of stuff that would be great to add :)
Perhaps 2 versions would be good. A "lite" version that only uses the basic ptc style stuff and a deluxe version. If you would be willing to code a lib like that Jim, I'd have about 20 suggestions for it.  :D
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 22, 2006
OK, early days yet...I've made this one called ptc.  So where you have #include "tinyptc.bi" replace it with #include "ptc.bi".  It does everything ptc does, but using the OpenGL code that Rbraz and I came up with.  It also has ptc_flip() which just flips the panes and ptc_setflip(rate) which lets you set the vblank period.  Use 1 for 60Hz and 0 for unrestricted.
Right now there are a couple of warnings when you link, and it doesn't seem to be handling the inkey$ command properly.  This is just down to ignorance on my behalf, I suspect.
Rbraz - if you want to pick up from here and do a little work on it that would be cool.  You probably know how to make it all fb compatible far better than I do.

Cheers,
Jim
 
Title: Re: Has Pixel Toaster been converted for FB
Post by: ninogenio on September 22, 2006
nice one jim!  :cheers:
Title: Re: Has Pixel Toaster been converted for FB
Post by: Shockwave on September 22, 2006
Yes, that is a better idea. Having it named different to tinyptc.
Will test it and report back :)
Title: Re: Has Pixel Toaster been converted for FB
Post by: Rbz on September 23, 2006
That's will be a cool project!

@Jim: it's a cool idea to use another thread to process messages, but it's not working here, the window stop responding and it can't check for WM_CLOSE or WM_KEYDOWN, tried using 'peekmessage' method and failed too...

So I did some modifications in your source and added escape key support and one example to test it.
Now we will check for winapi messages in the ptc_update function using 'peekmessage' method.

I can disable all FB warning's but I'm using Visual C++ 6.0 not sure if it will work for VCExpress, just use #define WIN32_LEAN_AND_MEAN to disable uuid.lib and compile without any default libraries (LIBCMT and OLDNAMES).

Take a look at it and tell me if all is correct, and then I'll add fullscreen support :)


[edited: example]
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 23, 2006
Thanks for the tips for getting rid of the warnings.  I'm on vc2005, I think those options still exist...
I wonder why the thread thing doesn't work.  It should.  Anyway your changes are fine go ahead with it.  I can see I'm going to be flat out again next week.

Jim
Title: Re: Has Pixel Toaster been converted for FB
Post by: Rbz on September 24, 2006
No probs,  I'm glad that I can help  :)

I have started a new topic in the C/C++ section about it:
http://dbfinteractive.com/index.php?topic=672.0


@Clyde: Sorry for topic hijacking  ;D
Title: Re: Has Pixel Toaster been converted for FB
Post by: Clyde on September 26, 2006
No probs and thanks Rbraz mate. I'm still using your proper converted TinyPTC and Direct Draw version. I have noticed with the syncinng it caps any effects to my refresh rate, which I guess is what's expected. And progs run more or less as Blitz does, albiet a tad better.
 
What I am a little unclear about is that TinyPTC / PixelToaster use Direct X. Does OGL offer better results?
Title: Re: Has Pixel Toaster been converted for FB
Post by: Jim on September 26, 2006
It's all going to be the same in the long run.  TinyPTC uses DirectDraw which Microsoft don't support any more and is not under development - driver designers are unlikely to be looking at that bit of their code any more.  PixelToaster uses Direct3D.  I've noticed though that for 16bit displays PT's code doesn't use the hardware to do the conversion which is a bit silly.
Rbraz and my library uses OpenGL.  There is going to be absolutely nothing in it, in terms of performance, if the idea is to continue drawing into an array and copying it up to the screen each frame.  It just so happens that coding OpenGL is a pleasure while coding D3D is a pain in the arse, so I picked OpenGL :D

Quote
I have noticed with the syncinng it caps any effects to my refresh rate, which I guess is what's expected.
Yes, that is indeed the whole point of the syncing.  So that you can flip the screen when the electron beam is travelling back from the bottom right of the screen to the top left to start the new frame.  That means your flips are locked to the display's refresh rate, which makes for super-accurate timing and no tearing.

Jim
Title: Re: Has Pixel Toaster been converted for FB
Post by: Shockwave on September 26, 2006
I actually think that the vsync is a lot more reliable with rbraz and jim's ptc lib than B3d. I always used to get glitches in my scrollers with BB, I don't any more :) Everything runs perfectly smooth.