

This function call is passed different values than the previous demo. Next we define our projection matrix, projMatrix, and set it using the GLKMatrix4MakeOrtho function.

Next we have our call to glViewport which is the same as the previous demo and will probably be the same in most of the demos. These values are used in the call to GLKMatrix4MakeOrtho.
#Opengl 2.0 download android code#
After that code we are defining the half width and half height of the surface. So, we will start our review after that code. GlUniformMatrix4fv(uProjectionMatrix, 1, false, &projMatrix.m) Īll the code up til the function call glEnableVertexAttribArray(maVertices) should be the same as the first demo. Int uProjectionMatrix = glGetUniformLocation(progId, "uProjectionMatrix")

GLKMatrix4 projMatrix = GLKMatrix4MakeOrtho(-halfWidth, halfWidth, -halfHeight, halfHeight, -1, 1) MaVertices = glGetAttribLocation(progId, "aVertices") MaColor = glGetAttribLocation(progId, "aColor") Lets start our code review with the initGL function. If you need to review any of the previous files or function code you can re-read the previous demo. Additionally, the DemoViewController init function remains the same as the previous demo so we will not be reviewing that function. These files remain unchanged for this demo so we will only be reviewing the DemoViewController.m file. In the first demo we reviewed the code in the GraphicsUtils.m file, AppDelegate.m file, basic.fsh file and basic.vsh file. We will also be changing some of the settings from the first demo but don't worry as we will review all the necessary code. In this demo we will use a different function, glDrawElements, to draw a single quad to the screen. In our first demo we rendered 3 quads in Open GL ES 2.0 using the function glDrawArrays. Although the first demo is very basic it is essential to know the foundation of setting up the projects as everything we do will be built on top of that foundation. If you are not familiar with our helper classes or the basic setup for OpenGL ES 2.0 on iOS please review the previous demo so you can familiarize yourself. This demo is also about basic drawing but it will cover a different approach to the drawing. In the first demo we reviewed basic drawing in OpenGL ES 2.0.
#Opengl 2.0 download android series#
Hello and welcome to the second demo in a series of OpenGL ES 2.0 Demos.
