View Full Version : Is it true that both Opengl and Opengl-based applications use STL?
06-18-2006, 02:57 AM
I have been programing using vc+opengl for years. Now I want to modify my c++ program using STL, since STL has been widely available.
However, there are a lot of problems, such as redefining the data structures,modifying the parameters of functions,converting int* p with vector <int*>, and so on.
It is neccessary to spare much time to do so.
Is it true that we have to implement the conversion from tradition programs like int*p and p to STL like vector and list?
Is it true that both Opengl and Opengl-based applications use STL?
06-18-2006, 03:35 AM
No, it's not true.
STL is just a library. It makes many tasks simpler by providing containers, standard algorithms, and so on, but noone is forcing you to use it.
OpenGL is based on C, not C++. You can use STL with it, but you can also write plain C++ or even plain C code if you like.
C++ was mainly made for making things easier, mainly for gaining productivity. So if you have to loose time in doing the wheel again, I'm not sure if it would worth to do so.
06-18-2006, 09:56 PM
Are there large systems, in particular, commercial systems, developed by C++ STL?
06-19-2006, 12:31 AM
I mean STL is mainly used in small programs now. Is it developed in large software projects, or applications based on opengl.
Is STL easy to convert with tradition algorithms?
06-19-2006, 02:30 AM
There will be thousands of graphics application that mix Standard C++'s containers and alogirithms with OpenGL.
If you want just one example look at the source code of http://www.openscenegraph.org, as it extensively uses the C++ Standard Library. It isn't commericial, but its used heavily by commericial application developers...
Of course there are large scaled C++ programs developped with STL. STL was not made for a decoration or to make people hesitate between java and C++.
06-21-2006, 02:41 AM
STL is just a bunch of C++ code that implements standard data structures & methods for stuff like lists and iterators. It's template based to make the implementation applicable to all sorts of types & classes. Your classes will typically have to support appropriate operators for the methods you want to use to make it workable though.
STL has nothing to do with OpenGL which is a C API but also callable by C++, that's not a problem because it's clear that the state based command stream nature of the OpenGL hardware interface does not need OO until you're programming at a fundamentally higher level like a scene graph. In other words, OpenGL exposes an interface that is low level and compatible with hardware. Applications use higher level concepts but that doesn't need to be pushed down into an API like OpenGL.
Some OpenGL applications use STL but not all of them, not even most of them.
Robert Osfield's Open Scene Graph is an example of a higher level Object Oriented C++ API that is implemented making extensive use of STL.
The use of STL is really to make C++ development more productive, there should be no problem storing & using OpenGL compatible data structures in the classes you manipulate with STL.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.