Example #1
0
func (this *Window) reshape(w, h int) {
	gl.Viewport(0, 0, w, h)
	ratio := Double(w) / Double(h)
	var znear, zfar, fovx Double = 0.01, 65536.0, 80.0
	this.projectionMatrix = mat4.Projection(fovx.ToRad(), ratio, znear, zfar)
	if globals.UseShader {
		program.SetProjectionMatrix(this.projectionMatrix)
		program.SetFarClipplane(zfar)
	}
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.LoadMatrixd(this.projectionMatrix.Ptr())
	gl.MatrixMode(gl.MODELVIEW)
}
Example #2
0
func (this *Window) reshape(w, h int) {
	gl.Viewport(0, 0, w, h)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	ratio := float64(w) / float64(h)
	znear, zfar, fovx := 0.01, 65536.0, 80.0
	/*var top, bottom, left, right float64
	right = znear * math.Tan(DegToRad(.5*fovx))
	left = -right
	top = right/ratio
	bottom = -top
	gl.Frustum(left,right,bottom,top,znear, zfar)//*/
	this.projectionMatrix = mat4.Projection(DegToRad(fovx), ratio, znear, zfar)
	gl.LoadMatrixd(this.projectionMatrix.Ptr())
	gl.MatrixMode(gl.MODELVIEW)
}
Example #3
0
func GlLoadMat4(m *mat4.Mat4) { gl.LoadMatrixd(m.Ptr()) }
Example #4
0
func (m *Mat4) GlLoad() { gl.LoadMatrixd(m.Ptr()) }