Results 1 to 3 of 3

Thread: Texture instead of gradient

  1. #1
    Lesser Knight
    Join Date
    Sep 2010
    Posts
    41

    Default Texture instead of gradient

    Hello, now I have to draw a fullscreen gradient each update iteration. Sometimes the colors of gradient change. So, maybe it would be faster to draw first time into CL_Texture and render that texture instead of calculating gradient each time?

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

    Default

    Quote Originally Posted by Ockonal View Post
    Hello, now I have to draw a fullscreen gradient each update iteration. Sometimes the colors of gradient change. So, maybe it would be faster to draw first time into CL_Texture and render that texture instead of calculating gradient each time?
    CL_Draw::gradient_fill() is very fast. Using CL_Texture probably would be slower (although I have not checked).

    Internally, ClanLib uses the following code to draw the gradient...

    Code:
    	CL_PrimitivesArray prim_array(gc);
    	prim_array.set_attributes(0, positions);
    	prim_array.set_attributes(1, colors);
    	gc.set_program_object(cl_program_color_only);
    	gc.draw_primitives(cl_triangles, 6, prim_array);
    	gc.reset_program_object();
    That is processed on the graphics card. (I do not know how the clanSWRender target works)

  3. #3
    Lesser Knight
    Join Date
    Sep 2010
    Posts
    41

    Default

    Ok, thanks. I'll test the speed of both methods.

Similar Threads

  1. The texture won't clear
    By Ockonal in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 10-08-2010, 07:41 AM
  2. New Texture 3D example
    By rombust in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-24-2009, 02:12 PM
  3. The Texture Filtering Problem
    By rombust in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 08-13-2009, 07:42 AM
  4. Some Texture Grid Questions
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 07-12-2009, 04:48 AM
  5. relationship between GC and Texture?
    By logixoul in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-07-2008, 07:17 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
  •