Chapter 4 covers the OpenGL state machine and graphics primitives. I really think that I am hitting the portion of this book where there just is no best order to explain stuff. Some times a topic involves enough different things that you have to understand a little about one thing so you can learn about a second subject which allows you to be taught more about the first subject. That seems to be the situation in Chapter 4.
Basically the state machine has hundreds of settings that affect how OpenGL renders. The chapter goes over how to query the state machine about the current value of many of these settings.
This is done with a set of functions (all return type void) that accept the name of the setting (type GLenum) and a pointer to an array to hold the information. The different functions just cover different data types (Bool, double, float, and int) that can be held in the array.
There is another query function glIsEnabled() that allows you to see if a flag is set or not on some of the settings.
The chapter doesn't go into much more detail than this on the state machine. I assume this is so we are familiar with it as more information is presented.
Drawing OpenGL primitives follows a fairly simple procedure:
Pass the primitive type to glBegin() (its a void return type)
Set the vertices of the primitive with the glVertex() function (void again)
End the shape with glEnd() (void)
The book does state that there is a limited number of functions that can be used inside the glBegin()/glEnd pair. Using another function will generate an error (I am assuming at compiling, need to test this).
One thing I am trying to look into is what happens if you specify a triangle but only give 2 vertices (or three that are co-linear). Obviously it cannot draw a triangle with this information. However with everything having return type void, how do I handle the error. Perhaps you just have to write error checking code for this one (to make sure they are not co-linear).
The book goes over points, lines, triangles, and quadrilaterals. It also touches on antialiasing, face culling, and edge hiding. I think these were presented more to just define what they are than to actual instruct in their use.
In other programming and 3D related news I have had some stuff come up at work. Just got the PhotoWorks stuff in for SolidWorks. For those of you not familiar with it SolidWorks is a 3D solid modelling design program and PhotoWorks is a fancy renderer for it that lets you apply better textures and lighting to your models. Should be fun to work with. Also it looks like I need to come up with some kind of application to handle a site survey tool we made in house that will (finally) go into use next month. I want to try to integrate the gauge with our total site survey process (can't go into more detail due to legal stuff) in one program. Our systems programmer (very busy lady) suggests that I look into XML to handle the data so some of that might make it into this journal over the next few weeks.
Edit: I went to see Bridge to Terabithia with my wife last night. I loved this book when I was a kid and the movie did a pretty good job with it.
I'm no OpenGL expert, but it is very doubtful that something like that could be caught as a compiler error, since the compiler cannot have any knowlegde of the foibles of a particular library.
More likely the compiler will cheerfully let you call any gl functions you want between glBegin() and glEnd() and any errors will occur at runtime and need to be explicitly tested for in your code, or avoided in the first place by the programmer.
On another note, you seem to be flying through topics at an extremely impressive rate based on your recent journal posts. Keep it up!