Archived

This topic is now archived and is closed to further replies.

NPComplete

Clipping with Lesson23?

Recommended Posts

I''m trying to mess with Lesson23 as I learn with it, and ive been trying to figure out a way to not print out to screen extra polygons that can not be seen at the time. Is there a quick and easy way of doing this with the framework of lesson23? Any suggestions would be *extremely* appreciated!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OK... Think about lines... You need to check whether or not a polygon is behind the player (if you simply check within the players view, you may miss some).
Lets take a view from above (literally!!).
A line uses the form y = m * x + b
Sound familiar?
So convert the player angle to a gradient ("m"), I''ve forgotten the math for this, sorry. But anyways... after doing that, position the line so that it passes through the player (using "b"). Now you can check each point of a polygon and if all points are behind the player, don''t draw it. You check by changing the "=" to a "<" or ">".
I haven''t really thought to much about what I''m writing, just trying to remember cos I''m in a hurry, sorry.

Share this post


Link to post
Share on other sites
actually, removing backface culling is just the START of culling. you too can add frustum culling. if you have the opengl superbible, they talk a little about this. but i''d also like to figure out how to do this. i think if you really wanna get fancy, (and fast) you have to look into BSP trees to organize all objects that can/can''t be rendered to the viewable region.

a2k

Share this post


Link to post
Share on other sites