Displaying part of an Object existing outside the Viewport...

Started by
2 comments, last by Nercury 11 years, 1 month ago

I'm implementing the cohen clipping algorithm and in order to do this, I need to be able to show the parts of the line that are outside the viewport in a different colour. How is it possible to show objects that aren't within the viewport?

Cheers

Advertisement

Presumably this is some sort of homework assignment style task, because otherwise I don't understand the question since you don't normally need to clip lines yourself, and rendering stuff outside your viewport is generally not desired or possible.

So I believe that what you need to do is setup OpenGL as you normally would do, then create your own sub-viewport within that (e.g. half the width, half the height and centre it) which you can do your software clipping to. That way you can colour the lines inside the sub-viewport one colour, and outside the sub-viewport another colour and still be able to see them.

Just setup 2 camera's, do your culling based on one cameras frustum (or your method) and use the second camera as the viewing camera. that way you can move the second camera around and see the results better. Does this make sense?

Cheers

Lee

Code is Life
C/C++, ObjC Programmer, 3D Artist, Media Production

Website : www.leestripp.com
Skype : lee.stripp@bigpond.com
Gmail : leestripp@gmail.com

So I believe that what you need to do is setup OpenGL as you normally would do, then create your own sub-viewport within that (e.g. half the width, half the height and centre it) which you can do your software clipping to. That way you can colour the lines inside the sub-viewport one colour, and outside the sub-viewport another colour and still be able to see them.

You can also clip the viewport with glScissor, I think it will make it easier because with smaller viewport the FOV would need to be adjusted to match larger viewport.

This topic is closed to new replies.

Advertisement