-4
\$\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\$
4
  • \$\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\$ Aug 3, 2011 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\$ Aug 3, 2011 at 11:28
  • \$\begingroup\$ The research effort was spent looking at C++ tutorials and seeing none for C. \$\endgroup\$ Aug 3, 2011 at 15:10
  • \$\begingroup\$ possible duplicate of Do I need to learn C++ to use Open GL? \$\endgroup\$
    – user744
    Aug 4, 2011 at 8:11

3 Answers 3

11
\$\begingroup\$

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

\$\endgroup\$
1
  • 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
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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .