Welcome

This is a blog sharing what i have learn and experience from my internship in A*Star IHPC
- Zac Kwan

Thursday, November 11, 2010

Day 28 - Import OBJ, Rotate, Translate

Continue the work from yesterday, trying to understand why the object is not being draw correctly, looking into the method of glDrawArray() and glDrawElement. This is where the mistake was make. glDrawElement is actually use usually for importing obj file as the array of vertices is not in sequence, which mean a indices is needed to tell which line to be draw 1st. To make use of a universal drawelement and prevent maths error, using a for loop to loop the count of the indices and drawing it line by line is the perfect solution.

With that, manage to draw out a imported obj object. Next i try to do the rotate and translate. Translate is already been done by the apple template, using the same way i did the rotate but it did not work at first. "Same way" is always what i thought, after analyzing i still do not understand how the translate work even though the code was provided. This part, i stopped coding and start looking for answer online again. I decided that i have to understand what opengl es shader actually means! so Wikipedia is the best solution.

After reading what is shader, the attribute and uniform that state in the blog of jeff start to make more sense. I went back to the code, set the attribute and uniform in the sharder class, also bind-ing to the attribute and uniform of our ivar and this work!

Will post up screenshot soon of imported object soon!


No comments:

Post a Comment