Hello Markus,

Markus Wienhöfer wrote:
> Carsten Neumann wrote:
>> the nodes you pass in as world and ground to the navigator are used as 
>> the roots of a simple intersection test. So basically you should be able 
>> to set them both to the root of your scene, although that might be 
>> inefficient and perhaps even create false intersection if you have 
>> things like a skydome or similar.
>>
>>   
> I passed the scenes root node to the navigator...no change though. 
> Intersections seems to
> happen - the navigator gets stuck at time - but not really usable. Are 
> there standard
> values for the actors height, width, fatness one should try?

the default values are
     _height(0.85),
     _width(0.5),
     _fatness(0.5)
it depends on the size of your scene whether these make sense, though.

>> sure to only have it invoked indirectly by calling glutPostRedisplay ?
>> It seems that moving the mouse triggers more calls to Navigator::moveTo 
>> than when it is called from Navigator::idle. Sorry, offhand I've no idea 
>> what might cause that or what to do about it.
>>
>>   
> I think we only used glutPostRedisplay. I will recheck.
>> Hm, it should not, as turning on the statistics only adds another 
>> foreground to the viewport. Depending on how/if you create your window 
>> or viewport you might confuse the SSM and it adds the 
>> SimpleStatisticsForeground to the wrong viewport perhaps ?
>>
>>   
> We added a shadowviewport to accomodate our shadows. Possibly using it 
> the wrong way though.

are you adding a viewport (i.e. do you have two then) ? The SSM might be 
adding the foreground to the first one which is just completely covered 
by the second.

> A further more things that arose though:
> 
> ----- Apart from using the OpenSG primitives, what would be the right 
> way to construct
> objects oneself? We tried to construct the outer pyramid body, which 
> seemed to
> work, but how does one texture this?

you need to create a material for the geometry. The easiest way is 
probably to start with a SimpleTexturedMaterial. Note that your geometry 
should have texture coordinates for this to work.

> Same for a ground map. I do have a height map for the scene, but 
> couldn't really
> figure out what kind of object to use in OpenSG, are there any more 
> predefined
> objects?

In Source/Contrib/Terrain there is a terrain node core. However, the 
contrib stuff is not normally compiled into OpenSG, but if you are 
compiling it yourself anyways, you can enable it, see 
Source/Contrib/README for (short) instructions on how to enable the 
contribs.
I haven't use the terrain code, so I have no idea what it can do or how 
to make it do things, sorry.

> Currently we are trying like this:
> 
> --------------------------------------------------------------------------
> 
>     GeometryPtr pyramidgeo=Geometry::create();
>     beginEditCP (pyramidgeo, Geometry::TypesFieldMask    |
>             Geometry::LengthsFieldMask   |
>             Geometry::IndicesFieldMask   |
>             Geometry::PositionsFieldMask |
>             Geometry::MaterialFieldMask  );
>     {
>         pyramidgeo->setTypes    (pyramidtype);
>         pyramidgeo->setLengths  (pyramidlens);
>         pyramidgeo->setIndices  (pyramidindices);
>         pyramidgeo->setPositions(pyramidpnts);
>         pyramidgeo->setMaterial (getDefaultMaterial());  
>     }
>     endEditCP (pyramidgeo, Geometry::TypesFieldMask    |
>             Geometry::LengthsFieldMask   |
>             Geometry::IndicesFieldMask   |
>             Geometry::PositionsFieldMask |
>             Geometry::MaterialFieldMask  );
> 
> ---------------------------------------------------------
> 
> Where Types would be GL_TRIANGLES e.g.
> 
> Texturing these types doesn't seem to work though...do we have to 
> generate normals etc.?

normals are always good if you want the lighting to look decent ;)

> Is there
> a simple code example somewhere which creates a non-primitive object and 
> texturizes it?

Hm, I don't think so, most people use a modeling software package to 
create models, export them to a format OpenSG can load and go from there.
As I said before, I think the problem is that you are lacking texture 
coordinates on your geometry and or a material. Take a look at 
Source/System/NodeCores/Drawables/Geometry/OSGSimpleGeometry.{h,cpp}, 
this is where the code for the primitive objects is and at least some of 
them also compute the tex coords.

> ---- Is there an easy way to get a pixels color value from an ImagePtr?
> 
> This could be really helpful for the heightmap etc. I was able to read 
> the images width and height, but
> had no clue how to get the color values.

It's possible by using Image::getData() which gives you a pointer into 
the storage. From there it heavily depends on the images pixel format, 
but for a simple rgb with a byte per color:

const UInt8 *p = img->getData();

UInt8 red   = *p;
UInt8 green = *(p+1);
UInt8 blue  = *(p+2);

The next rgb triple starts at (p+3) or (p+4) depending on whether there 
is padding.

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to