Is it possible to use OpenGL purely with C instead of C++? I am wanting to make sure there won't be any problems with my using C and not C++. OpenGL does not depend on any C++ libraries right?
3 Answers
Yes, in fact OpenGL is a C library. You can perfectly use it with C.
-
3\$\begingroup\$ Note that the normative standard documents do not use the syntax of the C headers/bindings in the text, and explicitly says that implementations are free to use any kind of naming convention. OpenGL import libraries are probably in C due to historical reasons and due to that C is the language that FFI or interop functionality tends to consume. Technically, a vendor could deploy an OpenGL library in any language, but by convention the OS/vendor interface is the common C one. \$\endgroup\$ Aug 3, 2011 at 19:24
OpenGL can be used in C. Some libraries can't, though. For example if you want to use GLM you will have to use C++ instead of C.
OpenGL is a C library, which means that it's made with and for C, so of course it works with C. The reason why it also works with C++ is because C++ is actually nothing else than C with some things added so any C code is also valid in C++. So OpenGL uses C code which is also valid in C++, and it doesn't use anything that is specific for C++.
Written in: C
- I almost feel like saying UTSE, but that doesn't seem in the spirit of SE. \$\endgroup\$