View Full Version : C++ bindings to OpenGL

01-28-2004, 07:16 PM
Hey there,
Newbie alert. I read everywhere that OpenGL has bindings C and C++, but I can't find any info on C++ bindings anywhere. A few people have asked similar questions on this forum but were told to either code in C or write their own wrappers. Well, if I have *no* other choice then I will do one those things, but I would prefer to use C++.
Thanks, Ben

01-29-2004, 01:13 AM
Um, so use it then?

You *can* use C libraries from C++ you know.

01-29-2004, 05:44 AM
OpenGL uses the extern "C" {} in the headers so the C api can be called from C++.

This is perfectly acceptable, you can call OpenGL from C or C++ with absolutely no difference. You don't have to code in C to use it.

Some people have created gl C++ classes that do things like gl.glVertex3f() etc etc, this is a COMPLETE waste of time IMHO, OpenGL is a low level API and these wrapper classes bring nothing to the party but could potentially get in the way in some cases.

Call the C API from C++, it just works.

If you're genuinely interested in a native C++ API then you should go for something that wraps OpenGL at a higher level with meaningful objects like OpenSceneGraph.

01-29-2004, 01:13 PM
Thanks to dorbie who actually did provide a useful answer. I had assumed that because all the doco states both c and c++ bindings are available that there was actually a c++ API. Now that I know there's not I can move on with my life and learn the C API.

> "Um, so use it then?"
Um, gee... like... thanks, bobbob. You put in some great effort there.

01-30-2004, 03:11 PM
Yeah, I just wanted to say that this is the OpenGL beginers forum. That means that people will usually be asking newbee/dumb questions. If you have an issue with that bobbob, try the advanced forum.