Convergence Behavior of Several Solvers in GAMS and Matlab 2014-06-20

In this post I wanted to document the difference between the cadoux model and the chrono model for a few simple test cases.

Minkowski Portal Refinement References 2014-06-09

Original Reference

The Minkowski Portal Refinement method, also known as XenoCollide was developed by Gary Snethen (Xeno). As far as I know the original implementation in 3D is only described in Game Programming Gems 7 where working source code was also provided.

Convergence Behavior of Several Solvers in GAMS and Matlab 2014-06-05

In this post I wanted to document the behavior of several different numerical methods using a set of benchmark test problems.

Test Problems

  • Ball sliding on plane
  • Block sliding on plane
  • Block sliding from rest on incline
  • Block coming to resting on incline
  • Ball falling on stack of 20 balls

Solvers

Solver (Matlab)   Solver (Gams)
Nesterov   Conopt
Barzilai-Borwein   IPopt
Jacobi   Path

Test Problems

Ball sliding on plane

In this test problem there is a ball in perfect contact with a plane, the ball has an initial velocity of in the direction. friction is .1, step size = .005, with a step size of .01, path returns a weird solution.

OpenGL text without any external libraries 2014-05-30

In the world of OpenGL, dealing with text is not always straightforward. GLUT is one method but it’s becoming old and in some cases deprecated (OSX 10.9). The freetype2 library is one method for generating text, using this library isn’t difficult but getting the best performance requires generating an “Atlas” for your font. An atlas is essentially a texture that contains every single character for a font at a given font size along with information on how to access that character. There are a few libraries that can generate an atlas for you, freetype-gl being one of them.

There is an alternative that in my mind is more portable and easier to use. freetype-gl comes with several awesome little demos on how to use the library, it also comes with a small executable called makefont that generates a header file with all of the needed information.

Provide it with a path for a .ttf font, the name of the header file, the font size and the variable name in the header that you will access it with.

makefont [--help] --font <font file> --header <header file> --size <font size> --variable <variable name>

If you find that the texture size is too small go into the code for makefont.c and change the following line so that it has the size you require. the default was set to 128x128 and I changed it to 256x256 . If your texture size cannot contain the full font, characters will be missing. Look at the output of the makefont command to make sure that characters are not missing.

texture_atlas_t * atlas = texture_atlas_new( 256, 256, 1 );

OpenGL GLSL shader as a string 2014-05-29

One annoyance that I have with GLSL shaders is that the vertex and fragment shader files must be placed into the directory with the binaries (or some other path accessible by the program). There are alternatives that involve using a resource manager but for smaller programs this seems like overkill.

One solution is to make a string out of the shader and include it with the code. The major problem with this is that editing the shader becomes a bit more tedious. One solution which I will discuss here involves converting the shader at compile time into a header and including it into the binary/library. I am using CMake for my build system which makes it trivial to do this.

References

GLSL Shader to Header

Cmake Embed Resources

Using these two posts you should be able to figure everything out but I wanted to describe in detail the full process.