View Full Version : Implementing Clipping in opengl with C++

01-18-2015, 04:07 PM
Hi guys, I'm in the process of doing my first opengl assignment in my graphics class. I'm supposed to draw lines and polygons using glDrawPixels and after that implement clipping. I can't seem to figure it out, do you guys have any resources or anything to put me in the correct direction? I was thinking of having a temporary buffer using vectors to display the clipping window and the new polygon/line and then switching back to the original buffer when the user exits out of clipping.

Agent D
01-19-2015, 06:13 AM
What exactely do you mean by clipping? Do you mean near/far clipping? Do you want to apply custom clipping planes to geometry? Or are we talking about only rendering into a
specific area of the screen (you mentioned a clipping window)?

For the later, see glScissor (https://www.opengl.org/sdk/docs/man3/xhtml/glScissor.xml) and glEnable (https://www.opengl.org/sdk/docs/man3/xhtml/glEnable.xml)(GL_SCISSOR_TEST).