Posts Tagged ‘software engineering’

Nanosleep in C / C++

Posted: 29th September 2009 by Tim in C, C++
Tags: , , , , , , , ,

usleep is not a very accurate form of sleep in C / C++. From the man page: The sleep may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers. nanosleep, on the other hand, is much more accurate. The following code will [...]

For various reasons, you cannot create a pthread on an object’s function. There is, however, a few ways to get around that. One of the most flexible ways of doing this is to create a wrapper function to call an object’s method, taking a pointer to the object as an argument. For example, if you [...]

Adding an image to a 2D OpenGL screen may seem like a relatively simple task, but it’s not. OpenGL is a rendering language, and as such has no native support for loading JPEG, GIF, TIF, BMP or any other popular image type. If, like me, you’re looking for a quick and simple way to get [...]