LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Cornix on August 13, 2013, 10:53:34

Title: Query video card memory
Post by: Cornix on August 13, 2013, 10:53:34
Hi,
for testing purposes I woud like to get the current available video card memory. I want to find out which way to set up my rendering and I want to keep the used memory not too high.
I googled this topic before and found the following:
http://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/

So I tried using this in lwjgl and came up with this:

public static int get_video_card_memory() {
while (get_error() != null); // If previous errors have not been called yet!
int nvidia_total_memory = GL11.glGetInteger(NVXGpuMemoryInfo.GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX);
System.out.println(get_error());
int ati_total_memory = GL11.glGetInteger(ATIMeminfo.GL_VBO_FREE_MEMORY_ATI);
System.out.println(get_error());
return Math.max(nvidia_total_memory, ati_total_memory);
}

But I get 2 "invalid enum" errors. As it seems neither method works for me.
I use an ATI HD Radeon 57XX.

Did I do this wrong? Help is greatly appreciated!
Title: Re: Query video card memory
Post by: spasi on August 13, 2013, 11:10:18
You should check if the corresponding extension is available before making such queries.

ATI_meminfo is not exposed on my Radeon either, I think it's only available on workstation GPUs (the FirePro line).