Results 1 to 3 of 3

Thread: Color gradient with line-fill algorithm

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    maple grove, mn usa
    Posts
    1

    Color gradient with line-fill algorithm

    I wrote a line-fill algorithm and for each line I set glColor3f() at the start point and glColor3f() at the end point, calculating the percentage of color required to acheive an even shade across the body of the polygon. This allows me to color shade at any angle I want.

    It works great except for one problem: IT'S SOOOO SLOW. It takes 5 seconds for ONE polygon to render. This is because the poly is made up of approx. 400 lines, meaning over 800 calls to glVertex2f().

    There MUST be a faster way to do this!! I can't use display lists because I have to scale the poly for zooming in and out in my program.

    HELP!!!

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2000
    Location
    germany
    Posts
    25

    Re: Color gradient with line-fill algorithm

    Wouldn't this be an example where textures should be applied? Create the texture image with your 'line filler' once. Rendering then is really fast!

  3. #3
    Senior Member Regular Contributor
    Join Date
    Sep 2003
    Posts
    135

    Re: Color gradient with line-fill algorithm

    One word:

    1D-Texture

    Ok, that's two words.

Similar Threads

  1. Gradient line
    By paleajed in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-09-2013, 06:33 PM
  2. Gradient fill for text
    By KMJ1KOR in forum OpenGL: GLSL
    Replies: 2
    Last Post: 02-10-2011, 05:31 AM
  3. How to fill with color a line strip
    By suzanne14 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 04-26-2009, 04:38 PM
  4. Drawing a gradient fill in 2D vector based objects
    By ionstream in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 06-22-2006, 01:41 PM
  5. Flood Fill Algorithm
    By CuriosoVB in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-19-2003, 12:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean