Friday, January 25, 2013

Chrome local file access

I've been doing some things at work on a webpage for Chrome Desktop, Chrome Android and Safari. We basically need to present the same 3D content across all of these browsers.

When testing Chrome, for security reasons you cannot run pages that will load local content. There are several fixes to this. The quickest is to run Chrome with a specific argument to disable the security feature. I won't describe that fix as it isn't a good idea.

No, the good idea is to run the site you're working on via a local server. It's also very easy to do.


  • Download the latest version of Python 2.X
  • Open up the command prompt or terminal and go to the folder with the site's index.html.
  • Once in this folder, run the command [python -m SimpleHTTPServer].
  • Your folder's contents will be hosted at the web address [http://localhost:8000].
And that's it! You can safely dev your site on this python local host now. When you are done just close the terminal (or press ctrl+c in the terminal).

Remember to launch the server from the terminal once it is in the folder with the site's index.html.

Friday, January 18, 2013

OpenGL explained: Framebuffer Object & Renderbuffer

Upon looking around for some info on an issue I'm currently having, I found the following posted by user "Nicol Bolas" on StackOverflow. I've read a few of this user's posts and they are quite knowledgeable on OpenGL related things.

Also, Nicol Bolas is the name of the chaos dragon from Magic The Gathering. Coincidence? Lol.

Anyway, the description is quite concise in my opinion.


framebuffer object is a place to stick images so that you can render to them. Color buffers, depth buffers, etc all go into a framebuffer object.
renderbuffer is like a texture, but with two important differences:
  1. It is always 2D and has no mipmaps. So it's always exactly 1 image.
  1. You cannot read from a renderbuffer. You can attach them to an FBO and render to them, but you can't sample from them with a texture access or something.
So you're talking about two mostly separate concepts. Renderbuffers do not have to be "for depth testing." That is a common use case for renderbuffers, because if you're rendering the colors to a texture, you usually don't care about the depth. You need a depth because you need depth testing for hidden-surface removal. But you don't need to sample from that depth. So instead of making a depth texture, you make a depth renderbuffer.
But renderbuffers can also use colors rather than depth formats. You just can't attach them as textures. You can still blit from/to them, and you can still read them back with glReadPixels. You just can't read from them in a shader.
http://stackoverflow.com/questions/9850803/glsl-renderbuffer-really-required

So you can't really use a renderbuffer for anything yourself. You put it in there so the system has a place to write things.

The framebuffers are for things you plan to work with.