Question

I'm interested in picking up OpenGL and I know that it is defined as cross-platform. Does this mean that I would type the code the same as I would on Windows, a Mac or Linux?

//example pseudocode to make a circle with a radius of 500 pixels and 5 pixels wide 
createCircle(500,5);

If it is typed the same does this mean that OpenGL has API sets stored for Windows and Mac and based on the platform the program is executed on it calls the appropriate one? If it is not, what is the process that goes on here?

Was it helpful?

Solution 2

OpenGL will display in the exact same way across platforms. It is also typed the same for each platform. Upon compile time, the API will select the correct platform-dependent code for the right platform to insert into the final executable.

OTHER TIPS

For the 3D drawing aspects, yes. But practically, unless there is a middleware being used, the APIs/usage necessary for a complete OpenGL application vary. Specifically in 3 areas,

1) OS dependency - The way the graphics gets rendered on the screen depends on the display drivers, and this makes the Graphics also dependent on OS. So you will use different APIs for creating the connection to the display adapter.

2) Window system dependency - Again dependent on the OS. For example on Linux, you can have Xorg, Wayland, or plain framebuffer etc. Depending on these, the way you create a surface for drawing changes

3) Platform specific extensions - Some high-performance extensions rely on specific OS behaviour, and are not cross platform. These take the form of GL_ARB, GL_OES etc.

From the official documentation: https://www.opengl.org/documentation/implementations/

Yes, it seems so. Its API bindings for most languages seem to be the same, for the most part. However, the behaviour for certain languages still might be different. You will have to look reference manual.

For a single language such as Java, Python, etc, which use interpreters like JVM. It should be same for any system, as that was part of the design decision.

OpenGL is not a library, it's a specification. The API is the same on all plattforms, but it adheres to the host OS's calling conventions and base types.

So the function void glPixelStorei(GLenum, GLint) is named the same on all plattforms, but GLenum and GLint exact types may depend on the target platform.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top