Bugfixes

2012-07-01 20.00.05

That’s my cat. She’s a princess.

You’ve all had those “I’m an idiot” moments. Well, I had a couple of them. The two issues I was having involved the alpha blending (making the box cover fade into view upon loading the program) and I was having some trouble dragging the camera around. I could make the camera zoom in and out on the image, but not drag the image around on the screen.

Okay, so the alpha blending involved actually knowing that something called alpha blending exists. Silly me. Two lines of code:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Done. My transparency code works perfectly now. Hell’s bells. It just seemed to me that something as fundamentally useful as transparency or interpreting alpha values might be enabled by, you know, default. Silly me.

The other thing involved the fact that I could zoom in but not drag the camera about. Consider that I had the camera’s position stored in a vector called “cameraPos” containing three floating point values, x, y, and z.

I had a little function to detect any changes in the mouse wheel state (for zooming) and a little bit of code to detect whether the mouse button was clicked or dragged around and to record any changes in the position of the mouse and feed them into my camera, which would then be fed into this little “if” statement:

if(wheelDelta != 0){
cameraPos.translate(xDelta, yDelta, .01f * (float)wheelDelta);
}

And I kept wondering why it would always detect and register a change in the mouse wheel, but never a change in x and y values. When you see it….

It really does feel good when you figure something like this out, though. All sorts of good chemicals in my brain right now.

C’est la vie.

Singing the fragment shader blues

dominantSpecies

I’m making a PC version of Dominant Species. There, I said it.

I don’t think I have to tell you that Chad Jenson is a genius or that this board game is one of the best piles of wood and cardboard ever to grace my table. You know perfectly well how excellent Dominant Species is.

It is also easier in concept than a full-fledged video game. I can make this into a video game, theoretically putting out a working hotseat-style game within the next couple months and integrating internet play without too much more difficulty later. Possibly even building an applet version that can be based online.

All of this is almost certain to land me a job with GMT games. And I will be rich beyond my wildest dreams. I think.

Anyway: fragment shaders can lick my balls.

Every fragment color that goes through there (using a four byte RGBA format), no matter which of the 17 million possible floating point values between 0 and 1, will always be output as if it had an alpha value of 1. Which means that transparency is impossible. No fancy fade ins or fade outs or just fucking transparent objects. It’s driving me batty.

If any of you fine, gentle readers know of a way to fix this problem, I will put you in the credits for the first full-fledged game I create.

Meine Realität ist fragmentiert.