Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

Sprite example

28 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lord Satan

Hi all,

I just found the sprite example and wanted to take a look. So I compiled and ran it and now my eyes hurt. Do you have to do something special to remove the horrible flickering of the background? If you have to, it should be documented in the example. If not and the flickering is normal then the example is useless as noone wants sprites on a flickering background. I am not really interested in getting it fixed as I have better options to do my graphics, but I think it was a good idea to let you know. At least this mail serves as a warning to others. If you really want to run this example do not maximize the window, you will regret it.

Oh and btw this is on Ubuntu 8.04 64 bit with compiz disabled.

Reply by email

A.J. Venter
to Lord Satan

Check out gamepack - flicker-free sprites with native components.

Ciao
A.J.
PS. There is a bug report on some versions of windows - I haven't been able to reproduce it yet though.

Lord Satan wrote 13 lines
Hi all, I just found the sprite example and wanted to take a look. So I compiled and ran it and now my eyes hurt. Do you have to do something special to remove the horrible flickering of the background? If you have to, it should be documented in the example. If not and the flickering is normal then the example is useless as noone wants sprites on a flickering background. I am not really interested in getting it fixed as I have better options to do my graphics, but I think it was a good idea to let you know. At least this mail serves as a warning to others. If you really want to run this example do not maximize the window, you will regret it. Oh and btw this is on Ubuntu 8.04 64 bit with compiz disabled. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
A.J. Venter Chief Executive Officer Tel.: +27 21 554 5059 Fax: +27 11 252 9197 Outkast Solutions IT www.outkastsolutions.co.za A division of Global Pact Trading Pty Ltd. www.silentcoder.co.za - Blog scartoonz.silentcoder.co.za - ScarToonz webcomic

Reply by email

Luiz Americo Pereira Camara
to Lord Satan: I just found the sprite example and wanted to take a look. So I compiled and ran it and…
Lord Satan wrote 9 lines
Hi all, I just found the sprite example and wanted to take a look. So I compiled and ran it and now my eyes hurt. Do you have to do something special to remove the horrible flickering of the background? If you have to, it should be documented in the example. If not and the flickering is normal then the example is useless as noone wants sprites on a flickering background. I am not really interested in getting it fixed as I have better options to do my graphics, but I think it was a good idea to let you know. At least this mail serves as a warning to others. If you really want to run this example do not maximize the window, you will regret it. Oh and btw this is on Ubuntu 8.04 64 bit with compiz disabled.

I commited a "port" of the sprites example using cairo at https://svn.bountysource.com/luipack/trunk/cairo (demos/sprites).

To use it is necessary to install cairobase and cairolcl packages found in the same repository.

Be aware that the OOP cairo binding is not finished yet and some properties maybe renamed or removed.

Luiz

Reply by email

Graeme Geldenhuys
to Lord Satan: I just found the sprite example and wanted to take a look. So I compiled and ran it and…

2008/5/10 Lord Satan :

I just found the sprite example and wanted to take a look.

Hi,
I'm not on my development PC, so can't check the Lazarus directory. Where is the sprite example? Included with Lazarus?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Patrick Shepherd
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
Hi, I'm not on my development PC, so can't check the Lazarus directory. Where is the sprite example? Included with Lazarus? Regards, - Graeme -

$lazdir$/examples/sprites

Have to agree with Lord Satan, anyone not knowing Lazarus and looking at that example may well look elsewhere.

IMHO it does absolutly nothing to show the capabilities of Lazarus.

Using WinXP pro, 1GB Ram Athlon 2000+ processor, nVidia Geoforce MX440 (8xAGP 64Mb ) and the background flicker is extremely bad.

Paddy

Reply by email

Graeme Geldenhuys
to Patrick Shepherd: $lazdir$/examples/sprites Have to agree with Lord Satan, anyone not knowing Lazarus and…

2008/5/11 Patrick Shepherd :

$lazdir$/examples/sprites

Thanks, I'll have a look....

Have to agree with Lord Satan, anyone not knowing Lazarus and looking at that example may well look elsewhere. IMHO it does absolutly nothing to show the capabilities of Lazarus.

Doesn't it use double buffering to avoid flicker? From your comments, I guess not.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 13 lines
2008/5/11 Patrick Shepherd : > > $lazdir$/examples/sprites Thanks, I'll have a look.... > Have to agree with Lord Satan, anyone not knowing Lazarus and > looking at that example may well look elsewhere. > > IMHO it does absolutly nothing to show the capabilities of Lazarus. Doesn't it use double buffering to avoid flicker? From your comments, I guess not.

It uses a TCustomControl and erased the background. Disabling that in svn 15094 improves a lot. I'm not sure, what the current state of erasing background, TCustomControl and double buffering is.

Mattias

Reply by email

Graeme Geldenhuys
to Lord Satan: I just found the sprite example and wanted to take a look. So I compiled and ran it and…

2008/5/10 Lord Satan :

I just found the sprite example and wanted to take a look. So I compiled and ran it and now my eyes hurt.

:-)
Out of curiosity, I compiled the Sprites demo and you guys are right! A lot of flicker. To continue my curiosity, I ported the Sprites demo to fpGUI.

* Available in <fpgui>/examples/gui/sprites
* No painting in fpGUI is double buffered by default.
* Keyboard control:
D - enable debug mode (which displays timer interval) PgUp - increases the timer for jumpy animation
PgDn - decreases the timer for smoother animation

I'll see if I can update the Lazarus sprites demo to handle keyboard control as well.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Patrick Shepherd
to Felipe Monteiro de Carvalho: Just to complement the answers so far, avoiding flickering is very well documented here:…
Felipe Monteiro de Carvalho wrote
Just to complement the answers so far, avoiding flickering is very well documented here: http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_custom

_control_which_draws_itself

Felipe,

Just to add to LS's comments, I don't think the problem is with Lazarus's capabilities but rather this particular example.

I know myself I've been looking at Lazarus for ~6 months now (as a hobby) and if I was particulary interested in graphics (which I'm not BTW) that example would have been enough for me to ditch Lazarus at the first viewing.

It's all fair and well to say look at this wiki or this website and find your answers but I'm still stuck in (spoilt) old school where you had instant online help or manuals by your side, asking someone like me to troll through pages of a wiki until we hit the right search keyword can put people off.

I understand as an ever evolving language Lazarus is difficult to document (and I commend the efforts so far) but I do think that the examples provided should show the true capabilities rather than the pitfalls. Before anyone suggests I assist, you've no chance until I get my own head around this brilliant piece of work, but I am happy to help with documentation if anyone can give me a *clear* heads up as to what is needed.

Reply by email

Lord Satan
to Felipe Monteiro de Carvalho: Just to complement the answers so far, avoiding flickering is very well documented here:…
Show quoted text 6 lines
Just to complement the answers so far, avoiding flickering is very well documented here: http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_custom_control_which_draws_itself Follow the simple rules there everything will work fine.

That's all nice and dandy, but I don't have any desire to use this kind of graphics. To make it clear, I am developing in OpenGL with Lazarus for years and have absolutely no use for this kind of stuff. It was just an observation I wanted to share with the developers as IMHO such an example just drives people away. Either fix it or remove it, I don't care. But having non-working examples in Lazarus is a really bad choice. Looks like Patrick Shepherd was the only one understanding what I was talking about.

Reply by email

Mattias Gaertner
to Lord Satan
Show quoted text 16 lines
On Mon, 12 May 2008 10:01:22 -0300 "Felipe Monteiro de Carvalho" wrote: > Just to complement the answers so far, avoiding flickering is very > well documented here: > > http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_custom_control_which_draws_itself > > Follow the simple rules there everything will work fine. That's all nice and dandy, but I don't have any desire to use this kind of graphics. To make it clear, I am developing in OpenGL with Lazarus for years and have absolutely no use for this kind of stuff. It was just an observation I wanted to share with the developers as IMHO such an example just drives people away.

Yes.

Either fix it or remove it, I don't care. But having non-working examples in Lazarus is a really bad choice. Looks like Patrick Shepherd was the only one understanding what I was talking about.

Is it still that bad after my change?

Mattias

Reply by email

Lord Satan
to Mattias Gaertner
Show quoted text 5 lines
> Either fix it or remove it, I don't care. But having non-working examples in Lazarus is a > really bad choice. Looks like Patrick Shepherd was the only one > understanding what I was talking about. Is it still that bad after my change?

I cannot tell. Since the last svn update lazarus acts very strange and has lots of problems. One of them is opening nothing when I try to open the sprite examples lpi file. I first have to find out what is wrong here before I can test again.

Reply by email

Luiz Americo Pereira Camara
to Mattias Gaertner: On Mon, 12 May 2008 17:14:49 +0200 Yes. Is it still that bad after my change? Mattias

Mattias Gaertner wrote:

[..]

Is it still that bad after my change?

No. The flickering is gone. At least under Win32.

To get transparency in the sprite use the attached patch.

Luiz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed... Name: sprites.diff
Url: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080512/512abe76/attachment.pl

Reply by email

Henry Vermaak
to Mattias Gaertner: On Mon, 12 May 2008 17:14:49 +0200 Yes. Is it still that bad after my change? Mattias

2008/5/12 Mattias Gaertner :

Show quoted text 9 lines
On Mon, 12 May 2008 17:14:49 +0200 Lord Satan wrote: > On Mon, 12 May 2008 10:01:22 -0300 > Either fix it or remove it, I don't care. But having non-working examples in Lazarus is a > really bad choice. Looks like Patrick Shepherd was the only one > understanding what I was talking about. Is it still that bad after my change?

looks nice on gtk2 now :)

henry

Reply by email

Graeme Geldenhuys
to Lord Satan: I just found the sprite example and wanted to take a look. So I compiled and ran it and…

OK, so now the Sprite example runs smoothly under GTK1 as well. Thanks Mattias. :-)

One more problem: CPU usage!

Under my Linux system (Intel P4 2.40GHz with 1Gig memory and Ubuntu 7.10 distro), xload shows 100% cpu load. Top shows 8.7-9.3% which is damn high. I don't move or resize the window and don't touch the mouse while the demo is running.

Running the Sprite demo ported to fpGUI (on the same system as above), xload and top shows the sprite % cpu usage, like most (almost idle) applications. Plus, in this demo the timer is set at to default of 50ms, whereas the LCL sprite demo timer is is causing the high CPU usage in the Lazarus LCL sprite demo?

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Paul Ishenin
to Graeme Geldenhuys
Graeme Geldenhuys wrote 17 lines
OK, so now the Sprite example runs smoothly under GTK1 as well. Thanks Mattias. :-) One more problem: CPU usage! Under my Linux system (Intel P4 2.40GHz with 1Gig memory and Ubuntu 7.10 distro), xload shows 100% cpu load. Top shows 8.7-9.3% which is damn high. I don't move or resize the window and don't touch the mouse while the demo is running. Running the Sprite demo ported to fpGUI (on the same system as above), xload and top shows the sprite % cpu usage, like most (almost idle) applications. Plus, in this demo the timer is set at to default of 50ms, whereas the LCL sprite demo timer is set at 100ms. What is causing the high CPU usage in the Lazarus LCL sprite demo?

Come on boys. Is a fast moving of one bitmap over another bitmap is the goal and a real application of lazarus? Better spend your efforts in fixing lcl bugs :)

Best regards,
Paul Ishenin.

Reply by email

Graeme Geldenhuys
to Paul Ishenin
Paul Ishenin wrote
Come on boys. Is a fast moving of one bitmap over another bitmap is the goal and a real application of lazarus?

It depends on your target clients and applications. :-)

Better spend your efforts in fixing lcl bugs :)

I simply like watching screen animations (plus feeding fuel to the flame). At least now the Sprite demo is a good looking demo! No more epilepsy disclaimers required! :-)

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner
Mattias G?rtner wrote
>> What is causing the high CPU usage in the Lazarus LCL sprite demo? Canvas.StretchDraw

Ah yes, that would add quite a bit more cpu usage. Don't know how I missed that one. :-(

Maybe it is a bug. But for me one with low priority.

Agreed. A quick work-around would be to check the original background image size. If it's the same, use the standard DrawImage (or whatever it's called) and if it's different use StretchDraw.

OR

Don't care, make the CPU work! :-)

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Luiz Americo Pereira Camara
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
Mattias G?rtner wrote: Agreed. A quick work-around would be to check the original background image size. If it's the same, use the standard DrawImage (or whatever it's called) and if it's different use StretchDraw.

Or make an already stretched buffer like i did in the cairo version of the sprites demo.

Luiz

Reply by email

Luiz Americo Pereira Camara
to Graeme Geldenhuys: OK, so now the Sprite example runs smoothly under GTK1 as well. Thanks Mattias. :-) One…
Graeme Geldenhuys wrote 15 lines
OK, so now the Sprite example runs smoothly under GTK1 as well. Thanks Mattias. :-) One more problem: CPU usage! Under my Linux system (Intel P4 2.40GHz with 1Gig memory and Ubuntu 7.10 distro), xload shows 100% cpu load. Top shows 8.7-9.3% which is damn high. I don't move or resize the window and don't touch the mouse while the demo is running. Running the Sprite demo ported to fpGUI (on the same system as above), xload and top shows the sprite % cpu usage, like most (almost idle) applications. Plus, in this demo the timer is set at to default of 50ms, whereas the LCL sprite demo timer is set at 100ms.

I tested the fpGui example and found that it is using low cpu because is not scaling the image to fit into the window like LCL does. Notice that, in the LCL, if the window is of the size or smaller than the background image the cpu usage is very low (0%) even if using StretchDraw function.

On the other hand after i changed the fpgui example to use Canvas.StretchDraw function the cpu usage sky rocketed up to 50% in my Core 2 Duo under win32 XP even if the window is of the size or smaller than the background image.

As a side note the sprite image is rounded by a clFuchsia line.

All in all, congratulations by the fpGui. I'll be testing it for the next few days.

Luiz

Reply by email

Graeme Geldenhuys
to Luiz Americo Pereira Camara

2008/5/13 Luiz Americo Pereira Camara :

On the other hand after i changed the fpgui example to use Canvas.StretchDraw function the cpu usage sky rocketed up to 50% in my Core 2 Duo under win32 XP even if the window is of the size or smaller than the background image.

Oops. You are right. :-( Time to do some optimization. ;)

As a side note the sprite image is rounded by a clFuchsia line.

Yeah, fpGUI only supports bmp images at the moment. I had to use GIMP to convert the PNG images and added a clMagenta background so fpGUI can create a mask. The transparency of the PNG -> BMP caused the some magenta to shine through. More image formats are on the todo list.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email