Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1013083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:02:41+00:00 2026-05-16T10:02:41+00:00

I’m drawing 2D, concave, sometimes multicontoured, sometimes self intersecting polygons with OpenGL. Here is

  • 0

I’m drawing 2D, concave, sometimes multicontoured, sometimes self intersecting polygons with OpenGL.
Here is a sample:
alt text

Right now, I take the points which if connected would result in the polygon’s outline. Then I put these into the GLUTesselator where triangles come out. I then make texture coordinates and texture the polygon.

The absolute slowest component is the tessellation / triangulation. Given that I just need to draw these as you see, what are faster alternatives to triangulating? Could I possibly find a painting algorithm that would set the pixel appropriately?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:02:42+00:00Added an answer on May 16, 2026 at 10:02 am

    First a simpler problem: suppose you just wanted to use one color. You could start with the list of outlines, then scan the whole window by row and column: whenever you crossed a boundary, you would increment or decrement (depending on the sense of the crossing) a counter how_many_outlines_am_I_inside. When it’s zero, paint the pixel white, otherwise paint it green (and I guess black for the boundary itself). This will handle self-intersecting curves correctly.

    Now for the shades. Judging by your example, shading is uniform vertically, but changes horizontally, scaled to the full width of the outline. So instead of a simple counter, you’ll need a stack (I recommend stl::list) of outlines, so that you can keep track of which outline (of the ones you’re inside) is uppermost, so that you can calculate what fraction of the distance you’ve covered from xmin to xmax. Finally for the translucency (as with the star partly visible through the rectangle): you’ll have to decide on the rules yourself, I can’t infer them by eyeball, but the stack should make it easy to implement.

    Want some help with the C++ code?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.