• Content count

  • Joined

  • Last visited

Community Reputation

103 Neutral

About ilyazyilmaz

  • Rank
  1. OpenGL glReadPixels Z value

    Thanks for your interest... Actually your code and my code is nearly same except :  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);   But I use in my project OPENGL C# wrapper. And C# wrapper is very old :   Maybe this wrapper is old and it has bug. I dont know. I decided to use OPENTK SDK for c#.   if you have any advice OPENGL SDK for c# . Or which OPENGL sdk is good for CAD .
  2. OpenGL glReadPixels Z value

    thanks for your reply.   Also I found this code on the web. it seems works. But maybe reason could be my dll files. I use very old dll files.   may be dll files has a problem.     I prepared simple interface to testing the codes. There is source code and exe files. Project name DXFTOOPENGL.EXE. If you have time Could you look for help? If you dont have a time no problem. The project link:
  3. Hello I want to conver screen coordinate to OPENGL coordinate. but glReadPixels  function doesnt work . I'm using c#. For two days I couldnt solve this problem. the code is below:               void ikt_viewPort3d_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)         {             unsafe             {                 float winX, winY, winZ;                 isClicked= true;                 Int32[] viewPort = new Int32[4];                 GL.glGetIntegerv(GL.GL_VIEWPORT, viewPort);                 double[] modelView = new double[16];                 GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelView);                 double[] projection = new double[16];                 GL.glGetDoublev(GL.GL_PROJECTION_MATRIX, projection);                 winX = eXPre = (float)e.X;                 winY = eYPre = (float)e.Y;                 winY = viewPort[3] - winY;                 byte[] byt = new byte[4];                 uint[] pix=new uint[1];                 GL.glReadPixels((int)winX, (int)winY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, byt);                 winZ = System.BitConverter.ToSingle(byt, 0);                 double objX, objY, objZ;                 GL.gluUnProject(winX, winY, winZ, modelView, projection, viewPort, out objX, out objY, out objZ);                 MessageBox.Show("x : " + winX.ToString() + "y: " + winY.ToString() + "z: " + winZ.ToString());                 MessageBox.Show("x : " + objX.ToString() + "y: " + objY.ToString() + "z: " + objZ.ToString());             }           }   I'm waiting your answer . Thanks....The solution is very valuable for me.