Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2012 13:52
Show Gist options
  • Save anonymous/4328136 to your computer and use it in GitHub Desktop.
Save anonymous/4328136 to your computer and use it in GitHub Desktop.
varying lowp vec4 DestinationColor; // 1
void main(void) { // 2
gl_FragColor = DestinationColor; // 3
}
- (void) render {
glClearColor(0, 104.0/255.0, 55.0/255.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
// 1
glViewport(0, 0, self.frame.size.width, self.frame.size.height);
// 2
glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE,
sizeof(Vertex), 0);
// glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE,
// sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));
float color[4] = {1,1,1,1};
glUniform4fv(_colorSlot, 4, color);
// 3
glDrawElements(GL_TRIANGLES, sizeof(Indices)/sizeof(Indices[0]),GL_UNSIGNED_BYTE, 0);
[_context presentRenderbuffer:GL_RENDERBUFFER];
}
attribute vec4 Position; // 1
attribute vec4 SourceColor; // 2
varying vec4 DestinationColor; // 3
uniform mat4 Projection;
void main(void) { // 4
DestinationColor = SourceColor; // 5
gl_Position = Position; // 6
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment