func renderToScreen() { gl.BindFramebuffer(gl.FRAMEBUFFER, 0) gl.Viewport(0, 0, winWidth, winHeight) gl.UseProgram(shaderTextureDisplay.glProg) gl.BindTexture(gl.TEXTURE_2D, rttFrameTex) gl.Uniform1i(shaderTextureDisplay.unifTex, 0) gl.BindBuffer(gl.ARRAY_BUFFER, dispVertBuf) gl.EnableVertexAttribArray(shaderTextureDisplay.attrPos) gl.VertexAttribPointer(shaderTextureDisplay.attrPos, 3, gl.FLOAT, gl.FALSE, 0, gl.Pointer(nil)) gl.DrawArrays(gl.TRIANGLE_FAN, 0, 4) gl.DisableVertexAttribArray(shaderTextureDisplay.attrPos) gl.BindBuffer(gl.ARRAY_BUFFER, 0) }
func renderToTexture() { gl.BindFramebuffer(gl.FRAMEBUFFER, rttFrameBuf) gl.Viewport(0, 0, texWidth, texHeight) gl.ClearColor(0.1, 0.2, 0.3, 1) gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.UseProgram(shaderTextureCreator.glProg) gl.BindTexture(gl.TEXTURE_3D, volTex) gl.Uniform1i(shaderTextureCreator.unifTex, 0) gl.BindBuffer(gl.ARRAY_BUFFER, rttVertBuf) gl.EnableVertexAttribArray(shaderTextureCreator.attrPos) gl.VertexAttribPointer(shaderTextureCreator.attrPos, 2, gl.FLOAT, gl.FALSE, 0, gl.Pointer(nil)) gl.DrawArrays(gl.TRIANGLE_FAN, 0, 4) gl.DisableVertexAttribArray(shaderTextureCreator.attrPos) gl.BindBuffer(gl.ARRAY_BUFFER, 0) }