Results 1 to 4 of 4

Thread: problem with CL_Surface display a PNG

  1. #1
    Serf
    Join Date
    Mar 2008
    Posts
    2

    Unhappy problem with CL_Surface display a PNG

    Hi, everyone:
    I am Beginner of CLanLib.
    the following picture are using CL_Surface to displaying
    a png (semi-transparent buble)
    The problem is if the image is moving (change the x,y every frame)
    there will be lines at right and bottom,
    which is quite strange.

    any one got idea how to solve it
    or sharing some experiences?


    code roughly looks like:
    in constuctor
    Code:
    circlePic = new CL_Surface("buble.png");
    and in paint()
    Code:
    circlePic->draw( _center->getX(), _center->getY());
    _center changes its position every frame.

    Thanks guys.

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    Hrm, well, I'd guess it's something to do with the image being pasted onto a larger surface (that is a power of 2) internally by Clanlib and then the antialiasing is sometimes bleeding over onto the unused surface area.

    One fix is disable antialiasing, do this right before drawing:

    Code:
    clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, CL_NEAREST);
    clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_NEAREST);
    Another way would be to use a power of 2 surface or generating it manually, setting it to alpha 0, then copying the loaded surface onto it or some other trickery like that.
    Seth A. Robinson
    Robinson Technologies

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

    Default

    Try using CL_Sprite instead of CL_Surface, IIRC that converts it better to a POT texture. The API should be pretty much the same, only more features in CL_Sprite.

  4. #4
    Serf
    Join Date
    Mar 2008
    Posts
    2

    Thumbs up

    Thanks guys!!!

    The CL_Sprite DO solve the problem.

    More than that
    The lines can only be seen in my computer,
    but not my friends.
    (perfect image on other laptops)
    My workspace is Vc++ 2008 Express Edition + XP
    If any encounter such a problem don't be so annoy.

Similar Threads

  1. cl_displaywindow refuses to display a window
    By dwune in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 10-01-2007, 04:01 PM
  2. [Bug ?] Problem with pixel buffer returned by CL_Surface::get_pixeldata
    By LiFo2 in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 05-10-2007, 09:23 AM
  3. Display targets and input
    By void_kill in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 03-23-2007, 11:56 PM
  4. Clanlibs display errors
    By megumiaraki in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 12-07-2006, 07:20 AM
  5. Game loads but display is all black.
    By diggisaur in forum Other RTsoft Games
    Replies: 6
    Last Post: 03-28-2003, 05:53 PM

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
  •