예제 #1
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func Init(fern float64) { // called by points.Start ()
	//
	const (
		D   = 2.0 // -fache Bildschirmbreite
		nah = C.GLdouble(0.2)
	)
	if !initialized {
		initialize()
	}
	C.glMatrixMode(C.GL_PROJECTION)
	C.glLoadIdentity()
	deg := D * math.Atan((0.5/D)/scr.Proportion())
	deg /= 0.9 // experimentelle Weitwinkelkorrektur
	var m [4][4]C.GLdouble
	m[1][1] = 1.0 / C.GLdouble(math.Tan(deg)) // Cot
	m[0][0] = m[1][1] / C.GLdouble(scr.Proportion())
	//  delta:= C.GLdouble(fern) - nah
	//  m[2][2] = - (C.GLdouble(fern) + nah) / delta
	//  m[2][3] = GLdouble(-1.0)
	//  m[3][2] = -2. * nah * C.GLdouble(fern) / delta
	m[2][2] = C.GLdouble(-1.0)
	m[2][3] = C.GLdouble(-1.0)
	m[3][2] = C.GLdouble(-1.0) * nah
	C.glMultMatrixd(&m[0][0])
	//  q:= C.GLdouble(0.75)
	//  GLFrustum (-1.0 * nah, 1.0 * nah, -q * nah, q * nah, 1.0 * nah, C.GLdouble(fern))
	C.glMatrixMode(C.GL_MODELVIEW)
}
예제 #2
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func Write0() {
	//
	if !initialized {
		initialize()
	}
	if !scr.UnderX() {
		ker.Stop(pack, 1)
	}
	C.glMatrixMode(C.GL_MODELVIEW)
	C.glLoadIdentity()
	for i := 0; i < 3; i++ {
		matrix[i][0] = C.GLdouble(right[i])
		matrix[i][1] = C.GLdouble(top[i])
		matrix[i][2] = C.GLdouble(-front[i])
	}
	C.glMultMatrixd(&matrix[0][0])
	C.glTranslated(C.GLdouble(-eye[0]), C.GLdouble(-eye[1]), C.GLdouble(-eye[2]))
	C.glClear(C.GL_COLOR_BUFFER_BIT + C.GL_DEPTH_BUFFER_BIT)
	for n := uint(0); n < MaxL; n++ {
		if lightInitialized[n] {
			ActualizeLight(n)
		}
	}
	C.glBegin(POINTS)
	nn = 0
}
예제 #3
0
파일: matrix.go 프로젝트: Nvveen/gl
//void glLoadIdentity (void)
func LoadIdentity() {
	C.glLoadIdentity()
}