Hi everyone,
I am trying to display some static text in my OpenGL program using
wglUseFontBitmaps. The string displays correctly but the quality is
really bad. I have specified ANTIALIASED_QUALITY in my CreateFont
command.
I have been searching the groups and people have been suggesting to
load this font into a texture. I am very new to OpenGL and have not yet
been able to successfully do it. I would really appreciate it if
someone could guide me as to how to do it.
I am only interested in displaying the string in a presentable manner.
That is all...
I would really appreciate some help.....
Thanks and cheers,
xargy
|
|
0
|
|
|
|
Reply
|
pankajdaga (63)
|
12/9/2005 12:47:47 PM |
|
xargon wrote:
> really bad. I have specified ANTIALIASED_QUALITY in my CreateFont
start here:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13
Jan.
|
|
0
|
|
|
|
Reply
|
Jan
|
12/9/2005 1:28:25 PM
|
|
That is what I used. As you can see from the example, the rendered font
quality is really bad...
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/9/2005 1:37:49 PM
|
|
"Jan Woetzel" <user@domain.invalid> schrieb im Newsbeitrag
news:43998679.5020407@domain.invalid...
> xargon wrote:
>> really bad. I have specified ANTIALIASED_QUALITY in my CreateFont
>
> start here:
> http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13
>
> Jan.
it creates glBitmaps, which are 2 color only (black/white), so how
would you antialias them?
Du use a texture font with glBegin(GL_QUADS), that's platform
independent, too.
-Gernot
|
|
0
|
|
|
|
Reply
|
Gernot
|
12/9/2005 2:27:30 PM
|
|
Hi Gernot,
Could you give a bit more detail on how to use it?
Cheers,
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/9/2005 6:42:23 PM
|
|
"xargon" <pankajdaga@excite.com> schrieb im Newsbeitrag
news:1134153743.814267.72180@f14g2000cwb.googlegroups.com...
> Hi Gernot,
>
> Could you give a bit more detail on how to use it?
>
> Cheers,
> xargy
>
Nehe 17:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17
shows the basics about it.
You simply render each character as a quad, setting the texture
coordinates to the corresponding char in you bitmap that looks like:
_______________
0123456789*+,.
ABCDEFGHJKLMNOP
QRSTUVWXYZabcde
fghijklmnopqrst
uvwxyz_()[]~
---------------
or so.
|
|
0
|
|
|
|
Reply
|
Gernot
|
12/9/2005 7:51:05 PM
|
|
Ahhhhhhhh... ok, I think I got it now...Thanx!
|
|
0
|
|
|
|
Reply
|
xargon
|
12/9/2005 7:52:51 PM
|
|
xargon wrote:
> I am only interested in displaying the string in a presentable
> manner. That is all...
Take a look at Lev Povlahev's Website <http://www.levp.de>. He's
hosting a texture mapped font renderer there, along with an old
one of me I once hacked it in a quick and dirty fashion (Win32
only). I also addes support for loading special font textures,
but dropped this only a few weeks later in favour of
implementing a Freetype based font renderer, that renders a
whole text into a drawable, e.g. texture, which is then used.
The reason for this change in design was, that I want my apps
being i18n-able, and thus Unicode is a must. However a full
unicode texture fontmap would require 256x256 character cells,
each at least 16x16 pixels for standard text plus mipmaps, if
you want clean rendering also for smaller sizes. No graphics
card can hold such a texture. It's far easier to render the text
using Freetype into a texture (eventually a Pixel Buffer
Object), and then just render this; also the text rendering
quality is better for sizes not equal the ones in the texture.
Wolfgang Draxinger
--
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
12/10/2005 3:06:50 PM
|
|
Hi Wolfgang,
Thanks. This looks very interesting.
However, can I use it with regular fonts that are installed with
Windows. I see that you have to supply a path to a font map file. Is it
a path to a true type font file?
Thanks,
Cheers,
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/10/2005 3:49:15 PM
|
|
xargon wrote:
> Hi Wolfgang,
>
> Thanks. This looks very interesting.
>
> However, can I use it with regular fonts that are installed
> with Windows. I see that you have to supply a path to a font
> map file. Is it a path to a true type font file?
An older version was using the windows font API directly. The
fontmap files are greyscale bitmap with a font metrics header
and mipmaps for smaller scales.
Gladly I'm never putting even my oldest stuff on CD-R or DVD-R
where it might rot in some dark, dusty corner, but instead I
just buy new HDD and take care of proper backup I was able to
find an fully featured version of that thing and put it here:
http://www.cip.physik.uni-muenchen.de/~draxinge/stuff/cfontmap.tar.bz2
I don't use it anymore, since it works only with Windows fully
(the Fontmap files were an attempt for plattform independency,
but then came i18n and I never finished it). You canuse it t
generate Fontmaps under Windows and then use those with other
plattforms, though.
Wolfgang Draxinger
--
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
12/10/2005 4:46:25 PM
|
|
Wow...danke sehr! Thanks a lot!
|
|
0
|
|
|
|
Reply
|
xargon
|
12/10/2005 4:54:39 PM
|
|
Hi again,
I was wondering if I can ask you another question. You seem to be an
expert and I have been researching online for a while now, with no
luck. Do you happen to know how one can draw a rectangle with rounded
borders in OpenGL? I have been trying all day to achieve that, but with
no luck..
Thanks,
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/10/2005 8:10:20 PM
|
|
xargon wrote:
> Hi again,
>
> I was wondering if I can ask you another question. You seem to
> be an expert and I have been researching online for a while
> now, with no luck. Do you happen to know how one can draw a
> rectangle with rounded borders in OpenGL? I have been trying
> all day to achieve that, but with no luck..
Well, a rectagle with rounded corners is not an rectangle.
OpenGL by itself only supports finite, linear, nonconvex
primitives (triangles, quads, planar polygons), bezier curves
and patches. For everything else you must create the shape
yourself.
AFAIK supports latest consumer HW curves, so you could use those
to render such a rectangle. Or you create the shape yourself,
which is really easy. All you have to do is to shorten each
rectangle edge by the the double radius of the corner curvature.
The roundings are created with sin and cos.
Wolfgang Draxinger
--
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
12/10/2005 10:02:01 PM
|
|
Hi Wolfgang,
If it is not too trouble, could you give an example of the technique
you mentioned. I am really struggling with the OpenGL syntax and the
geometric mathematics that is involved with this. I would really
appreciate it, if it is not too much trouble for you.
Cheers and thanks,
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/10/2005 10:08:36 PM
|
|
Ok, I tried something like this. It got close to what I want, but the
joins look a bit jagged. If someone can help me further improve it, I
would be greateful!
glPointSize(10.0);
// disable blending
glDisable(GL_BLEND);
// turn on anti-aliasing
glEnable(GL_POINT_SMOOTH);
// enable use of alpha function
glEnable(GL_ALPHA_TEST);
// alpha comparison
glAlphaFunc(GL_GREATER, 0.5);
glBegin(GL_POINTS);
// draw anti-aliased vertices with the alpha function on..
glVertex2f(50.0, 10.0);
glVertex2f(50.0, 30.0);
glVertex2f(150.0, 10.0);
glVertex2f(150.0, 30.0);
glEnd();
glDisable(GL_POINT_SMOOTH);
glLineWidth(10.0);
glBegin(GL_LINES);
glVertex2f(50.0, 10.0);
glVertex2f(50.0, 30.0);
glVertex2f(150.0, 10.0);
glVertex2f(150.0, 30.0);
glVertex2f(50.0, 10.0);
glVertex2f(150.0, 10.0);
glVertex2f(50.0, 30.0);
glVertex2f(150.0, 30.0);
glEnd();
glRectf(50.0, 10.0, 150.0, 30.0);
glDisable(GL_ALPHA_TEST);
glDisable(GL_POINT_SMOOTH);
xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/10/2005 11:30:24 PM
|
|
Hi,
I was wondering if it is possible to draw the rounded edges with a
berier curve or something like that... Any thoughts?
|
|
0
|
|
|
|
Reply
|
xargon
|
12/11/2005 12:26:56 AM
|
|
xargon wrote:
> Hi,
>
> I was wondering if it is possible to draw the rounded edges with a
> berier curve or something like that... Any thoughts?
>
Take a look to Amanith ( http://www.amanith.org )
You need:
- the code to handle a bezier (or any other curve)
- the code to flatten that (reduce to a polyline)
- for a generic shape a tessellator (to produce triagles from the contour)
for a round-rectangle a GL_POLYGON could be sufficient.
In Amanith all this stuff is already done, we have also introduced a drawboard class in OpenVG style to render 2d things
on top of OpenGL, with support of fill/stroke with color, gradients (linear/radial/conical), patterns, etc, etc, etc...
For this features please use the SVN, or wait the 0.2 version (coming the next week).
Ska - Amanith Team
|
|
0
|
|
|
|
Reply
|
Michele
|
12/11/2005 6:26:37 PM
|
|
for a generic shape a tessellator (to produce triagles from the
contour) for a round-rectangle a GL_POLYGON could be sufficient.
Hi,
Could you elaborate a bit more on that... Going through AmiNath would
take me forever and I am afraid my capabilities in OpenGL are at a very
novice level...
Thanks,xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/11/2005 7:26:47 PM
|
|
Or, if it is possible, maybe you can point me to the code in Amanith
that might be useful for me...
Thanks, xargy
|
|
0
|
|
|
|
Reply
|
xargon
|
12/11/2005 7:29:00 PM
|
|
xargon wrote:
> Or, if it is possible, maybe you can point me to the code in Amanith
> that might be useful for me...
>
> Thanks, xargy
>
----------------------------------------------------------------------------
(bezier flattening)
http://www.amanith.org/documents/class_amanith_1_1_g_bezier_curve2_d.php#a22
/amanith/src/2d/gbeziercurve2d.cpp
----------------------------------------------------------------------------
(polygon tesselation)
http://www.amanith.org/documents/class_amanith_1_1_g_tesselator2_d.php#a2
/amanith/src/2d/gtesselator2d.cpp
----------------------------------------------------------------------------
for the coming drawboard please refer to the SVN:
(high level drawing functions)
http://svn.berlios.de/wsvn/amanith/trunk/include/amanith/rendering/gdrawboard.h?op=file&rev=0&sc=0
----------------------------------------------------------------------------
Ska - Amanith Team
|
|
0
|
|
|
|
Reply
|
Michele
|
12/12/2005 7:46:53 AM
|
|
|
19 Replies
327 Views
(page loaded in 0.248 seconds)
Similiar Articles: True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ...Hi everyone, I am trying to display some static text in my OpenGL program using wglUseFontBitmaps. The string displays correctly but the quality is r... font smoothing - comp.graphics.api.openglTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... font smoothing - comp.graphics.api.opengl True type anti aliased fonts in OpenGL - comp.graphics.api ... 16x16 bitmap font - comp.fontsTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ..... texture fontmap would require 256x256 character cells, each at least 16x16 ... text in OpenGL - comp.graphics.api.openglTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Hi everyone, I am trying to display some static text in my OpenGL program using wglUseFontBitmaps. Change field font color wjen past due - comp.databases.filemaker ...True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... font smoothing - comp.graphics.api.opengl True type anti aliased fonts in OpenGL - comp.graphics.api ... Displaying curvature continuous edges in drawings? - comp.cad ...True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Hi everyone, I am trying to display some ... do is to shorten each rectangle edge by the the double ... spherical texture mapping in OpenGL - comp.graphics.api.opengl ...True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... spherical texture mapping in OpenGL - comp.graphics.api.opengl ... True type anti aliased fonts in ... Changing the Viewpoint - OpenGL and Cg - comp.graphics.api.opengl ...font smoothing - comp.graphics.api.opengl... and then they actually change their minds and you never hear that old view ... api.opengl True type anti aliased fonts in ... Strange Texture Problem - comp.graphics.api.openglTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Strange Texture Problem - comp.graphics.api.opengl True type anti aliased fonts in OpenGL - comp ... Creating a color map with opengl - comp.graphics.api.opengl ...True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Creating a color map with opengl - comp.graphics.api.opengl ... True type anti aliased fonts in ... GL_POINTS & Textures - comp.graphics.api.openglYes OpenGL does have some kind of extensions ... SPRITE_ARB,GL_COORD_REPLACE_ARB,GL_TRUE ... POINTS & Textures - comp.graphics.api.opengl sgplot series repeated line type ... Draw jagged lines? - comp.graphics.apps.paint-shop-proTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Do you happen to know how one can draw a rectangle with ... got close to what I want, but the joins ... text in sketch for engraving - comp.cad.solidworksTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... text in sketch for engraving - comp.cad.solidworks Raster Color - comp.graphics.api.opengl Hello, I ... Wireframe rendering? - comp.cad.solidworksTrue type anti aliased fonts in OpenGL - comp.graphics.api.opengl ... Wireframe rendering? - comp.cad.solidworks True type anti aliased fonts in OpenGL - comp.graphics.api ... Linear Pattern Problem - comp.cad.solidworksInitialMagnification is linear? - comp.soft-sys.matlab Perhaps you may have a little aliasing (moire pattern) but I doubt it. ... source code to solve linear problems ... True type anti aliased fonts in OpenGL - comp.graphics.api.opengl ...Hi everyone, I am trying to display some static text in my OpenGL program using wglUseFontBitmaps. The string displays correctly but the quality is r... Anti-aliased True type fonts in OpenGL: opengl, font, type, trueHi everyone, I am trying to display some static text in my OpenGL program using wglUseFontBitmaps. The string displays correctly but the quality is really bad. I have ... 7/24/2012 4:04:48 PM
|