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: http://satelitoj.appspot.com/
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:

http://motionographer.com/features/prologue-iron-man-2/

 

Awesome design work

Just what the title says.

http://www.johnkoltai.com/

 

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.

http://www.somegeekintn.com/blog/2011/10/lies-damned-lies-and-statistics/

 

Android update problems

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

http://theunderstatement.com/post/11982112928/android-orphans-visualizing-a-sad-history-of-support

 

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:

http://dcurt.is/2011/10/03/3-point-5-inches/

 

The best iPhone 4S and Apple keynote analysis I saw

This guy knows what he is talking about:

http://daringfireball.net/2011/10/thoughts_and_observations_iphone_4s

 

[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 :)

Bye!

 

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);

    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);

    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rbo);

    GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
    if(status == GL_FRAMEBUFFER_COMPLETE_EXT)
    {
        printf("FBO Setup complete!\n");
    }
    else
    {
        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);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
    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);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60.0f, (float)(WIDTH)/(HEIGHT), 0.01f, 10000.0f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    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.

    glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, WIDTH , HEIGHT , 0, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

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)
glUseProgram(program);

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

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

-> 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);
    glGenerateMipmapEXT(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    glViewport(0, 0, WIDTH, HEIGHT);

Done!

This snippets should help someone :)

 

Hello World!

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