how can I know how much the video memory my program used

my program use a large of video memory,but I don’t the accurate size,so does anyone can tell me how to calculate the video memory my program used?Because I need the parameter to optimize my program,thanks!

I believe that the correct answer is “OpenGL won’t tell you”.

OpenGL won’t tell you that, but if you mostly use objects whose size is known to you, then why not count the consumption by yourself?
If you for example only use textures and VBOs, then it should be very easy to calculate the rough amount of VRAM that your app consumes, and that’s the only way. But as soon as you use displaylists it get’s harder, as there is no real formula for getting how much VRAM a DL needs.

Does this really matter?

-SirKnight

Does this really matter?
Yes. Some of us care about performance.

Too many textures/VBO’s == texture/VBO thrashing == low performance == bad.

I prefer the estimation approach. Just make assumptions about how much VRAM textures are going to take up by counting bytes. Add 10% to this, plus the size of the framebuffers, and you have a pretty decent estimate to the minimum VRAM that will run your game well.

You can find out with DirectDraw.

Yes. Some of us care about performance.

Wake up on the wrong side of the bed or something? Jeeze. I was just curious why this mattered.

You could have phrased that a different way that didn’t insult me buddy. I’m sorry that I’m not as much of a genius as you.

-SirKnight

You were curious? Wasn’t the answer obvious? But you decided to post your inane question anyway? This really is just a chat room for you, isn’t it sirknight? Somewhere where you can say the first thing that comes into your head…

This morning I had a coffee, and then I went to work. In France the weather is great, I’ll probably take my first attempt at surfing tommorrow.

I wonder how I could get that in an OpenGL app, that could run quite smoothly if I don’t consume all my videomemory.

And maybe a 3D graph modelling knackered brain could be an interesting stuff too. With a lot of polyline quadstripped lighting bolts, and some blur effect on some parts.

Ho … but blur effect needs an offscreen rendering, maybe I should think to add this to my VRAM consumption estimation.

SeskaPeel.

You might get away with using the backbuffer for the blur, that way you don’t need the extra memory. Unless you were going to render directly to the front buffer. I guess for knack’s brain anything chaotic would do, but it propably would cause problems when rendering France.

-Ilkka