Clipping with Lesson23?

Started by
5 comments, last by NPComplete 23 years, 5 months ago
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!
Advertisement
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.
hi,
i was too wondering the same. too bad haven''t have a clue. drawing all the polygons make it slow. Please if anyone has the compiled code for this, post it here.

Compliments,
The Demolition Squad
Compliments, The Demolition Squad
yo, there''s opengl functions for this. it''s just backface culling. just enable culling and call,
glCullFace(GL_BACK);

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
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
------------------General Equation, this is Private Function reporting for duty, sir!a2k
where do you call this function?

actually, where do you enable it, and where do you call the function?


Edited by - NPComplete on November 3, 2000 2:05:31 PM
yes, but for lesson 23, backface culling should be plenty.

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911

This topic is closed to new replies.

Advertisement