ERP's picture

No OpenTK equivalent to Glu.PickMatrix()

Project:The Open Toolkit library
Version:all versions
Category:feature request

Library reports that Glu.XXX functions are deprecated and we should use the OpenTK.XXX equivalents.
There is no OpenTK.XXX equivalent for Glu.PickMatrix.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


Glu.PickMatrix() modifies the matrix stack, which means it cannot be added to OpenTK as-is (the math library cannot use GL calls directly).

Fortunately, the source code for this function is very simple:

// Translated to OpenTK
public void PickMatrix(double x, double y, double deltax, double deltay, int[] viewport)
    if (deltax <= 0 || deltay <= 0) { 
    /* Translate and scale the picked region to the entire window */
    GL.Translate((viewport[2] - 2 * (x - viewport[0])) / deltax,
	    (viewport[3] - 2 * (y - viewport[1])) / deltay, 0);
    GL.Scale(viewport[2] / deltax, viewport[3] / deltay, 1.0);
ERP's picture


I don't have a problem with it not being as-is.
I was assuming it would be implemented along the lines of the existing OpenTK.LookAt/OpenTK.Perspective.