Re: [osg-users] Simple moving map using CADRG data

2009-05-01 Thread Alan Ott

Michael,

I'm actually not loading the TOC file at all. My map operates on a 
directory full of tiles. What's convenient about this is that sometimes 
I don't have a TOC file at all (for example, sometimes I just have a 
bunch of GeoTIFFs).


I don't actually read the image data myself. I let the OSG plugin do 
that work for me. I just read the header of each tile using GDAL (to get 
the georeferencing information), then close the GDAL dataset, then read 
the image data from the tile using the normal OSG method 
(osgDB::readImageFile()). Right here, you might want to use an 
osgDB::ImageOptions and set the pixel window up to control the maximum 
resolution you want to load. Some CADRG images can get very large.


Keep in mind though, that you'll have to tell osgDB::Registry that files 
with the file extension of the file you're trying to read (tl1, ja1, 
etc.) should be read by the OSG GDAL Plugin by calling:
   osgDB::Registry::addFileExtensionAlias 
 
("YOUR_FILE_EXTENSION_HERE", "gdal") .


So to answer your question, I never even get a subdataset, because I 
don't use the TOC file.


Alan.

Day, Michael (Mike) (CIV) wrote:

Alan,
 
The georeferencing part makes sense, thanks for pointing that out.
 
 
When you load from GDAL are you doing something more sophisticated than this?
 


  poDataset = (GDALDataset*) GDALOpen("path\\RPF\\A.TOC", GA_ReadOnly);

  for each subdataset (tile):

nextSubDataset = (GDALDataset*) GDALOpen("path", GA_ReadOnly);

 


for each tile in nextSubDataset: //is this necessary??!

  extract pixel information  //It's pretty involved... going

 //through RasterBands and

 //Blocks, etc.

 

The reason I is because it seems like you're saying that once you get 
to a subdataset then the OSG plugin might be able to extract the tile 
to an image for you?  This would save a lot of pain.


 

If it's not possible, do you have any sample code showing how to 
extract a tile into an image?


 
Thanks,
 
Michael Day
 
-
 
Joe,
 
I've done this, and I'll give you a basic overview of what I've done, 
but there may be better ways to do it, because I was fairly new to OSG 
at the time, and some of my ideas may be obsolete these days.
 
The GDAL OSG plugin will give you image data (pixels), but will not 
provide the geo-referencing data, so you'll have to link to GDAL 
directly to get the geographic extents of each tile. Shane is right that 
the A.TOC file is not supported by OSG, so I had to just load all the 
map tiles which existed in a directory, building my own index of tiles 
with their extents in them.
 
I do all the paging myself, going through the index and finding out 
what's in range and loading it if need-be. This could probably be done a 
lot more elegantly using the PagedLOD class, but I found that in 
practice, what I do is fairly fast.
 
Check the GDAL documentation, and look for GetGeoTransform(). This 
returns a bunch of numbers in an array, but one of the GDAL examples 
will tell you what each number represents (lat/long, degrees per pixel, 
etc.).
 
You'll need to come up with a projection to map the Lat/Long to some 
kind of XYZ that can be used by OSG. I use SEDRIS (www.sedris.org) for 
my coordinate conversions these days because it will convert from 
anything to anything else (Geodetic, Geocentric, UTM, MGRS, and more). 
Check the license to make sure you're comfortable with it. It's free to 
use, and available in source form, but they have their own license. For 
your purposes though, there's likely a simpler way to do your coordinate 
conversion.
 
Good luck.
 
Alan.
 
Glenn Waldron wrote:
 
>/ Supposedly GDAL does support the TOC for CADRG/CIB:/

>/ /
>/ http://www.gdal.org/frmt_various.html (search for "RPF")/
>/ /
>/ You might be able to coerce osgEarth's GDAL driver into doing what you /
>/ want./
>/ /
>/ /
>/ Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : /
>/ +1.703.652.4791/
>/ /
>/ /
>/ On Tue, Apr 28, 2009 at 11:28 AM, Tueller, Shayne R Civ USAF AFMC 519 /
>/ SMXS/MXDEC http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org> /
>/ >> wrote:/
>/ /
>/ Joe,/
>/ /
>/ >From what I understand, GDAL will import a single CADRG image but/
>/ it won't/
>/ handle the dynamic decompression and different map resolutions as/
>/ you zoom/
>/ in and out (the A.TOC file). I've done some moving map support/
>/ using OSG for/
>/ our software but I built my own paged moving map database using/
>/ the OSG/
>/ paging database support with different CADRG images. It seems to/
>/ work for/
>/ what we need./
>/ /
>/ IMO, I think a "real" movi

Re: [osg-users] PagedLOD

2009-04-29 Thread Alan Ott

Jakob,

Thanks for the idea. What I ended up doing was subclassing PagedLOD and 
overriding the addChild() method and doing the init from my overridden 
method. This way, I could have pointers to my own objects, which were 
necessary for the initialization.


Thanks for your help,

Alan.

Jakob Ruhe wrote:


I think you can solve what you want by making sure your own pseudo
loader is used instead. You do this by adding some extension
(.ott_terrain, .ott_model, ...) to the filenames of the children of
your PagedLODs and you register a ReaderWriter that supports those
extensions. You can then in your ReaderWriter remove the extension and
load the real file with the right loader by calling
osgDB::readNodeFile as usual and then do the postprocessing of the
node. Note that all this will be done in a thread created by
DatabasePager. If you need to do some postprocessing in your main
scenegraph thread you can add a callback (update callback or cull
callback) to the node.

If you need an example how this can be done please have a look at osgEarth.

Good luck!

/Jakob Ruhe

2009/4/28 Alan Ott :
 


Robert and Bryan,

Thanks for the info. From this, it seems like I can get a handle to the
newly loaded node before it gets added to the main tree. The only thing now
is that once I've got a handle to this node, I don't really know _what_ the
node is supposed to be (is it a terrain tile, a moving model? etc.).

ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it seems
like I could make a new option string telling me how to post-process this
model load, but I can't see how in PagedLOD to set ReaderWriterOptions.

PagedLOD has the setDatabaseRequest() function, which based on another
mailing list post, looks like it is to be used as a "user data" pointer. The
problem here is that I don't know how to get this object from inside the
ReadFileCallback.

I simply need to tag each request (made by the PagedLOD) as "terrain" or
"model" so that I know specifically what initialization to do in the
ReadFileCallback.

Am I missing something obvious here?

Thanks for your help,

Alan.


Robert Osfield wrote:

Hi Alan,

As Bryan wrote, what you need is to write a custom
osgDB::Registry::ReadFileCallback that will intercept all DB calls,
you then leave it up to Registry itself to the do the reading from the
plugin, but then you process the loaded data before passing the end
result back from the callback.  Have a look at the ReadFileCallback
implementation and study the default implementations, this should give
you a clue how to put it together.

Robert.

On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott  wrote:


Hello,

I'm using PagedLOD to load terrain tiles off disk. The problem I have is
that before I want the tile to actually render, I want to do a setup of the
tile (to look up certain control nodes and set switches according to the
current state of the system (eg: day/night mode, etc)).

So on my own update(), I check to see if each PagedLOD has just loaded, and
if it has, I run the initialization on it. The problem is, when a tile gets
loaded, it is rendered for one frame _before_ I can do my initialization on
it. So for one frame, it is drawn wrong, then the next frame, it is drawn
right.

I thought I might be able to get around this by setting the Node Mask to 0
until it was initialized, but that seems to just keep the tiles from getting
loaded entirely (because the update traverser isn't getting into the
PagedLOD either).

Do any of you have any ideas of what I could try to do to get around this?
Is there some value of the NodeMask that I could use to enable update but
not draw? Such a value did not seem to be documented in the API.

Thanks for all your help,

Alan.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


   


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD

2009-04-29 Thread Alan Ott

Thrall, Bryan wrote:


Alan Ott wrote on Tuesday, April 28, 2009 10:34 AM:
 


Thanks for the info. From this, it seems like I can get a handle to
   


the newly
 


loaded node before it gets added to the main tree. The only thing now
   


is that
 


once I've got a handle to this node, I don't really know _what_ the
   


node is
 

supposed to be (is it a terrain tile, a moving model? etc.).   


ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it
   


seems
 


like I could make a new option string telling me how to post-process
   


this
 


model load, but I can't see how in PagedLOD to set
   

ReaderWriterOptions.  


Unfortunately, at the moment PagedLOD doesn't have a way to specify
ReaderWriterOptions (and adding that ability is a little complicated,
because we don't want a circular dependency between osg and osgDB).

One thing you can do is subclass PagedLOD in your app to add the ability
to specify a ReaderWriterOptions when it calls readNode().

 


PagedLOD has the setDatabaseRequest() function, which based on another
mailing list post, looks like it is to be used as a "user data"
   


pointer. The
 


problem here is that I don't know how to get this object from inside
   


the
 

ReadFileCallback.   
   



This makes me think you're using an older version of OSG? The latest OSG
in svn only has getDatabaseRequest() (which you can use to set the
DatabaseRequest). In any case, the database request isn't really for
"user data"; it is specifically for osgDB::DatabasePager use.

 


Robert Osfield wrote:
As Bryan wrote, what you need is to write a custom
osgDB::Registry::ReadFileCallback that will intercept all DB
   


calls,
 


you then leave it up to Registry itself to the do the reading
   


from the
 


plugin, but then you process the loaded data before passing the
   


end
 


result back from the callback.  Have a look at the
   


ReadFileCallback
 


implementation and study the default implementations, this
   


should give
 


you a clue how to put it together.

On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott 
<mailto:a...@signal11.us>  wrote: 


I'm using PagedLOD to load terrain tiles off disk. The
   


problem I have is
 


that before I want the tile to actually render, I want
   


to do a setup of the
 


tile (to look up certain control nodes and set switches
   


according to the
 


current state of the system (eg: day/night mode, etc)).

So on my own update(), I check to see if each PagedLOD
   


has just loaded, and
 


if it has, I run the initialization on it. The problem
   


is, when a tile gets
 


loaded, it is rendered for one frame _before_ I can do
   


my initialization on
 


it. So for one frame, it is drawn wrong, then the next
   


frame, it is drawn
 


right.

I thought I might be able to get around this by setting
   


the Node Mask to 0
 


until it was initialized, but that seems to just keep
   


the tiles from getting
 


loaded entirely (because the update traverser isn't
   


getting into the
 


PagedLOD either).

Do any of you have any ideas of what I could try to do
   


to get around this?
 


Is there some value of the NodeMask that I could use to
   


enable update but
 


not draw? Such a value did not seem to be documented in
   


the API.
 



Bryan,

You are right. I didn't read closely enough, and there is no 
setDatabaesRequest(). I am using OSG 2.6. You had a good idea with the 
subclassing of PagedLOD and the options, but what I ended up doing was I 
think simpler. I subclassed PagedLOD and overrode the addChild() method, 
calling my init function from the override. This way I could have all 
the "user data" I want (with pointers to my own objects), which would 
not have been possible from the callback.


Thanks for your help,

Alan.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Simple moving map using CADRG data

2009-04-28 Thread Alan Ott

Joe,

I've done this, and I'll give you a basic overview of what I've done, 
but there may be better ways to do it, because I was fairly new to OSG 
at the time, and some of my ideas may be obsolete these days.


The GDAL OSG plugin will give you image data (pixels), but will not 
provide the geo-referencing data, so you'll have to link to GDAL 
directly to get the geographic extents of each tile. Shane is right that 
the A.TOC file is not supported by OSG, so I had to just load all the 
map tiles which existed in a directory, building my own index of tiles 
with their extents in them.


I do all the paging myself, going through the index and finding out 
what's in range and loading it if need-be. This could probably be done a 
lot more elegantly using the PagedLOD class, but I found that in 
practice, what I do is fairly fast.


Check the GDAL documentation, and look for GetGeoTransform(). This 
returns a bunch of numbers in an array, but one of the GDAL examples 
will tell you what each number represents (lat/long, degrees per pixel, 
etc.).


You'll need to come up with a projection to map the Lat/Long to some 
kind of XYZ that can be used by OSG. I use SEDRIS (www.sedris.org) for 
my coordinate conversions these days because it will convert from 
anything to anything else (Geodetic, Geocentric, UTM, MGRS, and more). 
Check the license to make sure you're comfortable with it. It's free to 
use, and available in source form, but they have their own license. For 
your purposes though, there's likely a simpler way to do your coordinate 
conversion.


Good luck.

Alan.

Glenn Waldron wrote:


Supposedly GDAL does support the TOC for CADRG/CIB:

http://www.gdal.org/frmt_various.html (search for "RPF")

You might be able to coerce osgEarth's GDAL driver into doing what you 
want.



Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 
+1.703.652.4791



On Tue, Apr 28, 2009 at 11:28 AM, Tueller, Shayne R Civ USAF AFMC 519 
SMXS/MXDEC > wrote:


Joe,

>From what I understand, GDAL will import a single CADRG image but
it won't
handle the dynamic decompression and different map resolutions as
you zoom
in and out (the A.TOC file). I've done some moving map support
using OSG for
our software but I built my own paged moving map database using
the OSG
paging database support with different CADRG images. It seems to
work for
what we need.

IMO, I think a "real" moving map plugin that fully handles the
CADRG format
would be something useful in OSG...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org

[mailto:osg-users-boun...@lists.openscenegraph.org
] On Behalf Of
Sullivan,
Joseph (CDR)
Sent: Tuesday, April 28, 2009 8:21 AM
To: osg-users@lists.openscenegraph.org

Subject: [osg-users] Simple moving map using CADRG data

Hello,

I posted this earlier but it may have gotten lost in the shuffle.

I'm interested in adding a moving map display to a simulation.
 (Something
like an instructor operator station.)  I understand GDAL can
import CADRG
data but I haven't found an easy way to use that data to create a
moving map
display.

Have others implemented anything like this ?  If so, any tips or
suggestions
appreciated.  Is this something others in the community would find
useful?

Thanks,

Joe


___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD

2009-04-28 Thread Alan Ott

Robert and Bryan,

Thanks for the info. From this, it seems like I can get a handle to the 
newly loaded node before it gets added to the main tree. The only thing 
now is that once I've got a handle to this node, I don't really know 
_what_ the node is supposed to be (is it a terrain tile, a moving model? 
etc.).


ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it 
seems like I could make a new option string telling me how to 
post-process this model load, but I can't see how in PagedLOD to set 
ReaderWriterOptions.


PagedLOD has the setDatabaseRequest() function, which based on another 
mailing list post, looks like it is to be used as a "user data" pointer. 
The problem here is that I don't know how to get this object from inside 
the ReadFileCallback.


I simply need to tag each request (made by the PagedLOD) as "terrain" or 
"model" so that I know specifically what initialization to do in the 
ReadFileCallback.


Am I missing something obvious here?

Thanks for your help,

Alan.


Robert Osfield wrote:


Hi Alan,

As Bryan wrote, what you need is to write a custom
osgDB::Registry::ReadFileCallback that will intercept all DB calls,
you then leave it up to Registry itself to the do the reading from the
plugin, but then you process the loaded data before passing the end
result back from the callback.  Have a look at the ReadFileCallback
implementation and study the default implementations, this should give
you a clue how to put it together.

Robert.

On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott  wrote:
 


Hello,

I'm using PagedLOD to load terrain tiles off disk. The problem I have is
that before I want the tile to actually render, I want to do a setup of the
tile (to look up certain control nodes and set switches according to the
current state of the system (eg: day/night mode, etc)).

So on my own update(), I check to see if each PagedLOD has just loaded, and
if it has, I run the initialization on it. The problem is, when a tile gets
loaded, it is rendered for one frame _before_ I can do my initialization on
it. So for one frame, it is drawn wrong, then the next frame, it is drawn
right.

I thought I might be able to get around this by setting the Node Mask to 0
until it was initialized, but that seems to just keep the tiles from getting
loaded entirely (because the update traverser isn't getting into the
PagedLOD either).

Do any of you have any ideas of what I could try to do to get around this?
Is there some value of the NodeMask that I could use to enable update but
not draw? Such a value did not seem to be documented in the API.

Thanks for all your help,

Alan.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

   


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PagedLOD

2009-04-27 Thread Alan Ott

Hello,

I'm using PagedLOD to load terrain tiles off disk. The problem I have is 
that before I want the tile to actually render, I want to do a setup of 
the tile (to look up certain control nodes and set switches according to 
the current state of the system (eg: day/night mode, etc)).


So on my own update(), I check to see if each PagedLOD has just loaded, 
and if it has, I run the initialization on it. The problem is, when a 
tile gets loaded, it is rendered for one frame _before_ I can do my 
initialization on it. So for one frame, it is drawn wrong, then the next 
frame, it is drawn right.


I thought I might be able to get around this by setting the Node Mask to 
0 until it was initialized, but that seems to just keep the tiles from 
getting loaded entirely (because the update traverser isn't getting into 
the PagedLOD either).


Do any of you have any ideas of what I could try to do to get around 
this? Is there some value of the NodeMask that I could use to enable 
update but not draw? Such a value did not seem to be documented in the API.


Thanks for all your help,

Alan.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Sequence and Problems with the osgsequence Example

2008-10-23 Thread Alan Ott


I don't have access to the configuration I was using last week, so I 
tried to reproduce the problem on a different computer (running the same 
OS) but to no avail. I tried the Debug, Release, and even the 
configurtion in between (where you don't specify either, and get no 
debug symbols and no optimization), and in every case, it works fine.


Last week I was using packages I got from arakhne.org, and in what I did 
today I compiled from source. I did not try to use the packages today at 
all. Since it's the last variable, I'm going to blame the packages at 
this point. Maybe I'll get some time to try them tomorrow to make sure.


Thanks for your help,

Alan.


Alan Ott wrote:


Robert,

To reproduce the problem, I simply ran the osgsequence example from 
OSG 2.6.0 in Linux. The sequence example just sticks at the first 
frame on both sequences. The 2.4.0 version of this example executes 
the sequences as would be expected.


I'll try the 2.6.1 version today and let you know.

Alan.


Robert Osfield wrote:


Hi Alan,

osgsequence is working for me.  Could you explain your exact steps in
recreating the problem in osgsequence so that others can reproduce the
problem.   If we can get others to reproduce the problem then
hopefully we'll be able to see a pattern emerge that can help use home
in on what the problem is.

W.r.t state needing to be dirtied, this isn't relevant to
osg::Sequence as it doesn't have an state, it's just a self contain
node, that only affects traversal of the scene graph, not any OpenGL
state.

Robert.

On Wed, Oct 22, 2008 at 6:04 PM, Alan Ott <[EMAIL PROTECTED]> wrote:
 


Hello,

First, I'd like to say Thank You to Robert, Simba, and Chris Denham for
helping me with my last problem with the DatabasePager. Chris's suggestion
worked great.

I just recently upgraded from OSG 2.4 to 2.6 because I needed multisample
support for my FrameBuffer Objects. When I did this, everything worked fine
execpt for two things which may be related. The first was with osgEphemeris,
and I found someone in an archive who was able to fix that problem by making
sure that the computed sky texture was marked dirty() when changed. Robert
said on the list that it "[had] been relying upon an inefficiency in the
osg::Texture2D::setImage() method that has now been fixed, so only really
worked previously by fluke." This leads me to believe that maybe more
efficiency changes were made between OSG 2.4 and 2.6 which could be causing
my next problem.

The second problem I have is that none of my Sequences seem to work right. I
tried a lot of things outside OSG to make it work, and eventually did a diff
on the OSG 2.4 version of osg/Sequence.cpp and the OSG 2.6 version to find
out that they are identical.

The problem goes like this. When I load a model with an Sequence in it, the
sequence runs one time. I cannot restart it ever. If I load the model, then
find the sequence node and stop it before it's drawn, I can never start the
sequence. This worked great in OSG 2.4.

So I built the osgsequence example in 2.4 and 2.6, and as I suspected, the
2.4 version of osgsequence works great, but the 2.6 version does not.

I'm not sure what the problem is, since like I said, Sequence.cpp hasn't
changed at all. My suspicion is that, like the osgEphemeris problem
described above, something in 2.6 has been fixed so that it requires
notification of a change of state in the Sequence (something like a dirty()
being called?). Of course this is only suspicion, and I have not been able
to debug it very well. I'm hoping someone who knows the code better than I
do will be able to find the problem quickly.

So I guess that's it. I think that if the osgsequence example could be made
to work, that my sequence problems would be fixed.

Thanks for all your help, and again, thank you for Open Scene Graph,

Alan.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

   


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Sequence and Problems with the osgsequence Example

2008-10-23 Thread Alan Ott

Robert,

To reproduce the problem, I simply ran the osgsequence example from OSG 
2.6.0 in Linux. The sequence example just sticks at the first frame on 
both sequences. The 2.4.0 version of this example executes the sequences 
as would be expected.


I'll try the 2.6.1 version today and let you know.

Alan.


Robert Osfield wrote:


Hi Alan,

osgsequence is working for me.  Could you explain your exact steps in
recreating the problem in osgsequence so that others can reproduce the
problem.   If we can get others to reproduce the problem then
hopefully we'll be able to see a pattern emerge that can help use home
in on what the problem is.

W.r.t state needing to be dirtied, this isn't relevant to
osg::Sequence as it doesn't have an state, it's just a self contain
node, that only affects traversal of the scene graph, not any OpenGL
state.

Robert.

On Wed, Oct 22, 2008 at 6:04 PM, Alan Ott <[EMAIL PROTECTED]> wrote:
 


Hello,

First, I'd like to say Thank You to Robert, Simba, and Chris Denham for
helping me with my last problem with the DatabasePager. Chris's suggestion
worked great.

I just recently upgraded from OSG 2.4 to 2.6 because I needed multisample
support for my FrameBuffer Objects. When I did this, everything worked fine
execpt for two things which may be related. The first was with osgEphemeris,
and I found someone in an archive who was able to fix that problem by making
sure that the computed sky texture was marked dirty() when changed. Robert
said on the list that it "[had] been relying upon an inefficiency in the
osg::Texture2D::setImage() method that has now been fixed, so only really
worked previously by fluke." This leads me to believe that maybe more
efficiency changes were made between OSG 2.4 and 2.6 which could be causing
my next problem.

The second problem I have is that none of my Sequences seem to work right. I
tried a lot of things outside OSG to make it work, and eventually did a diff
on the OSG 2.4 version of osg/Sequence.cpp and the OSG 2.6 version to find
out that they are identical.

The problem goes like this. When I load a model with an Sequence in it, the
sequence runs one time. I cannot restart it ever. If I load the model, then
find the sequence node and stop it before it's drawn, I can never start the
sequence. This worked great in OSG 2.4.

So I built the osgsequence example in 2.4 and 2.6, and as I suspected, the
2.4 version of osgsequence works great, but the 2.6 version does not.

I'm not sure what the problem is, since like I said, Sequence.cpp hasn't
changed at all. My suspicion is that, like the osgEphemeris problem
described above, something in 2.6 has been fixed so that it requires
notification of a change of state in the Sequence (something like a dirty()
being called?). Of course this is only suspicion, and I have not been able
to debug it very well. I'm hoping someone who knows the code better than I
do will be able to find the problem quickly.

So I guess that's it. I think that if the osgsequence example could be made
to work, that my sequence problems would be fixed.

Thanks for all your help, and again, thank you for Open Scene Graph,

Alan.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

   


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Sequence and Problems with the osgsequence Example

2008-10-22 Thread Alan Ott

Hello,

First, I'd like to say Thank You to Robert, Simba, and Chris Denham for 
helping me with my last problem with the DatabasePager. Chris's 
suggestion worked great.


I just recently upgraded from OSG 2.4 to 2.6 because I needed 
multisample support for my FrameBuffer Objects. When I did this, 
everything worked fine execpt for two things which may be related. The 
first was with osgEphemeris, and I found someone in an archive who was 
able to fix that problem by making sure that the computed sky texture 
was marked dirty() when changed. Robert said on the list that it "[had] 
been relying upon an inefficiency in the osg::Texture2D::setImage() 
method that has now been fixed, so only really worked previously by 
fluke." This leads me to believe that maybe more efficiency changes were 
made between OSG 2.4 and 2.6 which could be causing my next problem.


The second problem I have is that none of my Sequences seem to work 
right. I tried a lot of things outside OSG to make it work, and 
eventually did a diff on the OSG 2.4 version of osg/Sequence.cpp and the 
OSG 2.6 version to find out that they are identical.


The problem goes like this. When I load a model with an Sequence in it, 
the sequence runs one time. I cannot restart it ever. If I load the 
model, then find the sequence node and stop it before it's drawn, I can 
never start the sequence. This worked great in OSG 2.4.


So I built the osgsequence example in 2.4 and 2.6, and as I suspected, 
the 2.4 version of osgsequence works great, but the 2.6 version does not.


I'm not sure what the problem is, since like I said, Sequence.cpp hasn't 
changed at all. My suspicion is that, like the osgEphemeris problem 
described above, something in 2.6 has been fixed so that it requires 
notification of a change of state in the Sequence (something like a 
dirty() being called?). Of course this is only suspicion, and I have not 
been able to debug it very well. I'm hoping someone who knows the code 
better than I do will be able to find the problem quickly.


So I guess that's it. I think that if the osgsequence example could be 
made to work, that my sequence problems would be fixed.


Thanks for all your help, and again, thank you for Open Scene Graph,

Alan.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] DatabasePager - A little confused

2008-09-30 Thread Alan Ott

Hello,

After much trying and failing, I think I have a fundamental 
misunderstanding reagarding the DatabasePager. I have looked for 
examples or code snippets and it seems that there are none. So here's 
what I have.


I have a DatabasePager object that I use for terrain. When I need a new 
chunk of terrain, I call requestNodeFile() with the name of the tile of 
terrain that I want, and give it a group node to attach it to. Every 
frame, I check my group nodes to see if they have a piece of terrain 
attached to them (ie: see if the pager paged in the terrain and attached 
it to my group). If a new piece of terrain has been loaded, I then 
perform my initialization on it (lookup switch nodes, etc), and attach 
it to my main scene. This gets the job done.


The problem now, is that every time a new tile is attached to the main 
scene, the next frame takes a long time, and I have a missed frame. This 
has to do with the new tile getting compiled (texture sent to OpenGL, 
etc) when it's drawn the first time. To overcome this, I want 
DatabasePager to do this for me, which it seems to be able to support, 
but everything I try doesn't work in one way or another. I have 
something like the following (roughly):


// Set up the pager
pager = osgDB::DatabasePager::create();
pager->setCompileGLObjectsForContextID (0, true);
pager->setDoPreCompile(true);
...

// My composite viewer
osgViewer::CompositeViewer *viewer = new osgViewer::CompositeViewer;


// Then for each View I have something like this.
view = new osgViewer::View;
view->setSceneData(root.get());
view->getScene()->setDatabasePager(pager);

So in this case, only what gets requested the first frame (before the 
first draw) gets paged in. Anything requested after that never gets 
loaded. If I take out the call to setCompileGLObjectsForContextID(), of 
course, no precompiling happens. Other things happen if I take out the 
getScene()->setDatabasePager().


From some of the code regarding PagedLOD's, I get the feeling I might 
be going about this the wrong way entirely, and possibly using 
DatabasePager in a way in which it was not designed.


So I guess my question is, does anyone have anything they can tell me 
about how to use this class? Maybe some code snippets? Anything at all 
would help. I've spent a lot of time searching online and digging 
through the code, so if I've missed something obvious, please go easy :)


Alan.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple Viewers, Multiple Scenes, Texture::setUnRefImageDataAfterApply()

2008-06-04 Thread Alan Ott
I actually did try this last night, after I sent the email. I subclassed 
Texture2D and overrode apply() to call the base apply(), then unref the 
image. This makes the image unref work, but I'm still seeing some 
anomalies (unrelated, I'm assuming now, but before, I blemed them on 
running out of memory). I've outlined them in my other reply.


Thanks for your help,

Alan.

Guy wrote:


Hello,
This might sound naïve, but what about setting the texture2d image to null 
manually, after you no longer need it. (maybe it's not elegant but shouldn't it 
work?)
Guy.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Ott
Sent: Tuesday, June 03, 2008 9:40 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Multiple Viewers, Multiple Scenes, 
Texture::setUnRefImageDataAfterApply()

I accidently just sent this to the old openscenegraph.net list address. 
If it shows up twice in your inbox, I apologize.



Hello,

I have somewhat of a weird situation. I have an application which uses a
non-osg rendering system. In this application, I have my library which
draws somewhere in the middle of the draw() phase of the external
renderer. I actually draw twice during the external renderer's draw(),
because I draw to two different parts of the screen, and because the
application must draw over the top of my OSG stuff.

It goes like this:

external renderer draws some stuff
   my first osgViewer::Viewer draws some stuff
external renderer draws more stuff
   my second osgViewer::Viewer draws some more stuff
external renderer draws final stuff

The reason it's like this is because the external renderer needs to draw
over the top of my 3D image, and the two Viewers are drawing separate
scenes. I'm doing this using two osgViewer::Viewer objects. Each OSG
Viewer is unaware of the other. This setup appears to be working fine.

THE PROBLEM

The problem is that I have some rather large textures, and would like to
use Texture::setUnRefImageDataAfterApply() to remove texture image data
after it's been pushed to the scene. This works well if I only have one
osgViewer::Viewer instance, but when I have two Viewers, Texture2D won't
ever free the Image data because Texture::areAllTextureObjectsLoaded()
will return false because the textures have not been loaded to _both_
Viewer's contexts. The reality is that in my application, they
_never_will_ be loaded to both Viewer's contexts because the two viewers
contain completely separate scenes (and thus textures).

I can't figure out a good way to make Texture2D unref the Image. Does
anyone have any ideas?

This all came about because I'm in the process of upgrading my software
to use OSG 2.4 from 1.0 (Yeah, it's been a while...). In OSG 2.4 (and
also in 2.2) the application seems to require almost _four_times_ the
system memory to load the same textures as it did in version 1.0. Has
anyone else run into this? I would like to make
setUnRefImageDataAfterApply() work ideally, but I'd also be happy with
the OSG 1.0 amount of ram usage. A solution to either would be very much
appreciated.

Thank you very much, and thank you for your hard work on OSG.

Alan.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple Viewers, Multiple Scenes, Texture::setUnRefImageDataAfterApply()

2008-06-04 Thread Alan Ott

Robert Osfield wrote:


Hi Alan,

The memory difference is almost certainly down to the different in
Texture unref after apply which is probably not working because of
your viewer setup.
 


Robert,

While the unref of course makes me able to use less memory, _not_ using 
the unref is where I observed the 4x number.


Memory usage using the same app, same data, but with different OSG versions:
   OSG1 no unref - 223m
   OSG2 no unref - 802m
   OSG2 with unref - 92m

I'm wondering if some default setting is different in version 1 vs 
version 2. Note that these numbers are from my test application (not 
embedded in the external non-OSG app, but embedded in a GLUT window 
instead. Note also that these numbers come from running a single viewer 
instance, so the unref is working when I request it to.  I'm going to 
put together a small test program loading these textures to see if I can 
narrow down the problem.


Another Issue I saw with OSG2 as opposed to OSG1 is that when loading 
these large textures, rendering gets blocked by a call to 
gluScaleImage() in Texture.cpp when the texture is bound the first time. 
I do all my loading on a separate thread to keep the rendering path 
clear, but in OSG2 for some reason, it's spending a lot of time at this 
gluScaleImage() function in the main thread. I temporarily got around 
this by setting the non-resize to power of two flag, and this seems to 
work, but I didn't need to do that with OSG1. In fact, I think I can be 
sure that it _was_ resizing in OSG1 because one of my boxes here is an 
older ATI, and I see debug messages saying that it's disabling the 
non-power-of-2 extension for my hardware, which means it _must_ be 
resizing in OSG1. I'll check it again.


It just seems like there are too many weird things happening here for 
them to be independent from one another.



Are you using the GraphicsWindowEmbedded feature?  Is each of the
viewers using its own
GraphicsWindowEmbedded?  If so make sure they share the same instance
as this will
ensure they both use the same ContextID.
 

Right now, they are separate, as I use the 
osgViewer::Viewer::setUpViewerAsEmbeddedInWindow() function. I'll try 
making them use the same GraphicsWindowEmbedded. I've done this in 
another app (it was using CompositeViewer, though).



The other approach you could take is to do you own OpenGL rendering in
a pre/post Camera callback, and use CompositeViewer.  This will give
plenty more flexibility.
 

I looked at using a CompositeViewer for this, and I do use 
CompositeViewer on another project. The problem I have with it on this 
one is that best I can tell, CompositeViewer has one frame() function 
which draws all the Views at once. Currently, I do two separate draws, 
and I'm not sure I can do them both at the same time.


Some more information:

In my application, I do this to draw my stuff (this is outside of OSG):

   glPushAttrib(GL_ALL_ATTRIB_BITS);
   //glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   //glMatrixMode(GL_TEXTURE);
   //glPushMatrix();

   digitalMap->draw();   // This is my class which uses OSG. It 
contains a Viewer which I call frame() on here.


   //glMatrixMode(GL_TEXTURE);
   //glPopMatrix();
   glMatrixMode(GL_PROJECTION);
   glPopMatrix();
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();
   //glPopClientAttrib();
   glPopAttrib();

Keep in mind that I'm doing this twice, as I have two instances of 
DigitalMap. Push()/pop() for Client Attributes is currently disabled. In 
OSG1 I needed this, but now in OSG2, if I have the push/pop enabled, 
only the geometry which was in the scene before the first frame() 
actually gets drawn to the screen. Geometry that gets paged in later 
will never get drawn. I'm not sure what glPushClientAttrib() has to do 
with that, but that seems to be how it works, even in my simple GLUT 
test app.


All this stuff worked beautifully in OSG 1, and was rock solid. In OSG1, 
of course, I used the SceneView instead of OsgViewer as this was the 
recommended practice at the time.


Thanks again for all your help,

Alan.


Robert.

On Tue, Jun 3, 2008 at 8:39 PM, Alan Ott <[EMAIL PROTECTED]> wrote:
 


I accidently just sent this to the old openscenegraph.net list address. If
it shows up twice in your inbox, I apologize.


Hello,

I have somewhat of a weird situation. I have an application which uses a
non-osg rendering system. In this application, I have my library which
draws somewhere in the middle of the draw() phase of the external
renderer. I actually draw twice during the external renderer's draw(),
because I draw to two different parts of the screen, and because the
application must draw over the top of my OSG stuff.

It goes like this:

external renderer draws some stuff
 my first 

[osg-users] Multiple Viewers, Multiple Scenes, Texture::setUnRefImageDataAfterApply()

2008-06-03 Thread Alan Ott
I accidently just sent this to the old openscenegraph.net list address. 
If it shows up twice in your inbox, I apologize.



Hello,

I have somewhat of a weird situation. I have an application which uses a
non-osg rendering system. In this application, I have my library which
draws somewhere in the middle of the draw() phase of the external
renderer. I actually draw twice during the external renderer's draw(),
because I draw to two different parts of the screen, and because the
application must draw over the top of my OSG stuff.

It goes like this:

external renderer draws some stuff
   my first osgViewer::Viewer draws some stuff
external renderer draws more stuff
   my second osgViewer::Viewer draws some more stuff
external renderer draws final stuff

The reason it's like this is because the external renderer needs to draw
over the top of my 3D image, and the two Viewers are drawing separate
scenes. I'm doing this using two osgViewer::Viewer objects. Each OSG
Viewer is unaware of the other. This setup appears to be working fine.

THE PROBLEM

The problem is that I have some rather large textures, and would like to
use Texture::setUnRefImageDataAfterApply() to remove texture image data
after it's been pushed to the scene. This works well if I only have one
osgViewer::Viewer instance, but when I have two Viewers, Texture2D won't
ever free the Image data because Texture::areAllTextureObjectsLoaded()
will return false because the textures have not been loaded to _both_
Viewer's contexts. The reality is that in my application, they
_never_will_ be loaded to both Viewer's contexts because the two viewers
contain completely separate scenes (and thus textures).

I can't figure out a good way to make Texture2D unref the Image. Does
anyone have any ideas?

This all came about because I'm in the process of upgrading my software
to use OSG 2.4 from 1.0 (Yeah, it's been a while...). In OSG 2.4 (and
also in 2.2) the application seems to require almost _four_times_ the
system memory to load the same textures as it did in version 1.0. Has
anyone else run into this? I would like to make
setUnRefImageDataAfterApply() work ideally, but I'd also be happy with
the OSG 1.0 amount of ram usage. A solution to either would be very much
appreciated.

Thank you very much, and thank you for your hard work on OSG.

Alan.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org