Help end child hunger

One of the features that was not selected to be part of the core functionality was matrix handling. Previously we had OpenGL and GLU functions that provided the means for easily setting the camera, defining projections, and performing geometric transformations on graphical objects.

The Very Simple Matrix Library (VSML) aims at providing users with a functionality similar to the one available up to OpenGL 3.2. I’ve been using OpenGL for a long time and those matrix handling functions served most of my purposes when programming graphics, hence I grew fond of them. I missed them in the new OpenGL versions so I decided to write a simple lib to perform the same tasks in a very similar way.

Learning Modern 3D Graphics Programming is almost an online book on core OpenGL. It covers a lot of ground, from drawing a triangle to HDR. The index promises a continuation onto texturing, render targets, and advanced lighting.

Chapter 3 from OpenGLBook.com is now available. The new chapter covers index buffers and primitive types. Source code compatible with OpenGL 3.3 is provided.

ShaderGen is an old tool from 3D labs, but its usefulness is not gone. The tool creates shaders that mimic the results of a set of fixed function state. There is a large set of options to define a state as available in OpenGL compatibility mode. Lighting, Fog, and all the other features that are gone in core profiles. Select the options you desire, check the result with fixed functionality, and then press “generate”. The tool creates the shaders that emulate those fixed function features. It only produces GLSL 1.2 code, but conversion shouldn’t be an issue.

The Lighthouse3D OpenGL View Frustum Culling Tutorial has been ported to the new site. Bug reports and suggestions are most welcome.

This is an OpenGL 3.3 + GLSL 3.3 sample that loads and displays a 3D model with Assimp. It also uses DevIL in case the model has textures. It was based on Assimps OpenGL demo and it extends it to support OpenGL 3.3

The sample uses Texturing, Vertex Array Objects, and Uniform Blocks. Camera can move around the object using the mouse, and the mousewheel can be used to zoom on the model, courtesy of freeglut.

The OpenGLBook site released chapter 2. This chapter covers how to draw simple geometry using vertex buffer objects.

When we call a function from the OpenGL API we may be calling it incorrectly, and this is what glGetError is good for. “Incorrectly” can mean several things, for instance, the parameters are not in a valid range, or a function is being called without a proper context.

Every time an error is detected a flag is set and a numeric code is recorded. Any errors afterwards won’t be recorded so we need to make sure we check for errors at the most significant points in your application.

This page describes in detail the behaviour of glGetError.

 

GLUT was conceived by Mark Kilgard with the goal of providing a simple, yet powerful enough, toolkit to deal with the intricacies of the windowing system when building OpenGL applications. In my opinion GLUT was a very effective solution and completely fits the bill. As far as I know, GLUT is still the simplest toolkit around and yet it does most of what is needed for simple prototypes.

GLUT however is not free of criticism. Complaints about the lack of control on the event loop are abundant on the web and some extra functionality, context creation and multisampling, would be most welcome.

GLUT is not open source hence it could not be modified, so GLUT clones have appeared. These kept the API (all gluts functions are usually implemented exactly with the same name) but improved and extended it to address the above mentioned issues.

There are open source versions of GLUT, such as freeGLUT and OpenGLUT. They all kept the API so 99.9% of what will be presented in this tutorial is still valid. Nonetheless these new versions do have some extensions that make it worth a try. Check out the extensions in freeGLUT  here.

When working with the newest OpenGL functionality most of us rely on third party libs to make the functions available to us. Some examples of these third party libs are GLEW and GLEE.

These libs do a wonderful job and most of the time they save us a lot of work. However, sometimes strange things happen. Consider an application that has requested an OpenGL context version 3.3, with the core profile, using GLEW version 1.5.8.

When calling

GLuint k = glGetUniformBlockIndex(p,"Matrices");

The application crashes with an Unhandled exception. The reason is that glGetUniformBlockIndex has not been loaded in GLEW.

According to GLEW documentation:

GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported.

I would expect not to have this issue since I’m using the latest release drivers from nVidia, which clearly state that they support OpenGL 3.3 on my GPU.

Anyway, fortunately GLEW documentation also tells us how to solve the problem:

To circumvent this situation, the glewExperimental global switch can be turned on by setting it to GL_TRUE before calling glewInit(), which ensures that all extensions with valid entry points will be exposed.

Basically, instead of calling only glewInit() just write:

glewExperimental= GL_TRUE;
glewInit();

And that should solve it :-)

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha