Jump to content
  • Advertisement

Archived

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

neonfaktory

OpenGL Object Clipping - Me or OpenGL?

This topic is 5659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I'm going to have tons of objects/particles, etc. in my game... and ALL of them must be accounted for. Now, as it stands, I am translating to all these objects and drawing them, regardless of whether they are on screen or not. For example, if the camera is at (0,0), and one of my objects is at (10000, 10000) (way off screen), I still tell it to translate to (10000, 10000) and call the display list. Now, is OpenGL going to clip that polygon automagically for me, or will I get a big performance boost if I test if the object is offscreen MYSELF, and then draw the object based on those tests? Thanks for any help you can provide [edited by - neonfaktory on December 25, 2002 9:10:13 PM]

Share this post


Link to post
Share on other sites
Advertisement
You will get a large boost if you test if the object are onscreen yourself. When i did that on the object and traingle level it doubled my frame rate. If you need to know how to do that then goto gametutorials.com and look for their frustum calling tutorial for opengl, and if thats still not a large enough boost, you might want to look into octrees.

Share this post


Link to post
Share on other sites
always let opengl do clipping
BUT i think u meant to say culling (not clipping)
in that case do gross culling yourself, if something is not on screen dont send it to opengl, for large scenes this will result in a large performance boost

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Ok... I was hoping I wouldnt have to do that, but there will be stuff WAYYY off screen alot of the time - like, not even close SOO, looks like I got some tutorials to read. Thanks for the suggestions

Share this post


Link to post
Share on other sites
you can use opengl to cull back faces.
glEnable(GL_CULL_FACE);
glCullFace(GL_CCW); //or CCW-counter clock wise

My Homepage
Everything is relative. Even stupidity.

Share this post


Link to post
Share on other sites
have a search for octree/quadtree etc

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
It''s actually a bunch of objects on the same 2D coordinate plane. You can move the camera around on that plane (X,Y) and also zoom in and out on the Z axis. I just wanted some simple test to determine if my objects are withing the viewing range or not... I could probably do it with a simple calc based on the FOV angle... couldn''t I? Or should I just go with the Culling EQs that you can find in most culling tuts? Thanks for the help so far

Share this post


Link to post
Share on other sites
Using a quadtree, you could keep track of all objects that are within a given cell of the quadtree, and if you can calculate that a given cell is not in the view at all, you can ignore all the objects inside the cell, which removes a lot of testing at the object level.

If a cell is in view, then you test all the objects in the cell (if you wish) or just submit them to OpenGL and let the API handle the culling.

Share this post


Link to post
Share on other sites
How does the API handle the culling, and how do you "let it"? Up till now I hanven''t concerned myself with culling/clipping, etc, so I haven''t done any of this before. Thanks again

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!