Commit Graph

111 Commits

Author SHA1 Message Date
Robert Osfield
e6703e3cb0 Removed no longer supported code paths 2017-03-18 11:48:55 +00:00
Robert Osfield
feb0214ddc Introduced streamlined text rendering dispatch code. 2017-03-18 11:48:55 +00:00
Robert Osfield
2cad221d80 Cleaned out old code paths 2017-03-09 17:33:38 +00:00
Robert Osfield
b88be0fbda Implemented better handling of VertexBufferObjects and ElementBufferObjects in osgText 2017-03-03 18:31:51 +00:00
Robert Osfield
59931d1591 Removed unneccessary mutable usage 2017-03-02 17:05:24 +00:00
Robert Osfield
f233005988 Merged the decoration vertices with the same vertex arrays used for text glyphs 2017-03-01 16:43:05 +00:00
Robert Osfield
f4966a96d4 Replaced hardwired glDrawArrays calls with use of osg::DrawElementsUshort. 2017-03-01 11:51:27 +00:00
Robert Osfield
256441906f Removed unused member variable 2017-02-28 17:12:58 +00:00
Robert Osfield
1290f1584a Removed old Text::GlyphQuads array code paths 2017-02-28 17:02:02 +00:00
Robert Osfield
138af70bd8 Merged the Text::GlyphQuads cooordinate arrays 2017-02-28 16:34:33 +00:00
Robert Osfield
e5685dfca5 Removed old code paths 2017-02-27 15:15:37 +00:00
Robert Osfield
80c96cd54f Added option for combining the GlyphQuad::backdropcoords into the GlyphQuad::coords. 2017-02-27 11:53:42 +00:00
Robert Osfield
8adbf322a0 Scaled back the primitives sets set up so they match the requirements of the osgText::Text accordinging to the BackdropType 2017-02-24 18:25:16 +00:00
Robert Osfield
a84a6bd309 Moved glyph quad setup into dedicated method 2017-02-24 17:08:48 +00:00
Robert Osfield
cefecaec10 Removed unused lineNumber 2017-02-24 11:17:22 +00:00
Robert Osfield
93f28d4eee Moved to use of single vector of DrawElementsUShort for backdrops and foreground text quads 2017-02-24 10:07:01 +00:00
Robert Osfield
b5048d3b74 Cleaned up types 2017-02-23 18:14:36 +00:00
Robert Osfield
8ff17ddf52 Restructed and unified the position computation 2017-02-23 15:45:43 +00:00
Robert Osfield
7b3ecefcfc Removed the old code paths 2017-02-22 14:14:03 +00:00
Robert Osfield
f816436771 Removed the unncessary array. 2017-02-22 12:41:45 +00:00
Robert Osfield
04d23659b3 Added the option for changing the type of the GlyphQuads::Coords 2017-02-22 12:07:43 +00:00
Robert Osfield
cd991eaa97 Refactored the computation of the transforms for the osgText::Text 2017-02-21 17:07:53 +00:00
Robert Osfield
0f3e61146d Refactored osgText so that it no longer uses GLBeginEndAdapter 2016-10-11 11:29:29 +01:00
Robert Osfield
be98c884bd From Ognjen Kostic, "Some android phones have no support for OES_element_index_uint extension that is required if glDrawElements is to be called with GL_UNSIGNED_INT for element type.
In OSG 3.4, osgText::Text( ::_quadIndices) uses DrawElementsUInt that will fail on these devices and no text will appear - tested on Samsung Galaxy Trend 2 SM-G313HN.

When DrawElementsUInt is replaced with DrawElementsUShort it works, although I'm not sure if this can cause other problems with some fonts.

Fix:
- In include\osgText\Text, line 316:
        replace: "osg::ref_ptr< osg::DrawElementsUInt > _quadIndices;"
        with:    "osg::ref_ptr< osg::DrawElementsUShort > _quadIndices;"

- In src\osgText\Text.cpp, line 2094:
        replace: "_quadIndices = new DrawElementsUInt(PrimitiveSet::TRIANGLES);"
        with:    "_quadIndices = new DrawElementsUShort(PrimitiveSet::TRIANGLES);"
"
2016-03-01 10:21:14 +00:00
Robert Osfield
55d36b544b Warning fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15032 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:59:11 +00:00
Robert Osfield
c4fdc93053 Added Text::GlyphQuads::release/resizeGLObjects() and handling of inconsistent contextID sizes to avoid crashes when viewers and scene graphs aren't initialized correctly to the right number of contexts.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14947 16af8721-9629-0410-8352-f15c8da7e697
2015-07-13 16:09:45 +00:00
Robert Osfield
47db2da8b4 From Andreas Henne, Support for GL3 core profile in osgText
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14717 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 18:56:29 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
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