Friday, May 16, 2008

Coverflow example using Delphi and GLScene

Problem
I am beginning work on Pics Print 4. One of the things I want to do with this release is make it significantly more slick. To that end, I thought "Coverflow". See here for an example

The trouble is that there is not that much in the way of delphi examples. I did find "Flying Cow", which is a Delphi implementation using OpenGl.

Flying Cow
Flying Cow is a clone of Cover Flow written by Matías Andrés Moreno (http://www.matiasmoreno.com.ar/ website currently down)

Changes to make Flying Cow compile under D2007, and download links, are listed in http://www.aqua-soft.org/board/showthread.php?t=46566 (website currently down as well)

Flying Cow looks quite nice. However it has one huge drawback from my point of view, it uses the GPL and is therefore unsuitable for my use.


Flying Cow implementation


GLScene implimentation
I have created my own version using GLScene. Considering that I haven't done any 3d work since 2005 (on a pda using C++ at that), it was remarkably easy to get going without cracking open my OpenGL books.

Here is the result:


Basic layout


Showing 2 images across, and using transparency on mouseover to show hidden images.


Now with added mirroring goodness



Now with vertical layout, showing 2 across and 2 down

You can download my source and the executable from here. It is written in D2007 but should be easily portable to earlier version (there may be a for ... in loop or two but that is about it).

This is prototype code, not production code so be warned. I take no responsibility if it eats your homework, backchats your mother-in-law or transfers all your money into my bank account. On the plus side, it has a promiscuous license so you can use it in your own apps without problems.

If you make any improvements, let me know and I will update source accordingly.

Update
Mirroring added

Update 2 - May 30
Code changed to use an object list instead of an array, removed Graphics32, given optional vertical layout, allows multiple rows, and demonstrates removing pages.

Links
Javascript implimentation
http://flashloaded.com/flashcomponents/photoflow/example1.html

Flying cow discussion thread
http://www.aqua-soft.org/board/showthread.php?t=46566

GLScene
http://glscene.sourceforge.net/wikka/HomePage

My version
http://www.sourceitsoftware.com/download/delphi/CoverTest.zip

10 comments:

x said...

Oooh, the demo is gorgeous!

Mark Robinson said...

that is amazing!

Anonymous said...

Hello I try to complia CoverTest.zip, What is missing whre can I get IT.

Spectacular DEMO.
JLouro

Sean said...

The main thing you need is GLScene (see link above).

You will also need to comment out any references to Graphics32 (TBitmap32). YOu could add Graphics32 but it doesn't add any capabilities to the demo.

If you are using an earlier version of delphi, you may need to replace any for .. in loops.

Anonymous said...

hi
Thank you by the source..

but when i open the covertest.dpr in Delphi 7 i got a error :

Coverflow.ExplicitLeft: Property ExplicitLeft does not exist ..

Sean said...

They are new properties introduced in Delphi 200x. Just save the form and you should be ok.

Anonymous said...

Cool stuff. Too bad Apple patented this for use with album cover art.

Tom said...

Very, very nice!

Is it possible to change the entire background color? When changing to e.g blue, the lover part gets different from the upper part...?

And is it even possible to make it transparent?

Regards
Tom

Sean said...

@Tom, I don't know. It has been over a year since I looked at the code so I am not much help. I suggest that you check the GlScene home page.

Tom said...

Will do, thanks