Avatar of ustechdata
 asked on

Drawing a hole in a polygon with opengl light must pass through it

I am new to opengl and I want to draw a steel frame with a gap in 2 or 3 places for small steel structure to pass through.I know how to draw the structure but dont know how to draw the hole.Pls help me i am stuck.Any sample code will be great help
              Thanking in advance  
              opengl newbie
Game Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon

As a human being, its convenient to think of the frame as a solid object with a couple of holes in it.  But opengl only sees the world in terms of triangles, so you have to feed it a series of triangles that make up the existing frame around the holes.

Fortunately, you are not the first person to have this problem.  This is what the GLUT tesselation routines are for.  You set up a tesselation object, feed the polygons for your  outline and the holes into the tesselation object, then the tesselation object passes simple triangles to opengl.

This link has an example that is very similar to your situation.
This link shows one way to initialize the tesselation object.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy