<<Previous Archive | Next Archive>>

Open source diff tools

I really like open source. I use a lot of open source tools to develop software in my free time. And I write open source software on my own, and release it for free. But IMO there are some tools which are a lot better than any of the open source competitors, like Visual Studio. (Going to buy the next version as soon as it will be available in the next weeks.) And now it looks like I'll start using a commercial diff tool for open source development. I don't know if it is because I am now used to it or just because it is better. But currently I feel like the alternatives like KDiff3 or WinMerge really suck. Example: Comparing between Irrlicht-Spintz and Irrlicht is such a pain with these open source programs, so I just downloaded DiffDog and I got the differences how I needed them:

Worth nothing

My blog is worthless. (Unlike the valuable blogs of others.)

My blog is worth $0.00.
How much is your blog worth?

Pixel shader tutorial part 2 - textures

This is the second part of the pixel shader tutorial. In the first part, we simply drew green pixels using a simple pixel shader. A pixel shader is nothing more than a short program executed on the GPU for every pixel, to calculate the color of every pixel. To make the last example a bit more interesting, we will now draw a texture instead of the green color. And because this is quite boring too, we will change the color of the texture a bit: Just make it a little bit brighter. The code for the second pixel shader looks like this, just replace the string in the beginning of the first program:
"sampler2D tex0;                                      \
float4 pixelShader( float2 texCoord : TEXCOORD0, \
float4 color : COLOR0 ) : COLOR0 \
{ \
float4 c = tex2D( tex0, texCoord ); \
c = c * float4(2,2,2,2); \
return c; \
Right, this code is executed for every pixel on the screen. The first line gets the color of the texture tex0 using the tex2D function. The second line multiplies the color by 2, to make it brighter. Simple. If you use a texture like this:

The result of the program will look like this:

Yep, it's better than the green, boring cube. But not much. We'll have to improve this situation in the next part. :)

Layout damaged

Strange, my last blog post made the right menu be aligend to the bottom. And only in IE, for Opera it's ok. And I'm to lazy to check why.
Update: Fixed. Stupid IE.

Pixel shader tutorial - Hello World

So you're a programmer and own one of these vector computing monsters which we today still call graphic cards? Maybe you've always wanted to try out how it is to write code which runs on their pixel shader units. Because I am receiving lots of mails about this topic, and I'm tired of answering "buy and read a book about it", I've decided to write a small tutorial. And you'll see, it really is easy.
I'm using HLSL for this tutorial - a high level shader programming language. It works with Direct3D9, so this tutorial is windows only, but you could change this tutorial easily to OpenGL and GLSL if you like.
This tutorial also uses Irrlicht, because this will keep the code small and easy to understand, so we can focus on the pixel shader. So just download Irrlicht, paste this code and compile.
First, this hello world pixel shader just puts out a green pixel for every pixel drawn on the screen. The pixel shader is the red text in the beginning at the code. After you've compiled and run the program, play around with it. I'll explain things which may be unclear in the next part.
#include <irrlicht.h>
using namespace irr;

// This is our first pixel shader, written in HLSL.
// It simply puts out 'green' for every pixel drawn.
const char* pixelShader =

"sampler2D tex0; \
float4 pixelShader( float2 texCoord : TEXCOORD0,
float4 color : COLOR0 ) : COLOR0
return float4(0,1,0,0);

// now fire up Irrlicht, create a small scene with a cube and
// controllable camera and feed the gpu with our pixel shader

int main()
IrrlichtDevice* device = createDevice(
video::EDT_DIRECTX9, core::dimension2d<s32>(640, 480));

if (device == 0)
return 1; // could not create selected driver.

video::IVideoDriver* driver = device->getVideoDriver();
video::IGPUProgrammingServices* gpu =

s32 newMaterialType1 = 0;

if (gpu)
// create a new material for our pixel shader

newMaterialType1 = gpu->addHighLevelShaderMaterial(
0, 0, video::EVST_VS_1_1,
pixelShader, "pixelShader" );

// create a cube and set our created material with the pixel shader

scene::ISceneNode* node =
node->setMaterialTexture(0, driver->getTexture("data/wall.bmp"));

// add a user controlled camera and disable the mouse cursor

scene::ICameraSceneNode* cam =
device->getSceneManager()->addCameraSceneNodeFPS(0, 100.0f, 100.0f);


// draw everything

driver->beginScene(true, true, video::SColor(255,0,0,0));

return 0;
The result will look like the following screenshot. Boring, right. But the green color is fully generated on the GPU (via the float4(0,1,0,0) line), a good point to start. We are going to improve the shader a bit in the next parts of the tutorial.

(Update: Follow this link directly to the 2nd part of the tutorial)

Code::Blocks IDE v1.0rc2 released

ReleaseCandidate 2 of Codeblocks, a really good C++ IDE hast just been released. It has a lot of cool new features. Call me strange, but I like this little new feature best:


No time for tv

The reason why I currently don't have time for watching tv is this:

Best science fiction series ever. If you bought the first season, it's already too late. I just finished the 4th season. Time for the last one. And the funny thing: You get to see lots of people from other series, for example scrubs:

Today it's national holiday here in Austria. Should I go and buy the last season (Luckily there are still some open shops)? Or would it be better to learn for the exam? Hmhm. Difficult.

Regular expressions are your friend

I just wanted to replace several but not all .bmp textures with jpegs. Started editing the .xml file. Wait! Too tired to type, lets quickly write a regex: Find {"gamedata\\levels\\level02\\textures\\}{.*}{bmp"} and replace with \1\2jpg". Result:

Doh! I would have typed a lot for this doing it manually.

My DVD drive hates me

The DVD drive in my PC hates me. Every third or fourth file I'm reading gets out corrupted. There are simply some weired bytes appearing in the middle of the files. The textures of the project I'm currently working on for example looks like this:

Argl. Difficult to work this way. But thrilling.

I want to believe

I used to be an atheist, but now I've found the true church - the church of the fsm.

(Yes, in my opinion ID sucks, and I cannot believe people are really that stupid.)

Generalizing women's strange behavior

Ever wondered why your girlfriend or female friend behaves strangely? Martin and AK [my condolence btw, something similar happened to me too ;)] recently wrote about it. My theory: It's because women simply think completely differently. And I think there is just one simple rule: It is not possible for them to hurt anybody using words, including themselves. They prefer not to answer mails and calls because they would have to hurt you saying 'no sorry, you're not the right one for me'. They get angry when you try to help them with their pc because it shows that they are incapable of doing it theirselves. (However, my experience has shown it works when you only blame the stupid PC or software for the problem). They begin to lie and invent excuses if they don't want to take part in an event they don't like instead of telling the host why. And before they say that you did something wrong, they simply look offended and behave strangely for hours and days.
But it's just a theory, and of course, there are exceptions. :)

Killing rumors

As reader of this blog, you've maybe seen this topic already some times. I don't know why and how, but from time to time rumors are spreading that I'm going to stop the development of Irrlicht, and it looks like this time has come again. I'm getting mails and people are asking in the forum: Is Niko stopping Irrlicht development? My answer: No. Not at all!
Some people for example currently argue that because I am working in a game development company I'm not interested in Irrlicht anymore. The truth: I'm working for a company named Altova, it doesn't do anything with games or graphics. And even if it would, this would be no problem at all, I've released lots of versions of Irrlicht when I was working in the game industry. Ok?
To summarize: No, I'm not going to stop Irrlicht. I need to add a new FAQ entry or something.

Krimhild growing

I don't know what I did wrong. And I think I was not able to do a lot of things in a wrong way, because I didn't do a lot. Only watering it two or three times a week. But somehow Krimhild grew a lot during the last few weeks:

krimhild, my carnivorous plant

But as long it currently prefers eating flys to swallowing programmers...

Wonderful world of programming

Straight out of the ODE source:
// for warm starting, this seems to be necessary to prevent
// jerkiness in motor-driven joints. i have no idea why this works.
Nice to see miracles every day.

Still something TODO

Maybe you know already, from time to time I've not that much free time, because I've got a job and am studying informatics as hobby. And projects such as Irrlicht then suffer a bit from this. This is a list of the percentage of exams I've finished of the semesters:

semesterpercentage done

Yay, I can already see an end. When every semester has a '100' behind it, I'll finally have some official paper in my hands which tells that I can write software and stuff. :)

C++ feature request - the !? operator

There are so many operators in C++, for example '!=', '*', '/=' and whatever. I'd like a new one: The '!?' operator. And I'd like to have the possibility to write it everywhere. Really, everywhere. Its default functionality should be that it does nothing at all. With this, it would be possible to enrich your code easily. Example: You have to work with code which looks like this:
[++*foobar]-=(baz*)--bar + x ? 0xff:0x1<< 1; 
Not easy to read, eh? But with the !? operator, this will change dramatically:
!? [++*foobar !?!?]-=(baz*)--bar !?!? + x ? 0xff:0x1<< 1; !?!?!?!?!?!?
Within just a fraction of a second, you'll now immediately see that you won't have to spend time to try to understand that code. Thanks, !? operator.

Du bist Deutschland

Late, but I just saw the spot "Du bist Deutschland" everybody is talking about currently, on the blogosphere. I like the commercial very much, apart from the fact that it is pretty senseless. I only knew it from all the jokes people make about it. There are already more than 100 satire images at flickr.com.

Visual RAD Editor for Irrlicht

Speaking of Irrlicht running inside an editor: I just tried out etcaptor's Visual RAD Editor. It features lots of scene nodes, animators and effect Irrlicht offers. Really nice.

And it comes with a loader to integrate the scenes easily into your projects.