Results 1 to 6 of 6

Thread: texture drawing method questions

  1. #1

    Default texture drawing method questions

    As far as I know the CL_Texture class store data in video memory, I want to use the davantage~
    what I want to do is simple, just to use CL_Texture to draw a streched flat image in a rect.
    I see there is a draw function that draw texture in rect, but how to strech?
    and is there some bilinear support instead of linear or closest point?

    Thanks.

  2. #2
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    I think that scale is used for x and y.

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

    Default

    For CL_Texture:

    Code:
    CL_Draw::texture(
    		CL_GraphicContext gc,
    		const CL_Rectf &rect,
    		const CL_Colorf &color = CL_Colorf::white,
    		const CL_Rectf &texture_unit1_coords = CL_Rectf(0.0, 0.0, 1.0, 1.0));
    So, it will automatically be stretched by OpenGL.

    Remember to use gc.set_texture(0, texture) before and gc.reset_texture(0) after.

    To set the filters use: (CL_Texture)

    Code:
    	void set_min_filter(CL_TextureFilter filter);
    	void set_mag_filter(CL_TextureFilter filter);
    CL_Texture is very low level, where speed will be the priority.

    Maybe CL_Sprite would be a better choice? http://clanlib.org/docs/clanlib-2.0....CL_Sprite.html

  4. #4
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    Wow, that's quite different

  5. #5

    Default

    Thank you ROMBUST, I'll try.
    So the CL_Draw::texture's 2nd param means the rect in gc, and 3rd param deal with background color I guess? then the 4th param is the rect in source texture which should be picked up by gc.set_texture(0, texture).
    Am I right?

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

    Default

    "As far as I know the CL_Texture class store data in video memory, I want to use the davantage"

    All ClanLibs image classes use data stored in video memory. You'll gain very little by using CL_Texture instead of for instance CL_Image, except for a more cryptic API.

Similar Threads

  1. Patch : load method for CL_CollisionOutline
    By sandelz in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 05-27-2009, 06:35 PM
  2. ClanLib 0.8.1 desktop depth check method?
    By alexv1 in forum Official ClanLib SDK Forums
    Replies: 9
    Last Post: 05-26-2009, 12:09 PM
  3. ClanLib 0.9 Texture Packer
    By sphair in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-15-2009, 05:45 AM
  4. relationship between GC and Texture?
    By logixoul in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-07-2008, 07:17 AM
  5. How to use gui without .run() blocking method ?
    By hubadu in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 05-16-2007, 07:48 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
  •