Jump to content


obtaining available video memory in opengl


10 replies to this topic

#1 yapaa237

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 October 2005 - 08:37 AM

Does anyone know how to fetch video memory available in opengl ?

Any idea is welcomed :-)



Cheers!.

#2 galdor

    New Member

  • Members
  • Pip
  • 2 posts

Posted 06 October 2005 - 09:04 AM

Don't think you can do it with native OpenGL instructions, but you can use instructions of your context manager.
I use SDL and have access to this.
War is an extension of politic, by other means
[INDENT]Von Clausewitz[/INDENT]

#3 yapaa237

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 October 2005 - 09:47 AM

You're right, also i thought about doing different tests. But it seems that, the video memory is managed by the drivers. There must be a a way to find the result like in "Doom3", i don't know how.

I already tried SDL :-).

Cheers.

#4 Ed Mack

    Senior Member

  • Members
  • PipPipPipPip
  • 1239 posts

Posted 06 October 2005 - 04:48 PM

I've wondered about this too, it sure would be handy for managing resources. I looked through the extensions, but nothing caught my eye.

#5 yapaa237

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 October 2005 - 07:30 AM

How about vbo in glext ?

Does it really allocate in video memory ?

#6 NomadRock

    Senior Member

  • Members
  • PipPipPipPip
  • 785 posts

Posted 07 October 2005 - 07:33 AM

There is one way. You can try to make a texture with the pixel buffer argument NULL, then the driver is supposed to simply see if a texture of that size can fit but not actually make one. If it cant fit, then the width is set to 0 and you can check that.

This doesnt give you a number in MB, but it does let you check to see if something will fit before you push it in. Also, you could keep testing different sizes until you narrow down on an approximation.
Jesse Coyle

#7 yapaa237

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 October 2005 - 09:48 AM

With wich function do you do that ?

Do you mean the function will modify the width value ?
It sounds wired.

#8 corey

    Member

  • Members
  • PipPip
  • 78 posts

Posted 07 October 2005 - 08:11 PM

NomadRock said:

There is one way. You can try to make a texture with the pixel buffer argument NULL, then the driver is supposed to simply see if a texture of that size can fit but not actually make one. If it cant fit, then the width is set to 0 and you can check that.
Are you saying that it will return an error that would occur if width was 0 even though the function was called correctly?

corey

#9 NomadRock

    Senior Member

  • Members
  • PipPipPipPip
  • 785 posts

Posted 07 October 2005 - 09:42 PM

There is apparently another way to do it with specifying a different target, but the technique is the same. Read up on the specification at http://www.opengl.or...teximage2d.html

The relavent section, I post below

Quote

If target is GL_PROXY_TEXTURE_2D, no data is read from
pixels, but all of the texture image state is recalculated,
implementation's capabilities. If the implementation cannot
handle a texture of the requested texture size, it sets all
of the image state to 0, but does not generate an error (see
glGetError). To query for an entire mipmap array, use an
image array level greater than or equal to 1.

Jesse Coyle

#10 corey

    Member

  • Members
  • PipPip
  • 78 posts

Posted 07 October 2005 - 10:05 PM

Oh, well that's interesting. I'd typically skipped over the target parameters!

I suppose the non-erroring result would be checked with glGetTexLevelParameter?

corey

#11 NomadRock

    Senior Member

  • Members
  • PipPipPipPip
  • 785 posts

Posted 08 October 2005 - 12:16 AM

No, it wont error. It will just set your width parameter to 0. and you can check that with the get value functions. But this new documentation I found says you just check the image state as long as you set your target to GL_PROXY_TEXTURE_2D.
Jesse Coyle





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users