示例#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 glMultMatrixd (const float64 *m)
func MultMatrixd(m []float64) {
	if len(m) != 16 {
		panic(ErrorInputSize)
	}
	C.glMultMatrixd((*C.GLdouble)(&m[0]))
}
示例#4
0
//void glMultMatrixd (const float64 *m)
func MultMatrixd(m *[16]float64) {
	C.glMultMatrixd((*C.GLdouble)(&m[0]))
}