I <3 WebGL
by gbuzogany on 12/04/2013It’s like open-source CG software. You can learn so much of computer graphics so easily now…
random ideas!
It’s like open-source CG software. You can learn so much of computer graphics so easily now…
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 :)
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.
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.
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/
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
I just found the most complete and well explained (IMHO) iPhone hacking article.
This guy knows what he is talking about:
http://daringfireball.net/2011/10/thoughts_and_observations_iphone_4s
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.
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 :)
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!
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 :)
Soon: code snippets, software/hardware discussion and random ideas!