开发者

Using OpenGL drawing operations in an object-oriented setting?

I've been plowing through basic shaders and whatnot for an application I'm writing, and I've been having trouble figuring out a high-level organiza开发者_开发技巧tion for the drawing calls.

I'm thinking of having a singleton class which implements a number of basic drawing operations, taking data from "user" classes and passing that to the appropriate opengl calls.

I'm wondering how people do this when writing their own applications, as the internet is chock full of basic "Your first shader" tutorials, but very little on suggested organization of drawing code.

My particular environment is targeted at iPad/OpenGL ES 2.0, but I think the question stands for most environments.


If you see Drawing Applications / Libraries like Qt (QPainter), Cairo, and Others, the main concept is to create a class Context + Painter that embed at least the basic drawing operations. Singleton is heavily discouraged because you could end up wanting to have multiple Contexts (for example at different scales).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜