Game-Dev diaries #1

As I’m currently working on a game during my spare time, I thought that writing a diary about what is going on would be cool (even for myself, keeping track of the development rhythm). Right now the development is at the very beginning, and I am currently at the hard decisions time. I don’t want to use any game engine, as the game won’t be too complex… and I am always reluctant to use them. Maybe they would help me a lot… maybe they would limit me and make things break without any explanation, or have unfixable bugs and would cost me too much money. I feel like doing everything myself, and already started it. Chose C++, SDL and OpenGL… feels like a safe decision. Multiplatform and light, that’s the way to go. Currently I have an OSX dummy version, just to test some of the ideas. I’m using GL 3.2 to make things easy to migrate to GL ES. I have a 3D scene with a few textured objects and minor keyboard interaction.

Next steps:

  • 3D model loading
  • Mouse picking
  • Multiplayer (posix sockets fun)

Has been a long time…

Yeah, I spent a long time without updating this blog, but now I feel like it’s a good moment to get back to it. I felt nobody would be interested in Calculus or any of the undergraduate things I was working on. Hang on, soon new updates with many opinions and thoughts about random things.


OS X 10.8.x IPv6 Kernel panic?

Probably they will solve it on Mavericks. Meanwhile:

networksetup -setv6off “Thunderbolt Ethernet”



pugixml can’t handle large XML files

Yep… I spent hours trying to load a 20GB xml file using pugixml, but it doesn’t work.
Just posting it here so maybe I will save a few hours of someone’s life :)


I <3 WebGL

All applications are like open-source OpenGL scenes. You can learn so much of computer graphics so easily now…


Satellite tracking!

Hi again! Well, I (almost) finished another project, you can see it here:
It is a satellite tracking application! It displays many satellites at its current positions, in a beautiful 3D globe :)


Resetting Macbook SMC

You can reset your SMC by turning your mac off, then holding Ctrl+Alt+Shift+Power for 1~2 seconds, and then turning it on again.


More Interface Design

Iron Man 2 visual effects development:


Awesome design work

Just what the title says.


Oracle Instant Client (OCI8) for Mac OS X Lion Bugged

The x86_64 Oracle Instant Client for Lion is bugged and not working properly. There is a workaround for ruby, and maybe python, but not php.

Edit: It was originally posted in 2011-11-03. I don’t know how it is now.


App Store statistics

Another awesome study about chances of your app getting in the top 100/500 by category. All app developers should read this.


Android update problems

An awesome study about Android/iOS updates over time, by smartphone, made by Michael DeGusta:


Hacking the iPhone

I just found the most complete and well explained (IMHO) iPhone hacking article.

“Hacking_the_iPhone” presentation


Smartphone screen sizes

You should see that:


The best iPhone 4S and Apple keynote analysis I saw

This guy knows what he is talking about:


[Objective C] Aren’t your UIButton events working?

I was handling “taps” with a gesture recognizer, and it was killing my buttons in that view (they weren’t responding to UIControlEventTouchUpInside). So, the solution:

gestureRecognizer.cancelsTouchesInView = NO;

Saved my life :)

Just sharing.


And I am at the career’s guide!

@”Folha de São Paulo”:

The page that I appear


Indie Game Development

I’m working in a game for iOS (iPhone/iPad/iPod), and having a hard time to find someone to illustrate it for me.

It will be a 2D isometric, tycoon-based game. I’m using OpenGL ES 2.0, and it’s much more difficult to use than 1.1 ;/

As soon I have more details, I will post it here :)


[Video] Atmospheric Scattering Effects

It’s a video of my computer graphics project. I did it with a lot of help of some friends: Fabio de Albuquerque Dela Antonio and Leticia Rostirola Santos Silva.
We used an iPod to control the camera using it’s gyroscope.
With sure, the most beautiful thing I did in my life :)

Soon I will post the project with sources :)



OpenGL Post-Processing Effects Tutorial

It was hard to find out how it works, so I thought it would be great to share that!

I assume that you already know what shaders (vertex and fragment) are and that you are a little experienced with OpenGL.

Basically, what you do is:

-> Render the scene to a texture
-> Create a quad, map that texture in that quad, and place the quad fullscreen (just filling the window, not literally).
-> Enable your desired shader
-> Render it! But now, your shaders can get any information of that texture!
-> If you want to use more than one post-processing effect, just repeat the process!

I will assume that you know how to use google’s amazing search engine, and will have no doubts about what function does what.

Now, some snippets:


// Used variables and types
GLuint fbo; // frame buffer object
GLuint depthbuffer; // depth buffer object
GLuint img; // FBO "texture"
GLuint rbo; // render buffer object

-> How to create a framebuffer to render the scene?

    glGenFramebuffersEXT(1, &fbo);
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
    glGenRenderbuffersEXT(1, &rbo);
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbo);
    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, WIDTH, HEIGHT); // one nice place to put multisampling!
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);



    GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
        printf("FBO Setup complete!\n");
        printf("FBO Error!\n");

    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

-> How to setup the framebuffer to be used as a texture?

    glGenTextures(1, &img);
    glBindTexture(GL_TEXTURE_2D, img);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); // place multisampling here too!
    glBindTexture(GL_TEXTURE_2D, 0);

-> How to render to the framebuffer created previously?

    glViewport(0, 0, WIDTH*msaa, HEIGHT*msaa);
    gluPerspective(60.0f, (float)(WIDTH)/(HEIGHT), 0.01f, 10000.0f);

    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);

// render here!!!!

-> Ok, I rendered it, now I want to do some post-processing magic!

-> Switch to 2D rendering mode. It will setup the screen to the post-processing magic.

	glOrtho(0, WIDTH , HEIGHT , 0, -1, 1);

It’s now that the magic happens, the steps are:

-> Enable the post-processing shader that you want:

// you should now how to do that, if not, i will publish one tutorial soon, but there is a lot of it on the internet (as everything else)

-> Render one fullscreen-quad using the framebuffer’s texture:

    glBindTexture(GL_TEXTURE_2D, img);
        glTexCoord2f(0,1);   glVertex2f(0,0);
        glTexCoord2f(0,0);   glVertex2f(0,HEIGHT);
        glTexCoord2f(1,0);   glVertex2f(WIDTH,HEIGHT);
        glTexCoord2f(1,1);   glVertex2f(WIDTH,0);

-> To use more than one post-processing effect, just render the output of the two last steps to the framebuffer again, and again, and again. On the last time, unbind the framebuffer, and render to the screen.

To unbind the framebuffer to render to the screen:

    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // unbind
    glBindTexture(GL_TEXTURE_2D, img);
    glBindTexture(GL_TEXTURE_2D, 0);
    glViewport(0, 0, WIDTH, HEIGHT);


This snippets should help someone :)


Hello World!

Soon: code snippets, software/hardware discussion and random ideas!