Results 1 to 12 of 12

Thread: May I contribute an example?

  1. #1
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default May I contribute an example?

    Hi all. Hopefully it's alright for me to post here, I wasn't sure where else to ask this.

    ClanLib has done a lot for me these past few years, even though I've never done anything very serious, I do enjoy the SDK and I recommend it to whomever I can who's looking for a solid foundation.

    Regretfully, even though it's OpenSource, I really haven't given much back. I'm hoping to change that!

    In the pre-2.0/1.0 days, I had used the Canvas class in ClanLib to produce an interesting (if not very basic) lighting scheme that looks pretty decent for a 2d game. It could also probably work as a "flashlight" demonstration, or maybe lead the path for a Fog of War type effect for an RTS game.

    Either way, I recently took the time to convert it from the old library to the new 2.0.x (SVN). I put together a basic demo showing how to use the framebuffer for this effect. I'd like to give it to the ClanLib community, but I'm uncertain how you, the developers, would like me to proceed with that (or if you are even interested in this).

    It's basically just a slightly more advanced "canvas" demo, showing colored or uncolored lights, day/night cycling, and maybe alpha blending.

    Are you guys interested? If so, do you want just the source/media? The entire VS2008 project? An .exe? Should I post it here, email it to one of you?

    Thanks guys for all you've done,

    Dan

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Sounds like a great contribution! Just post it here as an attachment with all the required files and projects, and we'll take a look at it

  3. #3
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Alright, hopefully there are no issues with the code (I'm far from a masterful programmer). Included is the VS2008 project (not express, the full sha-bang... dunno if they are compatible or not).

    It's only been tested under windows (Vista 64 at that). So I'm uncertain how it will do on Linux or MacOS.

    I put a semi-winded spiel in the read me (which I tried to clone your typical format), just to explain the idea behind it. Feel free to change any and everything. It's all yours.

    I encourage you to adjust the defines in main.cpp to see how things look behind the scenes during execution (shrink the scale or turn it off/on to see FPS differences in the two methods for masking).

    Let me know if there's any big issues with it. Any feedback, positive or critical, is welcome!

    Thanks,
    Dan

    EDIT: I re-uploaded the zip, I had a texture that was the wrong size (oops).
    Attached Files Attached Files
    Last edited by catch22; 06-17-2009 at 05:52 AM.

  4. #4
    Peasant
    Join Date
    Mar 2008
    Posts
    5

    Default

    Wow! Thanks for sharing! That's some useful and cool stuff.

    However, when I press space, I get an unhandled exception. It's got something to do with the set_life() function of the light.

  5. #5
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Are you using the SVN version ?

    I know Magnus re-wrote the timer routines for the SVN (no longer attached to a display window).

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I love it It's a clever way of doing lighting!

    (Attached is an image from the example)
    Attached Images Attached Images  

  7. #7
    Peasant
    Join Date
    Mar 2008
    Posts
    5

    Default

    No, I wasn't using the SVN version. Gotta get that one then.

  8. #8
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Thanks Rombust! I was seeking a non-shader way to do it at the time.

    Maybe next I'll work on per pixel shaders


    Edit: On another note, I should probably provide a demo for 1.0 as well (should be fairly simple since I originally wrote this for 0.8). I loathe the idea of having multiple clan lib installs, though. That could get funky.

    Hrmph.

  9. #9
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Thanks for the cool example, I've included it now.

    Regarding 2.0 and 1.0 side-by-side, its really easy. I can explain how my setup works, and you can tune it to your own setup.

    I have a directory structure like this:

    c:\source\include
    c:\source\includeClanLib1
    c:\source\includeClanLib2
    c:\source\lib
    c:\source\libClanLib1
    c:\source\libClanLib2

    I put all my third party libs in include and lib (like libpng, zlib, etc)
    Then in ClanLib 1.0 Configure.exe I specify c:\source\includeClanLib1 and c:\source\libClanLib1 as ClanLib folders.
    And in ClanLib 2.0 Configure.exe I specify c:\source\includeClanLib2 and c:\source\libClanLib2 as ClanLib folders.

    I compile and install both versions.

    Now, to switch between them, I only need to go to my Visual Studio VC++ Directories, and change the include and lib settings to either use ClanLib1 or ClanLib2.

  10. #10
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Well looks like i have no excuses now I'll give that a try.

  11. #11
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    If I were you, I wouldn't bother porting it to 1.0.

    I believe the people using 1.0 are people who have existing projects that are hard/big to port to 2.0. And since we want all new users to use 2.0, I'd rather have cool examples there

  12. #12
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Woot!

    It's official then. I got a free pass to be a slacker.

    He said it, not me!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •