View Full Version : How to count objects I have...
09-17-2002, 11:47 AM
I want to do the following:
I have got an object, and then I use glClipPlane, and then I want to know how many objects have been created by that clipping (how many objects left on the scene).
How can I do that? Any direction to solution?
Thanks in Advance,
09-17-2002, 12:31 PM
Well, I have never used glClip plane before. I Simply create my own frustum culling routin. Then based on if my object passes or fails that routin, I set a bool value, that tells me what objects are visable, and what ones arent. My frustum routin is basicaly, pulling the 6 viewing frustum planes out of opengl, then testing to see if my object is infront of all of them. If it is, then its visable. (bool = true) if not, then it is not visable. I hope that help a little.
09-17-2002, 01:12 PM
Thanks for your reply, but I don't see now how it can help me, cause I am quite new in all this, and maybe did not understand your solution properly.
What I have is the following:
Some complex non-convex object, and then I need to cut it with plane. The object could be cut in such way, that there will be created several objects out of the first one. I just need to count how much objects are created.
09-17-2002, 01:33 PM
I think you'll have to do the math for that yourself. OpenGL doesn't provide any way to directly tell you how many pieces your object is cut into by a clip plane.
In fact, OpenGL knows nothing of your object as a whole at all. All it knows about is individual polygons, vertices, etc. And even then it retains no memory of those beyond their immediate usage except for what's been written to the depth buffer, color buffer, etc.
09-17-2002, 01:45 PM
Just hoped there is a way to do it using OpenGL, and not calculating by myself.
09-18-2002, 03:15 AM
take a look at www.gametutorials.com, (http://www.gametutorials.com,) there is a tutorial telling you how to do fustrum-culling ! very good site !
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.