convert pixel to centimeter openGL

0

I need to change an object to where the mouse is clicked, I'm trying to do with a starting point. I already managed to capture the position of the mouse but it comes in pixel and I need that value in centimeter. Here is an excerpt of the code.

gl.glPointSize(5);
gl.glBegin(GL.GL_POINTS);        
gl.glColor3f(0f, 0f, 0f);   
    gl.glVertex2d(p1,p2);            
gl.glEnd();

Function that captures mouse position in pixel

public void mousePressed(MouseEvent e) {  
System.out.println("Evento do mouse");
switch (e.getButton()) {
    case MouseEvent.BUTTON1:              
       p1= e.getX();
       p2= e.getY();          
       break;   
}

}

    
asked by anonymous 19.07.2018 / 15:50

0 answers