Sign in to follow this  
intenseza

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

Recommended Posts

intenseza    119

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

Share this post


Link to post
Share on other sites
C0lumbo    4411

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.

Share this post


Link to post
Share on other sites
mixmaster    373

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?

Share this post


Link to post
Share on other sites
Nercury    812

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.

Edited by Nercury

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this