3D programming is great, but when something goes wrong, it can be quite hard to debug!

I was trying to launch two different OpenGL programs one after another, the first for the normal rendering, the second for a post-processing effect (motion blur, etc.). It seemed the first program's output was cleared as soon as the second one was activated.

I eventually found a behavior that is well summed up at http://www.gamedev.net/topic/541571-glsl-changing-between-shaders/page__view__findpost__p__4495411.

You don't write:

glUseProgram( shader-A );
modelA->Draw();
glUseProgram( shader-B );
modelB->Draw();
glutSwapBuffers();

You write:

modelA->Draw();
glUseProgram( shader-B );
modelB->Draw();
glUseProgram( shader-A );
glutSwapBuffers();

and since the code is called multiple times (at each frame), this will cycle OK. (There seem to be an GL_INVALID_OPERATION error the very first time I call glUseProgram, too.)

Anybody has an idea on why we have this behavior?

Posted Sat Oct 1 21:45:13 2011 Tags:

phong

The basic smooth lithting series comes to an end with adaptation of 2-sided lighting and multiple lamps support.

The code is written for clarity, so it could be optimized. If you have a lightning-fast lighting implementation under the hand, feel free to contribute it :)

phong

On a side note, I'm looking for a way to draw quadrics in OpenGL ES 2.0, so without using the GLU library. Do you know how to do this?

Posted Sun Oct 2 11:42:58 2011 Tags:

Arcball is a conceptual sphere that users of your application can manipulate to rotate objects with the mouse.

Read this new OpenGL wikibook tutorial!

http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Arcball

Posted Tue Oct 4 18:58:12 2011 Tags:

Mexican Hat

Guus strikes back with a new Scientific tutorial in the Free OpenGL wikibook. It deals with tracing the Mexican Hat 3D function using surfaces, removing hidden ones, and also shows how to avoid visual artifacts when adding grid lines.

http://en.wikibooks.org/wiki/OpenGL_Programming/Scientific_OpenGL_Tutorial_05

Posted Sat Oct 8 14:23:10 2011 Tags:

Here's a new OpenGL wikibook tutorial to make your own video by capturing the OpenGL calls and replaying them later - using apitrace!

http://en.wikibooks.org/wiki/OpenGL_Programming/Video_Capture

The following video is a sample capture with a wave-like post-processing effect I'm working on:

Posted Tue Oct 11 21:56:30 2011 Tags:

Wave effect

Manipulating meshes and lights is nice, but sometimes we want to manipulate the good old pixels, in particular for post-processing effects such as blur.

But how can we do that in OpenGL? In this new OpenGL wikibook tutorial, we'll explore a solution: render to a texture through a framebuffer object!

http://en.wikibooks.org/wiki/OpenGL_Programming/Post-Processing

For our first effect, we'll implement the wave system previewed a few days ago in the video capture tutorial.

Posted Sat Oct 15 18:07:14 2011 Tags:

Quickie OpenGL wikibook tutorial to show how to display a bounding box around your object :)

http://en.wikibooks.org/wiki/OpenGL_Programming/Bounding_box

Posted Thu Oct 20 22:01:07 2011 Tags:

Valve's Portal game introduced an innovative teleporter system - where you basically can see through the teleporter and even walk seamlessly through it.

Ever wondered how this is implemented? Check this Mini-Portal demo, along with its companion tutorials!

http://en.wikibooks.org/wiki/OpenGL_Programming/Mini-Portal

In this first part, we cover a basic working version that we will improve over the next few days.

[Find more tutorials at the OpenGL wikibook.]

Posted Sun Oct 23 16:24:21 2011 Tags: