On Thu, 2004-11-11 at 04:46, Dominik Rau wrote:
> Hello.
> 
> While tuning the simulation part of my app I've found the screen aligned 
> text core very useful for me to display object specific information.
> 
> Unfortunately, I experienced some problems here (well, it's 
> experimental, I know...).
> 
> * The setAlignment Method doesn't work, the text is always centered. Bug 
> or feature ; ) ?

Not implemented yet: feature. ;)

> *  I display informations about my autonomous agents with this core. 
> These infos are changing per frame, so I have to update them very often. 
> But this seems to cause some serious memory leakage in the 
> RenderServer(s) of my cluster application. Does anybody has seen this 
> before or can this be related to the font I use (tried it with the test 
> font in the Experimental/Fonts dir and with different freetype ttf-Fonts 
> like FreeMono, FreeSans etc....)?

I doubt it's related to the font. The Core has never been used very
heavily, at least not in programs that change the text very often, so
there probably are memory leaks in there.

> * Is the ScreenAlignedText node what I want? Are there cheaper ways to 
> display constantly changing information with text (ideally near the 
> object that this information is about)?

The FTGL text could also do this, but I wouldn't bet on it being much
better memory and performance-wise right now.

In general the SAT is probably pretty inefficient for text that changes
a lot, but I don't have anything better right now. So if you can live
with for now that would be good.

I did a quick valgrind run through testScreenAlignedText and fixed a
memory leak that could become pretty significant once you start changing
text a lot. The patch is below, hope this fixes your problems.

Hope it helps

        Dirk


diff -u -3 -p -r1.7 OSGText.cpp
--- OSGText.cpp 20 Jan 2004 02:34:12 -0000      1.7
+++ OSGText.cpp 13 Nov 2004 18:46:47 -0000
@@ -617,7 +617,7 @@ bool Text::fillImage(ImagePtr & image,
                                        }
                                }
                        }
-                       delete imageBuffer;
+                       delete [] imageBuffer;
                        imageBuffer = bitmapBuffer;
                        //overallWidth = newOverallWidth;
 #endif
@@ -629,10 +629,12 @@ bool Text::fillImage(ImagePtr & image,
                        pixelFormat = Image::OSG_RGBA_PF;
                }
  
-        return image->set( pixelFormat, // Image::OSG_RGB_PF,
-                           overallWidth, overallHeight, 1,
-                           1,
-                           1, 0.0, imageBuffer);
+        bool retval = image->set(pixelFormat, // Image::OSG_RGB_PF,
+                                 overallWidth, overallHeight, 1,
+                                 1,
+                                 1, 0.0, imageBuffer);
+        delete [] imageBuffer;
+        return retval;
     }
  
     return false;




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to