GL objects
OpenGL objects work like any other language's objects, but the syntax is quite different. They work like this:
- Activate the object (bind)
- Modify/use object
- Deactivate (bind default)
Here's an example in C++:
struct Object { int count; float opacity; char *name; }; //Create the storage for the object. Object newObject; //Put data into the object. newObject.count = 5; newObject.opacity = 0.4f; newObject.name = "Some String"
Here's a similar example in OpenGL:
//Create the storage for the object GLuint objectName; glGenObject(1, &objectName); //Put data into the object glBindObject(GL_MODIFY, objectName); glObjectParameter(GL_MODIFY, GL_OBJECT_COUNT, 5); glObjectParameter(GL_MODIFY, GL_OBJECT_OPACITY, 0.4f); glObjectParameter(GL_MODIFY, GL_OBJECT_NAME, "Some String");The
objectName
is called the handle. It is like a pointer to the OpenGL state.