Thursday, November 11, 2010

11 November 2010

Chanced upon this link as I revisited on drawing 3D cubes using OpenGL ES. He has some useful tutorials there for beginners. I did this thinking that I probably drew the cube wrongly, but that was not the case. Spent more than half of the day trying to draw cubes.

I then decided to revert back to what the template used to create the glFrustumf, and the cube was drawn nicely. However, the coordinate translation went haywire. Therefore, I suspect that my issue has got to do with the creation of the glFrustumf. Hence, I decided to do more research on this to gain a better understanding.

Kevin came in to check on us at the end of the day. I had the direction in mind, but once again, I failed to express what I have in mind properly, which caused confusion for Kevin and Zac. I probably went into too much details too. Kevin then told me to research on the following terms aside from just glFurstumf:
- glMatrixMode
- glViewPort
- glLoadIdentity

Gonna do some research back at home though Kevin says that I can get it done by Monday.

Wednesday, November 10, 2010

10 November 2010

Continued with the movement interaction today. Had a short meeting with Kevin and Zac to discuss on the formula to use for translation. That didn't seem to work well either. We went on to research more on glOrthof and glFrustumf. After some explanation by Kevin, I slowly got to understand more of what they can do.

Hence, I went on to work with glOrthof first, which is for 2D models. I applied the formula that I came up with and finally managed to get what I wanted. From there, I then moved on to make use of glFrustumf, to work with 3D models. All seem to work pretty well, but my cube doesn't seem to be a cube anymore. Or probably it is. Got to look more into this issue and solve it by tomorrow!

Looks like I would have to work with more mathematics in time to come. Wish I had put in more effort in mathematics during my secondary school days :S

Tuesday, November 9, 2010

09 November 2010

Continued working on the model interactions today. I decided to first work on the moving of the model. First I did some simple movement of subviews with the use of UIGestureRecognizer. It has quite a lot of similarities to UITouch.

With that done, I then moved on to try out the same interaction, but with the 3D model. I realized that I was able to do a glTranslatef on the model, however, the model does not seem to appear properly. Then I realized that I would have to do some translation of the coordinates. The UIGestureRecognizer uses the Window coordinate, while OpenGL ES uses the Normalized Device coordinate for model translation. Here are some pictures to illustrate the differences:


Therefore, I proceeded on to work on the coordinates translation. Still have yet to work things out properly. The problem now lies in the part where the model crosses x = 0 and y = 0. There's definitely something wrong with the formula that I have come up with. Gonna have to do more thinking, debugging and researching.

I tried to workaround by making use of UIAnimations. However, while doing that, I came to realize that the rendering method is already making use of UIAnimation.

Monday, November 8, 2010

08 November 2010 - Start of OpenGL ES & Project

Kick started the day by going through Stanford University's podcast lecture on OpenGL ES. Completed some basic sample codes of drawing 3D models and rotating them.

Once that was done, we gave Kevin a call and he came over to have a discussion with us. We discussed on the things to be done for our project and split the work among ourselves. Zac chose to work on the first stream, which is to work with the model. Thus, I would be working on the interaction stream.

Here is the picture of what we have discussed:

I would first have to complete the 3 basic interactions, namely rotation by flicking, scaling by pinching, and moving by dragging.