Results 1 to 2 of 2

Thread: GDI Target Draw Problems

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

    Default GDI Target Draw Problems

    First:
    I have had a look at why the GDI target does not render the Methane example correctly.

    It is caused by these 2 functions: cl_draw_image_nearest_white and cl_draw_image_nearest()
    Code:
    (in draw_image.cpp)
    	int start_src_x = (params->src_x<<16)+params->delta_x*scale_x+32768;
    	int start_src_y = (params->src_y<<16)+params->delta_y*scale_y+32768;
    When you remove the "+32768" (which i assume denotes a half texture pixel), the Methane example renders correctly.

    I have not committed the patch to svn, as I am not 100% sure why it works

    Secondly:
    During testing, i thought I would disable the cl_sprite_program to see what happens - This let to the following problem:

    In: CL_GDIGraphicContextProvider::draw_triangle()

    Is missing:
    Code:
    	tex_index_fetcher->fetch(&sampler_index, indexes, 1, default_sampler);
    (It is included in draw_sprite() )

    With this included rendering works.

    Again I have not committed the patch to svn, as I am not 100% sure why it works

    Thirdly:
    Sprite/Image rotation currently does not work (See the TexelCenter test) when the modelview matrix has changed.

    It does work when the cl_sprite_program is disabled.

    I was thinking of using the triangle renderer when rotation is detected - However I am not sure of the best way to detect it, without duplicating matrix multication calls.

    Finally:
    It appears that the sprite program cannot draw a texture flipped (where the destination start position is greater than the end position)
    This can be fixed by disabling the cl_sprite_program

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

    Default

    Quote Originally Posted by rombust View Post
    First:

    When you remove the "+32768" (which i assume denotes a half texture pixel), the Methane example renders correctly.

    In: CL_GDIGraphicContextProvider::draw_triangle()

    Is missing:
    Code:
    	tex_index_fetcher->fetch(&sampler_index, indexes, 1, default_sampler);
    (It is included in draw_sprite() )

    With this included rendering works.
    I have added a patch to SVN for the first 2 points, and last 2 points are unresolved at the moment.

Similar Threads

  1. How can you draw a sprite or a surface onto another surface?
    By alexv1 in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 02-26-2009, 03:36 PM
  2. draw surface onto another surface before drawing portion to the screen
    By alexv1 in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-25-2009, 12:19 PM
  3. The GDI Target – Rendering Pixelbuffers
    By rombust in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-15-2009, 09:46 PM
  4. 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
  5. The fastest way to draw pixel by pixel?
    By Otto (Strange) Halmén in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 12-06-2006, 07:32 AM

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
  •