-5
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ en.wikipedia.org/wiki/OpenGL, Written in: C - I almost feel like saying UTSE, but that doesn't seem in the spirit of SE. \$\endgroup\$ – deceleratedcaviar Aug 3 '11 at 7:03
  • 2
    \$\begingroup\$ @Daniel It might be in the spirit of SE when the downvote button says "This question does not show any research effort" on the alt-text. \$\endgroup\$ – doppelgreener Aug 3 '11 at 11:28
  • \$\begingroup\$ The research effort was spent looking at C++ tutorials and seeing none for C. \$\endgroup\$ – Storm Kiernan Aug 3 '11 at 15:10
  • \$\begingroup\$ possible duplicate of Do I need to learn C++ to use Open GL? \$\endgroup\$ – user744 Aug 4 '11 at 8:11
11
\$\begingroup\$

Yes, in fact OpenGL is a C library. You can perfectly use it with C.

\$\endgroup\$
  • 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\$ – Lars Viklund Aug 3 '11 at 19:24
0
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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++.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.