## Poll: C++ and GLM Support

Over the course of the last few months, I have received numerous emails and bug reports from people trying to compile the sample code as C++ code. So many, in fact, that I’m starting to think that the site may actually benefit from C++ code samples instead of C code samples.

To get a good idea of the consensus of C++ vs C in this case, I’ve opened up a little poll. Please take a second or so to select an option from the list and vote, I’d really like to hear your opinion on this. Also, if you have a comment on this, please post it as well.

Posted in Other Things | Tagged , , , | 19 Comments

## Unable to create OpenGL 4.0 context (flags m, profile n)

If you’re getting the message Unable to create OpenGL 4.0 context (flags m, profile n) when creating your context (where m and n are numbers) your hardware does not support OpenGL 4.0.

Sadly, this is not something you can fix without upgrading your hardware. As mentioned in the Preface, the minimum graphics hardware you need for an OpenGL 4.0 context is:

• If you own an NVIDIA GPU, it must at least be in the Fermi family of products, starting with the GeForce GTX 400 series.
• If you own an AMD/ATI GPU, it must at least be in the Radeon HD 5000 series.

It is possible to run many of the samples using OpenGL 3.3 by using the code files found in the “OpenGL 3.3″ directories of each chapters’ source code listings. However, OpenGL 4.0+ core features will not work in OpenGL 3.3.

Posted in Information | Tagged , | 5 Comments

## Setting up OpenGL, GLEW, and FreeGLUT in Visual C++

This post walks you through setting up OpenGL, GLEW, and FreeGLUT support in Visual C++ in order to compile the samples properly. My original thought was to put this in an appendix after all of the chapters were completed, but there’s need for it now, so here’s the extremely verbose step-by-step explanation:

Posted in Information | Tagged , , , | 12 Comments

## GLSL Input Layout Qualifier Bug on AMD Hardware

An issue was brought up yesterday concerning a bug in Chapter 2. If you change the layout input layout qualifiers in your GLSL shaders from that chapter to the following:

layout(location=18) in vec4 in_Position;
layout(location=1) in vec4 in_Color;


And update the calls to glVertexAttribPointer and glEnableVertexAttribArray accordingly, you will see nothing but a black screen on AMD hardware.

It turns out that this is a known bug, and someone on the OpenGL forums encountered this last year, so this bug has existed for a while.

After contacting OpenGL bug-basher extraordinaire Christophe Riccio (who runs a great site at G-Truc.net), he informed me that the only way to get this to work on AMD is to assign location 0, meaning that the following works:

layout(location=18) in vec4 in_Position;
layout(location=0) in vec4 in_Color;


So keep in mind when writing your programs to always occupy location 0 for something.

Posted in Information | Tagged , , , | 2 Comments

## Chapter 4: Entering the Third Dimension Released

I’m happy to inform you that “Chapter 4: Entering the Third Dimension” is now available online by clicking on this link.

Let me know if you have any issues, bugs, errors, or simply wish to yell at me. Happy reading.

Posted in Announcements | Tagged , | 28 Comments

## Now at Google Project Hosting

After a few requests for the Visual Studio Solution, I’ve moved the source code over from my self-hosted solution to a Google Project Hosting solution. In the process, I’ve also Open Sourced the source code (not the chapters or the site, just the code) under the MIT license, a very permissive Open Source license that allows you to use the code for any purpose you want.

The project itself is a Visual Studio 2010 solution containing individual projects for each of the chapters. If you have Subversion, you can check out the entire project, or if you’d like to view the files in your browser, you can do so here much better than I could implement on this site. Note that even though the project is a Visual Studio solution, the source can be compiled on many platforms.

openglbook-samples project @ Google Project Hosting

## Chapter 4 Preview

It’s been a little while since the last update, but work on Chapter 4 is finally reaching a conclusion. In this chapter, we’ll make our first steps into the third dimension and introduce a bit of required mathematics.

If you haven’t read the previous chapters yet, I highly recommend you doing so before continuing with this chapter since you’ll need to understand all of the previous concepts.

Keep an eye out for this chapter in the near future!

## glGenVertexArrays Access Violation/segfault with GLEW

If you’ve been copying the code from the chapters, you may run into trouble when your program hits the glGenVertexArrays function in the form of an Access Violation/segfault.

To fix this, add the following statement right above your call to glewInit:

glewExperimental = GL_TRUE;

There seems to be some trouble with GLEW not entirely supporting the Core Profile out of the box, but the above fix should get you by for the time being.

Posted in Information | Tagged , , | 7 Comments

## Chapter 3: Index Buffer Objects and Primitive Types Released

I’m happy to inform you that “Chapter 3: Index Buffer Objects and Primitive Types” is now available online by clicking on this link.

Many thanks go out to Christian Rau and Phi Hung Nguyen for reviewing the chapter before it was released. Let me know if you have any issues, bugs, errors, or simply wish to yell at me. Happy reading.

Posted in Announcements | Tagged , | 20 Comments

## Wanted: Technical Reviewer

In an effort to minimize the amount of bugs introduced, I am looking for someone to review the chapters and code before I release them into the wild.

This person needs to be an experienced OpenGL programmer who’s no stranger to modern OpenGL (3.0+) concepts and techniques.

Please note that since OpenGLBook.com is a free resource there is little to none in terms of monetary compensation, but I’m willing to negotiate any terms or suggestions you may have (credits etc.?). Let me know if you’re interested or if you have any questions by shooting me an email at: eddyluten@gmail.com