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

后端 未结 5 1106
陌清茗
陌清茗 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:08

    glEnable( GL_SCISSOR_TEST );
    glScissor( 5, 5, 1, 1 ); /// position of pixel
    glClearColor( 1.0f, 1.0f, 1.0f, 0.0f ); /// color of pixel
    glClear( GL_COLOR_BUFFER_BIT );
    glDisable( GL_SCISSOR_TEST );
    

    By changing last 2 arguments of glScissor you can also draw pixel perfect rectangle.

提交回复
热议问题