In OpenGL, can I draw a pixel that exactly at the coordinates (5, 5)?

后端 未结 5 1105
陌清茗
陌清茗 2021-02-19 06:35

By (5, 5) I mean exactly the fifth row and fifth column.

I found it very hard to draw things using screen coordinates, all the coordinates in OpenGL is relative, and usu

5条回答
  •  死守一世寂寞
    2021-02-19 07:16

    You can just change the "camera" to make 3D coordinates match screen coordinates by setting the modelview matrix to identity and the projection to an orthographic projection (see my answer on this question). Then you can just draw a single point primitive at the required screen coordinates.

    You can also set the raster position with glWindowPos (which works in screen coordinates, unlike glRasterPos) and then just use glDrawPixels to draw a 1x1 pixel image.

提交回复
热议问题