Jump to content
  • Advertisement


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


Where does the stuff go?

This topic is 6108 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

If I create something, like a laser, and shoot it and it goes offscreen, where does it go? I mean, do I just move it infinitely along the __ axis hoping opengl forgets about it? I dont understand this: How can I ''erase'' data from OpenGL? If I create a box that alpha-fades out, do I just forget about it or what? I dont want it to come back, but what happens? Do I need to free up memory or something? Do you know what I am talking about? How do I make OpenGL stop drawing something is probably the question here...

Share this post

Link to post
Share on other sites
If you stop drawing it, it will stop appearing. Higher level stuff has to do with your code, not with OpenGL.

For example: let''s say you have a list full of those laser shots that need drawing. Every now and then we test them to see if they still exist, and if one doesn''t, we remove it from the list. However, every frame we simply draw each and every laser shot in that list (ignoring culling, et cetera). In other words (to reiterate): the drawing of the shots and the storing of the shots are seperate.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post

Link to post
Share on other sites
I am not a OpenGL coder, but that little laser could be doing two things.. being auto clipped if you have that enabled.. or if you didn''t it could be dangerously writing into memory locations that you do not want it to be.

You need to encapsulate your polygons, sprites, or whatever into objects that can be allocated and freed from memory. You do not want 50,000 objects with alpha on.. just to make them invisible to the person playing. That wastes CPU cycles.
I have a 900MHz computer.. which should run fine, but what about the poor gamer with a 233MHz machine.. it will be choppy.

You do not want OpenGL to stop drawing, but to stop drawing your polygoned object.

Share this post

Link to post
Share on other sites
Here is a little insight on the objects one can''t see.

Any objects that is too far to be seen or behind the camera is a object you don''t see but still exists. Still exists in memory and for OpenGL.
That is each frame, if you send it to the pipeline, OpenGL will check if it is anywhere in your furstrum and draw it if it is.

OpenGL won''t do something you don''t ask it to do.

And for the "faded out" box, same story. If you still send it to the pipeline, it will still check if it should show it or not.

Checking if it should be draw eat up a lot of your resources and there for will slow down you fps.

Now once a Laser is too far or your box is completely faded out, you should stop sending it to the OpenGL pipeline and you should remove it from memory if you won''t use it again.

How do to this... Well, a simple way is to have a linked list of object that you want to exist. Then if an object is not used anymore, you remove it from the linked list.

One more thing, you don''t send an object to opengl and then it exist for ever. You create a "interactive" movie frame by frame. If you don''t want an object to show (erase it) you stop sending it to opengl. (anything between a glBegin(); and glEnd() will be sent to the pipeline whether it is seen or not)

You probably might want to look into Vertex Array object to do this.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!