This file contains 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 render(x::RenderObject) | |
for elem in preRenderFunctions | |
elem[1](elem[2]...) | |
end | |
glUseProgram(x.shader.id) | |
render(x.uniforms, x.shader.id) | |
glBindVertexArray(x.vertArray.id) | |
for elem in postRenderFunctions |
This file contains 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 render(x::RenderObject) | |
for elem in preRenderFunctions | |
elem[1](elem[2]...) | |
end | |
glUseProgram(x.shader.id) | |
render(x.uniforms, x.shader.id) | |
glBindVertexArray(x.vertArray.id) | |
for elem in postRenderFunctions |
This file contains 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 render(x::RenderObject) | |
for elem in preRenderFunctions | |
elem[1](elem[2]...) | |
end | |
glUseProgram(x.shader.id) | |
render(x.uniforms, x.shader.id) | |
glBindVertexArray(x.vertArray.id) | |
for elem in postRenderFunctions |
This file contains 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
#Example for creating a Vertexshader | |
glslTypeConversion = [ | |
:Vector2 => "vec2", | |
:Vector3 => "vec3", | |
:Vector4 => "vec4", | |
:Float32 => "float" | |
] | |
function toVertShader(vertShader::Dict{String, Any}) | |
globals = ASCIIString[] |
This file contains 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), |
This file contains 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
#This can be made more usable with a lot of defaults | |
immutable GLRenderObject | |
vertexArray::GLVertexArray | |
uniforms::Dict{ASCIIString, Any} | |
shader::GLProgram | |
preRenderFunctions::Arrray{Tuple, 1}, | |
postRenderFunctions::Arrray{Tuple, 1} | |
function GLRenderObject( |
This file contains 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
#Parses header files for the GLDefinitions | |
using Match, DictUtils | |
include("parseGLFile.jl") | |
function writeDictFunctionsGLU(fs, dict) | |
write(fs, "#function bodies\n") | |
for elem in dict | |
write(fs, "@getCFun \"libGLU\" "*elem[1]* " " *elem[1]*elem[2]*"\n") |
This file contains 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
#Parses header files for the GLDefinitions | |
using Match, DictUtils | |
function writeDictFunctions(fs, dict) | |
write(fs, "#function bodies\n") | |
for elem in dict | |
expr = parse(elem[2]) | |
if expr.args[1].head == :tuple |
This file contains 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
using GLWindow, GLUtil, ModernGL, Meshes, Events, GLUT | |
createWindow(name="Mesh Display") | |
#Mesh creatin with Meshes.jl | |
function createSampleMesh() | |
N = 10 | |
sigma = 1.0 | |
distance = Float32[ sqrt(float32(i*i+j*j+k*k)) for i = -N:N, j = -N:N, k = -N:N ] | |
distance = distance + sigma*rand(2*N+1,2*N+1,2*N+1) |
This file contains 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
ERROR: Provider PackageManager failed to satisfy dependency libglut | |
in error at error.jl:21 | |
in satisfy! at C:\Users\Sim\.julia\v0.3\BinDeps\src\dependencies.jl:435 | |
in satisfy! at C:\Users\Sim\.julia\v0.3\BinDeps\src\dependencies.jl:421 | |
in anonymous at C:\Users\Sim\.julia\v0.3\BinDeps\src\dependencies.jl:465 | |
in include at boot.jl:244 | |
in include_from_node1 at loading.jl:128 | |
in process_options at client.jl:283 | |
in _start at client.jl:352 | |
while loading C:\Users\Sim\.julia\v0.3\GLUT\deps\build.jl, in expression starting on line 16 |
OlderNewer