开发者

Draw stroke characters with outlines in openGL

开发者 https://www.devze.com 2023-03-26 12:20 出处:网络
I am using openGL to draw fonts.My fonts need to be rotatable and I cannot use glut, so I created a static class that has vertex lists for every needed character.I then render these using GL_LINE_STRI

I am using openGL to draw fonts. My fonts need to be rotatable and I cannot use glut, so I created a static class that has vertex lists for every needed character. I then render these using GL_LINE_STRIP.

Recently I've been asked to allow my characters to have outlines, sort of like they would if you went into word, created a bold character and then u开发者_JS百科nder Font, gave it an outline.

Not sure how to put a picture of that in stack overflow.

I was wondering if there was a way to do that given my current method of drawing characters using lines. Is it possible to have a line border, or is that inherently nonsense?


Two passes:

const float OUTLINE_WIDTH = 3.0f;
const float INNER_WIDTH = 1.0f;

glLineWidth( OUTLINE_WIDTH );
glColor3ub( outline.r, outline.g, outline.b );
DrawText();

glLineWidth( INNER_WIDTH );
glColor3ub( inner.r, inner.g, inner.b );
DrawText();
0

精彩评论

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