Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
// Note in order t use this code in the iOS Opengl Project Template, // 1. The vertex shader needs to be updated to take a ModelViewMatrix as input. // 2. The fragment shader needs to be edited to accept color as a uniform instead of a varying - (void)render { static const GLfloat xAxes = { 0.0f, 0.0f, 0.0f, 0.75f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.75f, 0.0f, 0.0f }; static const GLfloat yAxes = { 0.0f, 0.0f, 0.0f, 0.0f, 0.75f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.75f, 0.0f }; static const GLfloat zAxes = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.50f }; GLfloat vRed = {1.0f, 0.0f, 0.0f, 1.0f}; GLfloat vGreen = {0.0f, 1.0f, 0.0f, 1.0f}; GLfloat vBlue = {0.0f, 0.0f, 1.0f, 1.0f}; GLfloat vTorquise = {0.60f, 0.40f, 0.80f, 1.0f}; GLfloat vBlack = {0.0f, 0.0f, 0.0f, 1.0f}; GLfloat mvpMatrixZRotation; GLfloat cosTheta = cosf(0.261f); // 15 degrees is 0.261 radians GLfloat sinTheta = sinf(0.261f); //------------------------------------- mvpMatrixZRotation = cosTheta;//1.0f; mvpMatrixZRotation = -sinTheta;//0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = sinTheta;//0.0f; mvpMatrixZRotation = cosTheta; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 1.0f;//1.0f;//cosTheta; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 0.0f; mvpMatrixZRotation = 1.0f; // This application only creates a single context which is already set current at this point. // This call is redundant, but needed if dealing with multiple contexts. ; // This application only creates a single default framebuffer which is already bound at this point. // This call is redundant, but needed if dealing with multiple framebuffers. glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer); glViewport(0, 0, backingWidth, backingHeight); glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // Use shader program glUseProgram(program); // Update uniform value glUniformMatrix4fv(uniforms, 16, GL_FALSE, mvpMatrixZRotation); glUniform4fv(uniforms, 4, vRed); glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, 0, 0, xAxes); glEnableVertexAttribArray(ATTRIB_VERTEX); glDrawArrays(GL_LINES, 0, 2); glUniform4fv(uniforms, 4, vBlue); glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, 0, 0, yAxes); glEnableVertexAttribArray(ATTRIB_VERTEX); glDrawArrays(GL_LINES, 0, 2); glUniform4fv(uniforms, 4, vGreen); glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, 0, 0, zAxes); glEnableVertexAttribArray(ATTRIB_VERTEX); glDrawArrays(GL_LINES, 0, 2); // This application only creates a single color renderbuffer which is already bound at this point. // This call is redundant, but needed if dealing with multiple renderbuffers. glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer); ; } |