Created
April 3, 2014 15:17
-
-
Save SimonDanisch/9956363 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function position_transformation(mvp::Matrix{Float32}, vertices::Vector3) | |
return mvp * Vector4(vertices, 1f0) | |
end | |
cam = PerspectiveCamera(....) | |
color = Vector4(0, 1, 0, 1) | |
vertShader = [ | |
"vertices" => GLBuffer([Vector3(0, 1, 0), Vector3(0, 1, 0), Vector3(0, 0, 0)], primitiveMode = GL_TRIANGLES, drawMode = GL_STATIC_DRAW), | |
"mvp" => cam, | |
"gl_Position" => (position_transformation, (mvp::Matrix{Float32}, vertices::Vector3)) | |
] | |
fragShader = [ | |
"color" => color | |
"gl_FragColor" => (color::Vector4 -> color, (color::Vector4)) | |
] | |
#Make the render object | |
renderTest = GLRenderObject(vertShader, fragShader) | |
#Define how you want to render the vertex array | |
push!(renderTest.postRenderFunctions, (x -> glDrawArrays(x.vertArray.primitiveMode, 0, x.vertArray.size), (renderTest,))) | |
#register some action that manipulates the camera | |
registerEventAction(EventAction{MouseClicked}(x -> x.key == MOUSE_MIDDLE_DOWN || x.key == MOUSE_MIDDLE_UP, (), zoom, (cam,))) | |
#I don't have any code for this, but this should be fairly easy to implement | |
registerSlider(color) | |
#and then finally inside the glDrawLoop | |
render(renderTest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment