开发者

In OpenGL, how can I determine the current drawing position?

I开发者_如何学Python am trying to apply a scissor transformation over a specific part of my application. The problem is, I don't know the window coordinates, so I don't know exactly where to place the scissor.

Is there an OpenGL state variable that would tell me where the current drawing position is?


The "current drawing position" in OpenGL is somewhat undefined. I'll assume you are referring to the projection and model-view matrices, which transform the drawn vertices. If you are using simple 2D transformations, you can get those matrices using glGetFloatv and GL_MODELVIEW_MATRIX or GL_PROJECTION_MATRIX, and then attempt to extract the transformation that was applied from the resulting matrix.


You mean, the current raster position? You can get it using glGetIntegerv, but it's applied to a very limited set of commands. Normal drawing using glDrawArrays or immediate mode is unaffected by the raster position.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜