FreeImage: Erreur de Compilation Sous Ubuntu 10.10

La compilation de la librairie FreeImage 3.14.1 sous Ubuntu 10.10 gènère cette erreur: In file included from Source/OpenEXR/IlmImf/ImfChromaticities.h:47, from Source/OpenEXR/./IlmImf/ImfChromaticities.cpp:43: Source/OpenEXR/Imath/ImathMatrix.h: In constructor ‘Imath::Matrix44::Matrix44() [with T = float]’: Source/OpenEXR/./IlmImf/ImfChromaticities.cpp:110: instantiated from here Source/OpenEXR/Imath/ImathMatrix.h:1813: error: ‘memset’ was not declared in this scope Share PostTwitterFacebook

Multithreaded Build with Visual Studio 2005

Under Visual Studio 2005 (VC8), you can enable the multithreaded build of projects. This great feature makes it possible to use several CPUs to build your projects. This is a per-project setting and it’s done in command line: /MPx where x is the number of cores you want to use. Example: /MP2 to use 2 […]

Saturate function in GLSL

During the conversion of shaders written in Cg/HLSL, we often find the saturate() function. This function is not valid in GLSL even though on NVIDIA, the GLSL compiler accepts it (do not forget that NVIDIA’s GLSL compiler is based on Cg compiler). But ATI’s GLSL compiler will reject saturate() with a nice error. This function […]

GLSL float to RGBA8 encoder

Packing a [0-1] float value into a 4D vector where each component will be a 8-bits integer: vec4 packFloatToVec4i(const float value) { const vec4 bitSh = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0); const vec4 bitMsk = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0); vec4 res = fract(value * bitSh); res -= res.xxyz * bitMsk; return res; } Unpacking a [0-1] […]

Better, smaller and faster random number generator

I found this cool random generator on rgba’s website. rgba is a wellknown demoscene group specialized in 4k prods. This random generator is used in their prods: static unsigned int mirand = 1; float sfrand( void ) { unsigned int a; mirand *= 16807; a = (mirand&0x007fffff) | 0x40000000; return( *((float*)&a) – 3.0f ); } […]

Small Log System

Here is a small piece of code that can be useful if you need to quickly generate traces (or log) in your apps: class cLog { public: cLog(char *logfile){}; static void trace(const char *s) { if(s) log << s << std::endl; }; static std::ofstream log; }; std::ofstream cLog::log(“c:\\app_log.txt”); Just use it as follows: cLog::trace(“this is […]

Multithreading et Lecture du Clavier

La programmation multithreading est un monde à part et il faut bien en être conscient. Dans une des demos sur laquelle je bosse en ce moment, il y a deux threads: le thread principal qui s’occupe de la gestion des messages de la fenêtre via la classique pompe à message GetMessage() et le thread de […]