Results 1 to 6 of 6

Thread: Creating CL_Colorf in clanlib 0.9

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

    Default Creating CL_Colorf in clanlib 0.9

    There is CL_Color for int's
    There is CL_Colord for double's

    Why not CL_Colorf for floats?

    ... Thinking about it, why do we need double precision for colours?
    Last edited by rombust; 07-04-2008 at 06:04 PM.

  2. #2

    Default

    yes I totally agree. we don't need double precision colors (float or double). will you be able to make the change including all the apis that take a Colord?

    incidentally this'll fix a gripe of mine where cl_colord gets accidentally constructed from cl_color, leading to sneaky speed problems.

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

    Default

    humm, i may be misreading your comment. We need float and/or double...

    from opengl spec:

    Current color values are stored in floating-point format,
    with unspecified mantissa and exponent sizes.
    Unsigned integer color components,
    when specified,
    are linearly mapped to floating-point values such that the largest
    representable value maps to 1.0 (full intensity),
    and 0 maps to 0.0 (zero intensity).
    Signed integer color components,
    when specified,
    are linearly mapped to floating-point values such that the most positive
    representable value maps to 1.0,
    and the most negative representable value maps to -1.0 .
    (Note that
    this mapping does not convert 0 precisely to 0.0.)
    Floating-point values are mapped directly.

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

    Default

    Fixed in latest SVN - clanlib 0.9 now uses CL_Colorf. (CL_Colord has been kept, if required)

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    There's a small problem with this patch: it is not complete. A lot of the state classes, such as CL_LightSource and CL_Material, still take doubles instead of floats. The high level 2D classes (CL_Sprite, CL_Draw, CL_RoundedRect, CL_VectorFont) also still use doubles.

    This is a problem because it now means the API is not consistent about it, which means that we end up in situations where one has to convert between doubles and floats.

    Now we just need to fight over who needs to finish this patch.

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

    Default

    heh, I forgot that!

    I better get it sorted, as my engine will be going live this week

    ... Fixed (i hope)
    Last edited by rombust; 07-14-2008 at 11:46 AM. Reason: Fixed

Similar Threads

  1. creating exe files
    By attle in forum Novashell Game Creation System
    Replies: 2
    Last Post: 02-04-2008, 09:36 AM
  2. ClanLib crashes when creating CL_DisplayWindow with target SDL.
    By Otto (Strange) Halmén in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 01-19-2008, 08:38 AM
  3. Creating add-ons for games and NovaShell?
    By whisperstorm in forum Novashell Game Creation System
    Replies: 2
    Last Post: 11-28-2006, 12:45 AM
  4. Creating TGA files...
    By Akolade in forum RTsoft Tavern
    Replies: 3
    Last Post: 02-20-2003, 04:31 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
  •