Last active
August 29, 2015 14:07
-
-
Save SimonDanisch/0aac827dae5b60a8e51a 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
using GLPlot | |
xx=[1 2 3 4; | |
1 2 3 4; | |
1 2 3 4]; | |
yy=[2 2 2 2;4 4 4 4;6 6 6 6] | |
vals=ones(3,4) | |
colorf(m)="xyz.z>0 ? vec4(.2,.4,0.5+"string(m)"*xyz.z,0.98) : vec4(.2,.4-"*string(1.2m)"*xyz.z,0.5,0.98);" # <- forgot * | |
function glupdatewindow(obj,window) | |
yield() # <- I notice, that yield should come first | |
ModernGL.glClear(ModernGL.GL_COLOR_BUFFER_BIT | ModernGL.GL_DEPTH_BUFFER_BIT) | |
GLAbstraction.render(obj) | |
Main.GLFW.SwapBuffers(window.glfwWindow) | |
Main.GLFW.PollEvents() | |
obj,window | |
end | |
window = GLPlot.createdisplay(w=1000,h=1000,eyeposition=GLAbstraction.Vec3(1.,1.,1.), lookat=GLAbstraction.Vec3(0.,0.,0.)) | |
m=0.5./maximum(abs(vals)) | |
ModernGL.glClearColor(1,1,1,0) | |
obj = GLPlot.glplot(map(GLAbstraction.Vec1,vals) , xrange=float32(xx),yrange=float32(yy),primitive=GLPlot.SURFACE(), color=colorf(m)) | |
glupdatewindow(obj,window) | |
zvalues = obj.uniforms[:z] | |
zvalues[1:2, 1:2] = float32(vals[1:2,1:2]*=2) | |
glupdatewindow(obj,window); | |
renderloop(window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment