Will opengl-4 program run on a machine with opengl version 2.1?

Hi,

Suppose I’ve written a program with opengl-4, compiling it i got out.exe or out. Now will it run on a machine where the opengl version is 2.1?

Vice versa:
Suppose I’ve written a program with opengl-2.1, compiling it i got out.exe or out. Now will it run on a machine where the opengl version is 4?

Any answer will be highly appreciated.

Thanks in advance.

[QUOTE=colagl;1282849]Hi,

Suppose I’ve written a program with opengl-4, compiling it i got out.exe or out. Now will it run on a machine where the opengl version is 2.1?

Vice versa:
Suppose I’ve written a program with opengl-2.1, compiling it i got out.exe or out. Now will it run on a machine where the opengl version is 4?

Any answer will be highly appreciated.

Thanks in advance.[/QUOTE]

The aswer is in the question…
2.1 OpenGL hardware cant run OpenGL 4 program…
OpenGL 2.1 program will run on OpenGL 4.x hardware…

No. If the program uses features which were added after 2.1, it won’t work on a system which only supports 2.1. In many cases it will be possible to make a program compatible with 2.1 by querying extensions and using either the extension or the core feature depending upon which is supported. In many (but not all) cases, the only difference is that the extension requires a suffix such as ARB or EXT on the function name.

Maybe. If the program uses any deprecated features, the system would need to support either 2.1 or the compatibility profile.

Note that it’s possible to support multiple OpenGL versions on the same system. E.g. Apple Mac systems typically support both OpenGL 2.1 and either OpenGL 3.3 or OpenGL 4.1 core profile.

In practice, a program which uses OpenGL 2.1 will typically work on any system supporting 2.1 or later. Systems supporting higher versions typically either support 2.1 or the compatibility profile or both, and use either 2.1 or the compatibility profile unless the program specifically requests otherwise.

Windows and Linux systems typically default to using the compatibility profile for the highest supported version, while Mac systems typically default to providing 2.1 (so if the program wants 3.3 or 4.1 it has to request it, and will be unable to use any deprecated features).

Are you hoping that if you transfer ‘out.exe’ to another computer, it will run by simply double-clicking on it? Because that’s a longshot. It definitely won’t work if the operating systems are different. You may even have problems transferring between different versions of the same O.S. Be prepared to recompile when rehosting in different environments.

[QUOTE=bob;1282850]The aswer is in the question…
2.1 OpenGL hardware cant run OpenGL 4 program…
OpenGL 2.1 program will run on OpenGL 4.x hardware…[/QUOTE]

So writing program with opengl-2.1 api looks good as it will run on a machine where the opengl version is 4.x. Right? But the opposite will not work.

Probably. Eventually you might start seeing systems which only support OpenGL 3/4 core profile, (or where support for legacy OpenGL is inferior in some regard), but that isn’t an issue at the moment.

Correct.