Exemple #1
0
// Project object coordinates to screen coordinates.
func Project(objx, objy, objz float64, model, proj []float64, view []int32) (x, y, z float64) {
	var wx, wy, wz C.GLdouble
	C.gluProject(
		C.GLdouble(objx), C.GLdouble(objy), C.GLdouble(objz), (*C.GLdouble)(&model[0]),
		(*C.GLdouble)(&proj[0]), (*C.GLint)(&view[0]), &wx, &wy, &wz,
	)
	return float64(wx), float64(wy), float64(wz)
}
Exemple #2
0
func Project(projX, projY, projZ float64, model, proj *[16]float64, view *[4]int32) (float64, float64, float64) {
	var ox, oy, oz C.GLdouble

	m := (*C.GLdouble)(unsafe.Pointer(model))
	p := (*C.GLdouble)(unsafe.Pointer(proj))
	v := (*C.GLint)(unsafe.Pointer(view))

	C.gluProject(
		C.GLdouble(projX),
		C.GLdouble(projY),
		C.GLdouble(projZ),
		m,
		p,
		v,
		&ox,
		&oy,
		&oz,
	)

	return float64(ox), float64(oy), float64(oz)
}