1 min read

OpenGL ES: gluPerspective?

Project Z is a new project undertaken by Project Soulstorm. It will have as a basis OpenGL ES and 2D graphics, animation, and music.
Project Z will not be anything revolutionary, but it will be in a whole different direction that the X one, since it will going to use OpenGL. So far, I am doing well with converting my stuff from OpenGL to OpenGL ES, with my basic problem being that I will have to rewrite the SFCocoa’s object model loader due to limitations in the OpenGL ES implementation.

Project Z is a new project undertaken by Project Soulstorm. It will have as a basis OpenGL ES and 2D graphics, animation, and music.

Project Z will not be anything revolutionary, but it will be in a whole different direction that the X one, since it will going to use OpenGL. So far, I am doing well with converting my stuff from OpenGL to OpenGL ES, with my basic problem being that I will have to rewrite the SFCocoa’s object model loader due to limitations in the OpenGL ES implementation.

By trying to do so, I have discovered new and faster ways of drawing graphics on the screen and minimizing geometry without compromising from the final result. I thing a complete overhaul of SFCocoa is needed. Just not now. I will continue providing information and tutorials on my sites, and when the time comes, I will gather all this information, and will start writing something new.

My new project will use an own-written Grid3D implementation, whose a very basic part I have given you to a tutorial here. However, It will have much better performance and geometry handling. It’s just difficult for me to understand some advanced concepts on OpenGL. And generalizing OpenGL output is a pain in the ass. I often need paper and pen to do the calculations myself, and compare them with the onscreen result. I also had to get used to the OpenGL ES’s lack of gluPerspective() function.

However, I have found a way around that:

void SFGLPerspective(float fov, float aspect, float near, float far)
{
float top = tan(SFDegToRad(fov)) * near;
float bottom = -top;
float left = aspect * bottom;
float right = aspect * top;
glFrustumf(left, right, bottom, top, near, far);
}

I have found that the above function has the same effect with gluPerspective() . I haven’t found out why this function wasn’t included, though.