user2081738
user2081738

Reputation:

Getting the total video memory size

On the internet I have found that there are OpenGL extensions for AMD and NVIDIA to get the memory information of the graphics card. Now I'm trying to get the total video memory size but I'm always getting 0 as a result. This is the current version of my code:

#include <GL/gl.h>
#include <stdio.h>

int main()
{
    GLint total_memory;

    total_memory = 0;
    glGetIntegerv(0x9048, &total_memory);
    printf("%i\n", total_memory);
    return 0;
}

The operating system is Linux and the NVIDIA driver version is 313.30.

Upvotes: 0

Views: 1248

Answers (2)

Pierre Fourgeaud
Pierre Fourgeaud

Reputation: 14530

On this post you can see 3 links given by the author helping to get what you want.

It seems that it depends a lot of what kind of graphic card you use and the version...

https://gamedev.stackexchange.com/a/3347

Upvotes: 0

unwind
unwind

Reputation: 400129

You should always check with glGetError() if a call seems to be failing.

In your case, I think you need a valid OpenGL context before you can call OpenGL functions.

Upvotes: 2

Related Questions