Saturday, September 26, 2009

Pyramid in WebGL

To view the demo you will need a browser with WebGL enabled, such as a Firefox nightly build

I figured out how to use multiple verticies and multiple array objects to give each face color. WebGL is interesting to work with, but I'm getting a better grip on how vertex attribute arrays work and how to work with them. Things like the vertexAttribPointer call are a little odd, in my opinion, because you don't give it anything significant, and you don't get anything back, but it's really important. It makes me realize why people advocate functional programming.

In any case, the result is this pyramid, you can control its rotation with your mouse. As usual you can check the source out to see how its done.

Demo after the jump

Friday, September 25, 2009

Black Triangle Redux, Now With More Spinning!

To view the demo you will need a browser with WebGL enabled, such as a Firefox nightly build

Another day, progress made. I'm slowly getting my head around OpenGL, or rather the OpenGL subset that is the current state of WebGL in FireFox. Nevertheless, I've managed to make the black triangle from the other day spin and user input (click and drag) see it on its own here. As usual, since WebGL is javascript, you can right-click view source to see exactly how it's done.

Demo is after the jump.

Wednesday, September 23, 2009

WebGL and One Black Triangle

Since WebGL started getting some recent press I have been interested in giving it a try. Although I've never done anything past a hello world in either OpenGL or Javascript this seemed like a good way to do both (I taught myself raytracing and c++ in a similar, though larger in scope, mutual method a year or so back). The past week and a half has consisted of me trying to get WebGL up and running any way I could. First through Webkit by way of building from source, on Windows. Unfortunately I could not get it working. However, as I started looked for alternatives Vladimir Vukićević posted about how WebGL was now in Firefox 3.7 nightlies(you'll have to go to about:config and toggle webgl.enable_for_all_sites). After some touch and go, and with the help of his Spore example I have prevailed. 

Ladies and gentlemen, I present a black triangle

[What is a black triangle?] The linked triangle will (read: should) appear if you are using a Firefox nightly and, theoretically, if you are using a Webkit build with WebGL enabled.

NOTE: Interestingly enough, If I am not mistaken, as of 9/23/2009 I am the second person to have a Firefox WebGL demo on the internet (the first being Vlad, who put it in Firefox in the first place) I feel special :D

Friday, September 11, 2009

On HMDs and Augmented Reality

With the help of professor Reynold Bailey of the RIT Computer Science department I was able to find a Head Mounted Display (HMD) that I could use to do some development with. The HMD in question were a pair of I-glasses SVGA 3D. I then took a small webcam I had laying around and jerry-rigged it to the front of the display facing out. I haven't done any work with augmented reality before, however, with the use of Processing and the Simple AR ToolKit coupled with JMyron I was able to get two proof-of-concepts up and running. The first used Sobel edge detection to process the webcam's stream and display that into the HMD. The second displayed a spinning green cube on the surface of a registration mark I had printed out.

Now that I know it's doable I'm going to look into OpenCV and the full ARToolKit libraries to create my own application. Some ideas I've had are an augmented reality tour around campus combining GPS data with the visual stream to determine which building is being looked at and displaying information about it to the viewer. Another thing that I think would be great fun would be great fun would be to determine the layout (walls, floor, and ceiling) of a room and one's position inside it and to run a fluid simulation within the room to simulate it filling with water. Although this will take far more processing power than my little Eee PC can provide.