Commit Graph

83 Commits

Author SHA1 Message Date
Robert Osfield
74cf034404 Unified more of the 2D and 3D text setup, fixed bugs in Text3D setup
which address the problems of black 3D text and the kerning causing problems with font positioning.
2011-01-11 11:39:31 +00:00
Robert Osfield
5849634082 Moved text color into TextBase, added support for colour into Text3D 2010-11-18 17:59:55 +00:00
Robert Osfield
cb08e7544e Fixed getEnableDepthWrites() naming. 2010-10-27 13:49:16 +00:00
Robert Osfield
b40acacf53 Moved set/getFont from Text/Text3D into TextBase 2010-09-29 11:34:55 +00:00
Robert Osfield
b4fda3a6da From March Sciabica, "Here is the solution I coded up over the weekend. For improved
performance option, I added a flag to control whether the depth writing
pass is performed.

Since text is alpha-blended when rendering, it is placed in the
transparent bin and rendered back to front. Writing to the depth buffer
should therefore be unnecessary. Indeed, rendering something behind text
(or any blended object) after that object is drawn will give incorrect
results whether the depth buffer is written or not. I therefore think it
is safe to keep this option off by default. Users can turn it on for any
special needs they have.

I did not fix the existing backdrop implementations to work with the new
code since this new method of rendering intrinsically handles backdrops
correctly. Its results are more accurate than all of the existing
backdrop implementations. Its only downside is that it requires two
passes if depth buffer updates are desired, whereas DEPTH_RANGE and
POLYGON_OFFSET achieve their (less accurate) results in one pass. The
NO_DEPTH_BUFFER method also only uses one pass, but it disables depth
tests and not depth writes so will have serious problems if anything is
drawn in front of the text before OR after the text is drawn.

Given the better all-around behavior of the new method, I believe the
other backdrop implementations can be safely removed. Code that adjusts
the backdrop implementation will of course be broken if the member
functions are removed. For this reason I left them in, but set the new
rendering method as the default backdrop implementation. At the very
least I think the old backdrop implementations should be deprecated and
removed at a later date.
"

Note from Robert Osfield, testing this submission with osgtext I found that the
text would not render correctly when different text labels were overlapping
in deth and screen space.  I change _enableDepthWrites to default to true and
found the that which artifacts still occurred around the alpha blended edges
the artifacts where better than issue with occlusion of nearer pixels that was
happening with _enableDepthWrites set to false.I therefore set the
_enableDepthWrites to true as I feel it's the lesser of the two artefacts.
2010-09-16 09:09:43 +00:00
Robert Osfield
8c3e3055e7 Refactored osgText::Font so that it now supports both 2D and 3D glyphs.
Added TextNode.h and TextNode.cpp to examples/osgtext3D in prep for introducing the new node to osgText library
2010-09-03 08:26:46 +00:00
Robert Osfield
6d3e7f83e2 From Terry Welsh, "As I mentioned here
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg33967.html
, interpolating through HSV space gives a rainbow color effect which
does not mimic the simple RGB color interpolation that OpenGL does.
It's overkill and causes unexpected visual artifacts.  In the attached
files I've removed the conversion to HSV so that interpolation happens
in RGB space."
2009-11-24 14:12:54 +00:00
Robert Osfield
31a947fda6 From Terry Welsh, "Okay, here are the mods I wrote for drawing a filled bounding box
behind osgText::Text.  I made it so the box would get drawn using
whichever BackdropImplementation was selected.  However, I did not
implement STENCIL_BUFFER.  In that case it defaults to drawing the
bounding box using POLYGON_OFFSET instead.

Also made it so the BOUNDINGBOX and FILLEDBOUNDINGBOX are drawn with a
settable color and margin size.

While I was at it I tightened up the values applied with DEPTH_RANGE
and POLYGON_OFFSET, not just for drawing the bounding box but also for
drawing backdrop text (these values must be coupled since the bounding
box has to be drawn deeper in Z than the backdrop text).  The values
in use before seemed like overkill and I was seeing some z-clipping
with my background scenery in the case of DEPTH_RANGE.  If there was a
good reason for the large values please let me know...."
2009-07-24 14:59:51 +00:00
Robert Osfield
213a370c25 Added new setFont(ref_ptr<>) variants to Text and Text3D 2007-12-12 17:48:20 +00:00
Robert Osfield
f4afa427a7 From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)." 2007-12-10 17:30:18 +00:00
Robert Osfield
f69a48e552 From David Callu, added support of 3D text to osgText and associated plugins. 2007-12-10 15:15:56 +00:00
Robert Osfield
40ded29902 From Dan Minor, "osgText::Text does not currently have a getAxisAlignment method. The
attached code adds this, along with a member variable to keep track of
the setting.  It is based on the latest subversion version, and was
tested by creating a new text object with the same axis alignment as an
existing one (e.g.
new_text->setAxisAlignment(old_text->getAxisAlignment()); )."

From Robert Osfield, " I originally didn't add a getAxisAlignment()
as all setAxisAlignment does is set the Rotation member variable, and
potentially one could apply user defined Rotation setting after the
setAxisAlignment() which would bring it out of sync with the
setAxisAlignment.

Rather than reject your submission on the ground of potentially
getting out of sync and therefore misleading users I've added a
USED_DEFINED_ROTATION to AxisAlignment enum, and set this in the
serRotation and then override this setting of _axisAlignment in the
setAxisAlingment method.  I've also removed the lazy updating
optimization you've added to the top of setAxisAlignment to avoid
potential problems as well."
2007-09-30 15:06:59 +00:00
Robert Osfield
eac3dc1963 From Paul Melis, "Here is a list of fixes to misspelled APIs. Unfortunately, more than one
of these are public APIs and therefore will break linkage to existing
shared libraries."

Note from Robert Osfield, updated wrappers.
2007-06-27 20:36:16 +00:00
Robert Osfield
272ab99767 Reorganised the text comments so that they are shorter length, and hopefully will
avoid VS2003's silly text string limits when compiling osgIntrospection wrappers
2007-02-15 14:53:54 +00:00
Robert Osfield
77b9a7ae19 From Eric Sokolwsky, "osgText is a useful node kit, but when longer paragraphs are displayed
on the screen, it looks more aesthetically pleasing to have a larger
gap between lines than is given by default. I added a new parameter,
lineSpacing, in the Text class to allow the line spacing to be adjustable
by the application. The default value is 0 meaning there is no extra
spacing given. The value should be given as a percentage of the character
height. A good value for longer paragraphs is 0.25 (25%) or more."
2007-01-30 14:32:12 +00:00
Robert Osfield
709d2fa435 Improved the handling a releaseGLObjects() and add setThreadSafeRefUnref and resizeGLObjectsBuffers methods 2007-01-08 20:40:29 +00:00
Robert Osfield
d23c04018b Updated wrappers 2006-11-08 11:49:35 +00:00
Robert Osfield
def74d3471 Introduced new osg::View, and osg::RenderInfo classes into the core OSG to help
handle scenes with multiple views with elements that need coordinating on a per view basis.

Added beginings of new osgText::FadeText class (not functionality yet).
2006-09-18 20:54:48 +00:00
Robert Osfield
98cdf9b3c7 From Eric Wing, fix for compute of the bounding box when handling outline/backdrop text. 2006-08-22 10:23:58 +00:00
Robert Osfield
9e7b07fbcf Reworked the state management within osgText::Text and osgText::Font so that it
only applies textures locally rather than whole StateSet.
2006-08-02 21:05:56 +00:00
Robert Osfield
f1c2694c17 Updated copyright years. 2006-07-18 15:21:48 +00:00
Robert Osfield
419e185895 From Eric Wing, add alternate backdrop implementations.
From Robert Osfield, updated naming  and copy constructor methods.
2006-07-18 12:24:04 +00:00
Robert Osfield
710adfd698 From Eric Wing, added support for outline/shadow and colour gradient effects. 2006-06-27 13:09:00 +00:00
Robert Osfield
a1cfdca94d From Eric Wing, made getLineCount() const. 2005-12-19 11:18:26 +00:00
Robert Osfield
49301347e8 From Eric Wing, fix to comment. 2005-12-08 08:57:16 +00:00
Robert Osfield
35fcaf7bde Convert tabs to spaces. 2005-11-17 17:44:48 +00:00
Robert Osfield
9e5eed280d From Joran Jessurun, comments explaining font search rules 2005-09-28 13:45:32 +00:00
Robert Osfield
1c88914e5f From Yuri Vilmanis, improved multi-line justifaction support and new alignment modes 2005-07-15 16:22:53 +00:00
Robert Osfield
bf4d63f6ea Added new Node/Drawable::s/getInitialBound and Node/Drawable::s/getComputeBoundCallback
methods and reimplement computeBound so that it passes back a bounding volume rather
than modifying the local one.
2005-05-12 14:03:22 +00:00
Robert Osfield
538ced579e Removed deprecated API in preparation for 0.9.9 release. 2005-05-09 13:09:07 +00:00
Robert Osfield
d1a1b1d95c Added more comprehensive releaseGLObjects(State*=0) throughout Nodes,
Drawables,StateSet, and osgDB::Registry.

Added cleanup_frame() from to osgProducer::OsgCamerGroup to help with proper
clean of OpenGL objects before exit, and modified osgviewer, osghangglider,
osgwindows examples to do the extra frame call to cleanup_frame() before exit.
2005-05-07 20:47:09 +00:00
Robert Osfield
678b22ce83 Updated Copyright notices to 1998-2005. 2005-04-14 21:41:28 +00:00
Robert Osfield
f8426a8ad8 Made supports(..) methods use support(const ...) 2005-03-18 02:42:59 +00:00
Robert Osfield
c3f40e2e67 Added improved handling of center justificaion of multiline text 2005-03-03 12:33:07 +00:00
Robert Osfield
117c791a3b Added osg::BufferObject and a made a number associated to accomodate this
new class. osg::BufferObject wraps up OpenGL pixel and array buffer objects.
Currently implementation is work in progress.
2005-02-09 10:39:45 +00:00
Robert Osfield
42689bfa2e Fixed copy and past erro in getFontWidth. 2004-10-10 18:18:45 +00:00
Robert Osfield
fd9777101c *** empty log message *** 2003-12-20 14:20:48 +00:00
Robert Osfield
bbc55c14fd Added osgText::Text::getTextureGlyphQuadMap(). 2003-11-04 13:40:24 +00:00
Robert Osfield
a2f9222753 Added support for handling of wordwrap in osgText::Text, so that whole words
are cut in two, but rather moved completely to the next line.
2003-09-15 21:43:54 +00:00
Robert Osfield
1b9d7d458a Added support for texture object manager, which provides an automatic mechansim
for reusing deleted textures.
2003-07-14 14:42:10 +00:00
Robert Osfield
8d4ab4668e From Tree, updates to osgText and freetype plugin to support are kerning paramter. 2003-06-26 16:21:49 +00:00
Don BURNS
15f88f35b2 *** empty log message *** 2003-06-24 15:40:09 +00:00
Robert Osfield
06054d9520 Added support for multibuffering of tex coordinates. 2003-05-06 13:13:31 +00:00
Robert Osfield
895a722842 Addd support for maximum screen text size into osgText when auto scale to
screen is active.

Added osgautotransform demo.
2003-05-01 21:06:18 +00:00
Robert Osfield
9468ab4979 Cleanup of the API. 2003-04-30 15:38:11 +00:00
Robert Osfield
0ab467483f Added support for automatic scaling of text to screen coords. Optimized
the text implementation to provide better speed, especially by using the
alignement to screen option.

Deprecated the Text::setFontSize(,) method, which is now being replaced
by setFontResolution(,)

Fixed typos in Texture*.cpp.

Removed old deprecated methods from osg headers.
2003-04-30 11:40:17 +00:00
Robert Osfield
c1b1a091fa From Tree, addition of ; after MACRO_'s to help with Java port.
From Tree + Robert, Addition of LEFT_BASE_LINE,RIGHT_BASE_LINE,CENTER_BASE_LINE
Alignment options in Text.
2003-04-27 10:58:39 +00:00
Robert Osfield
5e56e0eba8 Added osgkeyboard to the ./runexamples.bat.
Made osgstereoimage exit when non files have been loaded.

Added non const getText() method.
2003-03-25 13:57:16 +00:00
Robert Osfield
06fb808ad3 Improvements to the Text .osg support. 2003-03-10 16:40:26 +00:00
Robert Osfield
47087585c0 Added maximum width and maximum height limits to the osgText::Text which
automatically wraps text which goes beyond these limits.
2003-03-06 21:35:33 +00:00