Jason McKesson avatar Jason McKesson committed 0c4cc0f

Clarification of Tut00 based on user feedback.

Comments (0)

Files changed (1)

Documents/Basics/Tutorial 00.xml

                 you would create it and access it like this:</para>
             <programlisting language="cpp">struct Object
 {
-    int anInteger;
-    float aFloat;
-    char *aString;
+    int count;
+    float opacity;
+    char *name;
 };
 
 //Create the storage for the object.
 Object newObject;
 
 //Put data into the object.
-newObject.anInteger = 5;
-newObject.aFloat = 0.4f;
-newObject.aString = "Some String";
+newObject.count = 5;
+newObject.opacity = 0.4f;
+newObject.name = "Some String";
 </programlisting>
             <para>In OpenGL, you would use an API that looks more like this:</para>
             <programlisting language="cpp">//Create the storage for the object
 
 //Put data into the object.
 glBindObject(GL_MODIFY, objectName);
-glObjectParameteri(GL_MODIFY, GL_OBJECT_AN_INTEGER, 5);
-glObjectParameterf(GL_MODIFY, GL_OBJECT_A_FLOAT, 0.4f);
-glObjectParameters(GL_MODIFY, GL_OBJECT_A_STRING, "Some String");</programlisting>
+glObjectParameteri(GL_MODIFY, GL_OBJECT_COUNT, 5);
+glObjectParameterf(GL_MODIFY, GL_OBJECT_OPACITY, 0.4f);
+glObjectParameters(GL_MODIFY, GL_OBJECT_NAME, "Some String");</programlisting>
             <para>None of these are actual OpenGL commands, of course. This is simply an example of
                 what the interface to such an object would look like.</para>
             <para>OpenGL owns the storage for all OpenGL objects. Because of this, the user can only
                 some have only one. In the above example, the fictitious target
                     <quote>GL_MODIFY</quote> is the location where <varname>objectName</varname> is
                 bound.</para>
-            <para>The functions that actually change values within the object are given a target
-                parameter, so that they could modify objects bound to different targets.</para>
+            <para>The enumerators <literal>GL_OBJECT_*</literal> all name fields in the object that
+                can be set. The <function>glObjectParameter</function> family of functions set
+                parameters within the object bound to the given target. Note that since OpenGL is a
+                C API, it has to name each of the differently typed variations differently. So there
+                is <function>glObjectParameteri</function> for integer parameters,
+                    <function>glObjectParameterf</function> for floating-point parameters, and so
+                forth.</para>
             <para>Note that all OpenGL objects are not as simple as this example, and the functions
                 that change object state do not all follow these naming conventions. Also, exactly
                 what it means to bind an object to the context is explained below.</para>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.