Link to home
Start Free TrialLog in
Avatar of ustechdata
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
Avatar of NovaDenizen
NovaDenizen

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.
http://www.xfree86.org/current/gluTessVertex.3.html
This link shows one way to initialize the tesselation object.
http://www.xfree86.org/current/gluTessCallback.3.html
ASKER CERTIFIED SOLUTION
Avatar of NovaDenizen
NovaDenizen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial