Help end child hunger
Dec 052011

Shaders are the core of the rendering process. OpenGL core profile requires us to provide our own shaders, no more fixed function.

Using shaders means more flexibility, but it also implies more work. This is where this lib steps in.

VSShaderLib was designed to make our life easier. It allows to create programs, load shaders from files, associate vertex attribute names with locations, and work with uniforms, including uniforms in named blocks. It also provides access to the info logs.

Nov 072011

I don’t know where to put this. I’ve tried the AMD forum but got no reply. So here goes:

I’ve only tested this on Windows 7 64 bits. Anyone with different/same results on same or other systems?

 – ARB Debug Output Extension

When not in debug mode the following instruction causes an Access Violation in Visual Studio:


This only occurs when not in Debug OpenGL context  and it does not cause any problem with nVidia hardware.

I’ve not tried it with Linux yet.


– Uniform Buffers

Consider a uniform block declared as follows:

layout (std140) uniform Matrices {

	mat4 modelviewMatrix;
	mat4 projModelViewMatrix;
	mat3 normalMatrix[2];

This is what I get when I use glGetActiveUniformsiv to retrieve info on the block:

Matrices, Binding: 2 Datasize: 320 ActiveUniforms: 3
Referenced by: TessEval  Shader(s)
modelviewMatrix 1 16 mat4 0
normalMatrix 2 16 mat3 128
projModelViewMatrix 1 16 mat4 64

The data for each uniform is size, matrix stride, type and offset.

My problem lies with the size of the buffer. AMD’s driver claims, as shown above, that the size is 320, but in reality it is 224 (nVidia reports the right value), considering the reported matrix stride of 16. The math is pretty simple:

16×4 = 64 bytes for each 4×4 matrix times 2 = 128

16×3 = 48 bytes for each 3×3 matrix times 2 = 96

Total = 128 + 96 = 224.

Strangely enough,  if I define the normalMatrix as an array with 3 mat3 (so one more than previously), I get a reported data size of 464.

I’ve tested several possibilities to set one of the mat3 without success. With nVidia it works OK . The only difference in the information reported, besides the data size, is the name of the normalMatrix uniform, that nVidia chooses to call it normalMatrix[0].


– Querying the primitive counter

I always get zero! Again works nicely in nVidia.

Jun 292011

gDEBugger, by graphicRemedy, was a very powerful standalone tool (still available in here) for debugging OpenGL and OpenCL. It could tell you all about your VBOs, textures, uniform values, show stats on function calls, show deprecated usage function, you name it.

Now its back! This time it works inside Visual Studio 2010. It basically performs the same functions as before, but integrated in the programming environment of VS 2010.

The new AMD version is available in here.

Jun 232011

Debugging is something we all do. It is one of those things we can’t escape…

Tools like Visual Studio are very powerful for debugging purposes and provide lots of debug options and information. However most of us don’t master these tools properly. If this is the case then you might want to take a look at this tutorial by Abhijit Jana.

Jun 192011

Some freely available books, some out of print, some still available in online stores, others in plain HTML.

Thinking in C++ 2nd Edition (2 Volumes) by Bruce Eckel – This is probably the most famous one. There is also a printed version on sale.

An Introduction to GCC, by Richard M. Stallman – A GNU C and C++ manual for those who want ot get started with the GNU compilers, gcc and g++.

Nectarine City Handbook of C Programming Style by Joseph Miklojcik – A book on writing clear code.

The C Book by Mike Banahanm Declan Brady and Mark Doran – The online version of “The C Book”, published by Addison Wesley in 1991 (no longer in print)

Introduction to C Programming by Rob Miles – A online introductory C book.

C Elements of Style by Steve Oualline – Building good programming style

C++ Annotations by Frank B. Broken – Moving from C to C++

 Tagged with:
Jun 162011

The Kinect for Windows SDK beta is a programming toolkit for application developers. It enables the academic and enthusiast communities easy access to the capabilities offered by the Microsoft Kinect device connected to computers running the Windows 7 operating system.

The Kinect for Windows SDK beta includes drivers, rich APIs for raw sensor streams and human motion tracking, installation documents, and resource materials. It provides Kinect capabilities to developers who build applications with C++, C#, or Visual Basic by using Microsoft Visual Studio 2010.