Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===================================Buffer1========================================
- glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
- glUseProgram(_FaceShader);
- // 2
- glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
- glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));
- glVertexAttribPointer(_texCoordSlot, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 7));
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, _floorTexture);
- glUniform1i(_textureUniform, 0);
- // 3
- glDrawElements(GL_TRIANGLES, sizeof(Indices)/sizeof(Indices[0]), GL_UNSIGNED_BYTE, 0);
- //===================================Buffer2========================================
- glUseProgram(_FaceShader);
- glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer2);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer2);
- glActiveTexture(GL_TEXTURE0); // unneccc in practice
- glBindTexture(GL_TEXTURE_2D, _fishTexture);
- glUniform1i(_textureUniform, 0); // unnecc in practice
- glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
- glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));
- glVertexAttribPointer(_texCoordSlot, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 7));
- glDrawElements(GL_TRIANGLE_STRIP, sizeof(Indices2)/sizeof(Indices2[0]), GL_UNSIGNED_BYTE, 0);
- //===================================Buffer3========================================
- //[_context presentRenderbuffer:GL_RENDERBUFFER];
- // draw a line
- glBindBuffer(GL_ARRAY_BUFFER, _lineBuffer);
- glUseProgram(_LineShader);
- glVertexAttribPointer(_linepositionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex),0);
- glVertexAttribPointer(_linecolorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));
- //glVertexAttribPointer(_texCoordSlot, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 7));
- glLineWidth(5.0);
- glDrawArrays(GL_LINES, 0, 2);
- [_context presentRenderbuffer:GL_ARRAY_BUFFER];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement