How to determine a version number?

I googled, and found something like this:

char *p;

p = (char *)glGetString(GL_VERSION);
if (p == NULL) {
    printf("none");
    return;
};

printf(".%3c.

", p);

Unfortunatley, p is always NULL. Any idea why?

You need a valid and working context for this to work.

EDIT: didn’t noticed it: %s should be best in your printf.

A bit off-topic: any ideas how I can get graphic driver version in run-time?

More exactly, a Linux application needs to determine the following two things:

  1. It deals with a NVIDIA card
  2. It deals with a particular NVIDIA driver version.

A minor detail :slight_smile: - this should be done before a rendering context is created - thus I cannot rely on the all-mighty glGetString().

Thanks in advance!

create a context from a temporary window.

The problem is that there is no way to know what driver will be used until you have a context because the type of context requested might depend on a specific driver or might have to fall back on software rendering.

Mikael