开发者

Drawing a simple anti-aliased stickman in OpenGL

开发者 https://www.devze.com 2023-03-01 07:11 出处:网络
I would like to draw a simple 2D stickman on the screen. I also want it to be anti-aliased. The problem is that I want to use a bones system, which will be written after I would know how to draw the

I would like to draw a simple 2D stickman on the screen. I also want it to be anti-aliased.

The problem is that I want to use a bones system, which will be written after I would know how to draw the stickman itself based on the joints positions. This means I can't use sprites - I want my stickman to be full开发者_运维问答y controlable in the code.

It would be great if it will be possible to draw curves too.

Drawing a 3D stickman using a model would also be great if not better. The camera will be positioned like it's 2D, but I would still have depth. The problem is that I only have experience in Maya, and exporting and vertex weighting of the model in OpenGL seems like a mess...

I tried to find libraries for 2D anti-aliased drawing or enable multi-sampling and draw normally, but I had no luck. I also tried to use OpenGL's native anti-aliasing but it seems deprecated and the line joins are bad...

I don't want it to be too complicated because, well, it shouldn't be - it's just the first part of my program, and it's drawing a stickman...

I hope you guys can help me, I'm sure you know better than me :)


You could enable GL_SMOOTH. To check if you device supports your required line width for smooth lines, you can use glGet(GL_SMOOTH_LINE_WIDTH_RANGE);

If you want your code to be generic, you can also use antialiased textures. Take a look at this link

http://www.opengl.org/resources/code/samples/advanced/advanced97/notes/node62.html


The only way to get antialiasing is use GL library which knows how to get antialiased GL context, for example, SDL. As of stickman, you can draw him with colored polygons.

0

精彩评论

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

关注公众号