Sunday, January 17, 2010

Textures, Lighting, and Future Approach

I had intended to make updates much more frequently, yet I encountered several difficulties revolving around accessing OpenGL with Objective C. While OpenGL itself is relatively straightforward and is very similar regardless of operating system, performing tasks such as loading textures for use by OpenGL is very complicated. Furthermore, most online OpenGL tutorials are intended for Windows only or are outdated.

By using the "NeHe" OpenGL tutorials and adapting them to the Mac OS X desktop platform, I was able to create a rotating cube and map a texture onto it. However, I was unable to load the texture into the program. I contacted a fellow iPhone programmer I met over the summer, and he helped me find the error in my code.

video

He also suggested that I switch from the desktop version of OpenGL to OpenGL ES through the iPhone, which uses most of the same OpenGL commands but simplifies the Objective C aspect of OpenGL programming. Many more relevant tutorials exist for the iPhone platform, such as http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html.

Since then, I learned how to apply lighting to a 3D scene:

video

Next, I will explore materials and textures with OpenGL ES on the iPhone.

No comments:

Post a Comment