Collada Loader Part 1

Recently I’ve decided to use Collada as the main file format to import animated models in my simple 3D engine.
Why I decided to go with Collada? Two words: skeletal animations and tools!!!
Almost any 3D software has a Collada exporter!
The biggest problem when you have to parse Collada files, it’s how Collada organizes indices. Instead of returning a single index array, it gives you 3 different index arrays: one for vertices, one for normals and one for texture coordinates. And it’s a pain because OpenGL only accepts a single index array for all of the three!
Some people have overcome this issue by using an utility called Collada Refinery which has a “deindexer”: it takes a Collada files and it returns a new one with only one index array for vertex/normals/texture coordinates.
But because I’m a lucky guy, this utility doesn’t work on my PC 😀 So I’ve had to figure out how to reorganize indices.
Finally, last night I’ve found the solution and I was the happiest guy in the world 😀
Here’s a quick video of the loader in action, thanks for watching!

Advertisements

OpenGL 4.0 Core Test: No more fixed funtion pipeline?

Here is a quick test of OpenGL 4.0 I’ve done to test the “new” way of OpenGL.
As you may know, since OpenGL 3.1 the fixed function pipeline has been deprecated so everything about shading is done with GLSL shaders.
I’ve made a simple example using Vertex Buffer Objects to organize geometric data and a simple GLSL shader to colour the cube.

A Simple 3D Graphic Engine Part 3: Dealing with Shaders!

To start learning shaders, I’ve decided to build a simple shader editor so I could copy and paste GLSL code in my editor and compile it on the fly to see the result.
Recently I’ve made a port of the shader editor in Java, poorly enough I haven’t got time to update its functionalities. Maybe one day or another I’ll bring it back to life 😀

A Simple 3D Graphic Engine Part 2: Vertex Array Objects

Last time I’ve implemented an MD2 Loader, now I’ve tried to add Vertex Array Objects to improve performance.
Vertex Array Objects are a way to organize geometric data inside a buffer and then reconstruct the model using indices.
In this simple experiment I’ve organized geometric data in three different buffers instead of a single buffer:

  1. a buffer to store vertex coordinates
  2. a buffer to store normal coordinates
  3. a buffer to store texture coordinates (UV)

Here’s a short video of what I’ve come up with:

A Simple 3D Graphic Engine Part 1: Quake II MD2 Model Loader

I’ve developed a simple MD2 model loader (Quake II file format) to import more complex geometries than the classic cube in my OpenGL experiments :D.
For now, my MD2 loader parses geometry data and material data to load the texture with the model (animations are not supported yet).
I’ve added a simple algorith to compute vertex normals for lighting so even if the model has no normals data, the loader can compute them by itself.
Next time I’ll try to add Vertex Array Objects (VAO) to improve OpenGL performance.