September 24, 2010

Adding Color, Drawing a Tetrahedron, Cube with WebGL

Our second assignment asked us to use color when drawing a tetrahedron and cube using WebGL. Here is a screen shot of my work.

If you have a WebGl capable browser, then follow the link and you can test it yourself. Make sure you view source on the page.

Here are the three files you need to run this lesson.
lesson2.html
sylvester.js
glUtils.js

September 18, 2010

How to get the Symbol Browser Plugin to work in Gedit

Ok, so twice I had to research and figure out how I got the symbol browser working in gedit. I started out trying to install the Class Browser. But the ubuntu community suggested that this plugin was no good and to instead use the symbol browser. If you quickly rush and start downloading the symbol browser plugin, you will find that you just downloaded a whole bunch files that need to be compiled. Lucky for us though, you can instead download the binary files for the symbol browser. Go to SourceForge and instead of clicking on “Download Files”, look below under “Browse Files for Gedit Symbol Browser Plugin” and you should see

gedit-symbol-browser-plugin-bin-ubuntu-i386-0.1.tar.gz

If you are using 64 bit, make sure download the 64 bit binary version.

Extract your files and move it over to ~/.gnome2/gedit. You should have the following files…
~/.gnome2/gedit/symbols
~/.gnome2/gedit/plugins/libsymbolbrowser.so
~/.gnome2/gedit/plugins/symbolbrowser.gedit-plugin

A lot of us will now try and open Gedit and enable the plugin. As you try, it will automatically get grayed out. This is because you need the following package.

libgnomeprintui

Once you restart Gedit and enable the plugin, you might realize that it’s still not displaying any class, functions, or variables after you open a file. This is because you need to install exuberant-ctags. After you do this, you should be ready to go.

Let me know if you have any problems.

September 15, 2010

Drawing Simple Shapes – Triangle, Square in WebGL

Our first assignment asked us to draw simple shapes using WebGL. For this particular project I drew a simple square and triangle. Here is a screen shot of my work.

If you have a WebGl capable browser, then follow the link and you can test it yourself. Make sure you view source on the page. I heavily commented the code.

Here are the three files you need to run this lesson.
lesson1.html
sylvester.js
glUtils.js

September 8, 2010

Introduction to WebGL

I’m currently taking a computer graphics class and I’ll be spending this semester delving into WebGL. So, I’ll be giving some tutorials as I get new projects to work on.

Setting Up Your Browser To Support WebGL

First do a Google search for “google chrome developer build”, and it should be the first result. Here is the link it took me to.

http://www.google.com/chrome/intl/en/eula_dev.html

Once you have chrome’s developer build, click on [Start->All Programs->Google Chrome] and then right-click on ‘Google Chrome’. Select ‘properties’ and append this to the end of the [Target] string.

--enable-webgl

Here is how my target string looked like.

C:\Users\Chris\AppData\Local\Google\Chrome\Application\chrome.exe --enable-webgl

Now open up Chrome by going through [Start->All Programs->Google Chrome] and you should be ready to view WebGL webpages. Click here to test for your self.

Getting Started With WebGL

Here are the three files you need to set up your frist WebGL script.
webgl.html
sylvester.js
glUtils.js

September 7, 2010

Cache Problem in CakePHP

I recently had a problem on our website with caching in our CakePHP framework. We initially had caching turned on. And then we started noticing when we submitted a form, our changes wound not be updated until we manually refreshed the page.

So let’s say I have a row of users. I choose to delete one of the users. I click on delete, hit submit and cake removes that user from my table. Cake then redirects me back to same page, but the deleted user is still listed on our page. Once we manually hit the refresh button on our browser, then our deleted user disappears from our form page.

We scratched our heads and tried figuring out why this was happening. We turned off all caching and even added the <cake:nocache> tag. No matter what we did, we could not get rid of the problem.

After much research, we realized that the browser itself was actually caching the previous form page. So we added this snippet of code to our app controller.

$this->disableCache();

This is used to tell the user’s browser not to cache the results of the current request. The headers sent to this effect are:

Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: [current datetime] GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache

I hope this saves you some time. If you find a better way fixing this problem, please leave a comment.