Re: [osg-users] [forum] Understanding osg Image packing

2012-12-27 Thread Sergey Polischuk
Hi

what pixel format and type you have passed to 
osg::Image::computeRowWidthInBytes(...) call?

Cheers,
Sergey.

26.12.2012, 21:48, Claus Steuer claus...@googlemail.com:
 Hi,

 i try to understand the packing parameter of osg::Image::allocateImage.
 My current understanding is that packing specifies the alignment of each 
 pixel row in memory like the GL_PACK_ALIGNMENT parameter in OpenGL does.

 That means if i have a packing of 2 and an image width of 3 with 3 bytes per 
 pixel, one row would take 10 bytes of memory, whereas it would take 9 bytes 
 of memory if a packing of 1 would be used.

 However when i use the calculation made in osg::Image::computeRowWidthInBytes 
 for the same example i get 6 bytes for each row.

 Since i dont expect osg to be wrong at this there must be some error in my 
 understanding of the packing parameter.

 I hope someone can enlighten me,
 Claus

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=51654#51654

 ___
 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] osgFX::outline: unable to change outline color

2012-12-27 Thread Sergey Polischuk
Hi

If you are using shaders in your implementation, make sure you declared shader 
version with #version directive and check compilation log on warnings

Cheers.

26.12.2012, 22:02, Mike Metcalf metcalfnos...@mac.com:
 We've been attempting to implement an osgFX::outline node for highlighting 
 during mouse selection/hover.

 Our implementation works, except that the resulting outline ignores our calls 
 to setColor() and remains black at all times. Outline line widths properly 
 respond to calls to setWidth().

 We gave a version of the app to a tester and he found that the outline was 
 appearing as yellow, as our source was requesting.

 We found his machine has an NVidia card running OpenGL 4.2. All of us 
 developers, for whom the outline is always black, are running NVidias with 
 OpenGL 3.3.0 or 3.2.0.

 Because our development machines cannot be updated to OpenGL 4.2, is there 
 something else we might do to correct this behavior?

 Thanks in advance!

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=51572#51572

 ___
 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] Projective multitexturing save/export

2012-12-27 Thread Sergey Polischuk
Hi

how would you include glsl shaders in 3ds file, for example?
model formats support some limited set of features, and not all of those 
supported by osg writer plugins.

26.12.2012, 21:24, Mateo Gasparovic mateo.gasparo...@gmail.com:
 Hi,

 I've made projecting textures on the STL model. To project textures I've used 
 the OpenGL vertex and fragment sheders as in examle on Jotschi's Blog: 
 ProjectiveTextureExample OpenSceneGraph.
 I'm interested if is it possible to save the textured model that is displayed 
 in the window (viewer) in OBJ, 3DS, PLY, VRML2.0 file?

 When I save a model in OSG file and import it again, everything is OK. My OSG 
 model file has texture information. If the problem can be solved by 
 converting the OSG to OBJ, 3DS, PLY or VRML2.0 it's fine as well.
 Is there a program, procedure or sample code for such conversion?

 I tried to save node/object file (OBJ) but in both cases I only receive 
 geometry model
 without textures. MTL file is empty. Also, I've tried to export a 3DS or PLY 
 file, but in both cases I got geometry without textures.

 Below I have attached a part of my code, where I tried to save/export 
 textured model.

 osgViewer::Viewer viewer;
 viewer.setSceneData(createModel3());
 osgDB::writeObjectFile(*viewer.getSceneData(),test.obj);

 Thank you for help!

 Best regards,
 Mateo Gasparovic

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=51113#51113

 ___
 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] [vpb] osgdem with terrain from worldMachine

2012-12-27 Thread Ethan Fahy
I've used World Machine before to create heightmaps for CryEngine and UDK but I 
thought that World Machine didn't georeference any of its files and was meant 
more for videogames and CGI.  That being said you could always use gdal to add 
georeferencing to the World Machine output files and then use those in VPB.  
I'm not sure how VPB handles non-georeferenced files.  

All this being said, it sounds like the problems you are having are more to do 
with textures so maybe I'm off base here.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51721#51721





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


Re: [osg-users] [vpb] On adding GL_FLOAT / GL_LUMINANCE32F Texture Support

2012-12-27 Thread Ethan Fahy
There was a feature proposal to add floating point texture support to VPB:

http://forum.openscenegraph.org/viewtopic.php?t=9515

I'm not sure if it ended up being added or not, but either way you may be able 
to add the proposed src to the current VPB src to add the support you are 
looking for.  

I was looking to do the same type of thing as you a while back and instead of 
adding floating point textures to the terrain model, I created basic unisigned 
8 bit int textures that contained my own indexing scheme in the rgb channels.  
Then I used GLSL shaders to decode the indexing scheme and apply a floating 
point value based on floating point texture files that I attached to the 
shaders as a uniform using osg.  That type of scheme may or may not work for 
you.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51722#51722





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


Re: [osg-users] Multiple Cameras and lagging proj matrix

2012-12-27 Thread Paul Martz

Ah ha. And each Camera has it's own StateSet. I see.

My situation is a bit different, as I have a single subordinate Camera buried in 
the scene graph, and it is on that Node that I want to set a projection matrix 
Uniform that has a different value per render thread. I could, in theory, add 
the Uniform much higher in the scene graph, at the top level slave Cameras used 
to create each view. But, unfortunately, this project is a middleware utility 
for use by OSG-based apps, so keeping my state and geometry local to a single 
subgraph in desirable...


But thanks for the ideas and inspiration. Hopefully I can make this work yet.
   -Paul



On 12/26/2012 2:31 PM, Glenn Waldron wrote:

On Wed, Dec 26, 2012 at 1:08 PM, Paul Martz pma...@skew-matrix.com
mailto:pma...@skew-matrix.com wrote:

Hi Glenn -- I've managed to compute the matrix I need using the clamp
projection callbacks, so thanks for directing my attention there.

But I've ran into problems with multithreading, and it seems like you should
have the same issues, so...

1) When your cull callback sets the matrix uniform value, how are you
ensuring that's thread safe? How do you avoid thread collisions from
multiple cull threads writing the same uniform, or one draw thread reading
it while another cull thread writes it?


I use a separate set of uniforms for each thread with the per-view data
idiom. There is a std::maposg::Camera*,PerViewData that the cull traversal
code accesses each time based on the active Camera. Map access is protected by a
Mutex. The PerViewData structure contains the actual Uniforms for that Camera.


2) And, along the same lines, it seems like the computed near/far (and
resulting projection matrix) would be different for each render thread
(depending on what was in that thread's view frustum). What technique are
you using that lets you set a different uniform value per render thread?


See above.


Thanks.
-Paul



On 12/15/2012 2:54 PM, Glenn Waldron wrote:

Yes, you got it. cullOvelayGroup() is called during the cull traversal
from an
overloaded traverse() method in OverlayDecorator (which subclasses 
Group).

Glenn Waldron / @glennwaldron



On Sat, Dec 15, 2012 at 1:54 PM, Paul Martz pma...@skew-matrix.com
mailto:pma...@skew-matrix.com
mailto:pma...@skew-matrix.com mailto:pma...@skew-matrix.com__ 
wrote:

 Thanks, Glenn -- I saw the callback for clamping the projection
matrix while
 I was sifting through the code, and your osgEarth example code is 
very
 enlightening.

 Your function cullOverlayGroup(), is that a cull callback? Let me
 regurgitate what it does, so you can correct me if I'm
misunderstand: It
 runs the CullVisitor on its subgraph, then uses the resulting 
clamped
 projection matrix (which it gets from the clampProjection callback)
as a
 uniform in your shader code. Hm. Cool idea.
 -Paul



 On 12/14/2012 1:27 PM, Glenn Waldron wrote:

 Paul,
 I had a similar problem (I think). I installed a custom
callback on the RTT
 camera
(CullSettings::setClampProjectionMatrixCallback). This

 callback would
 call the original implementation first, then store the results
of the
 projection
 matrix clamp so that I could use it immediately.

 You can see the custom callback here:


https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ClampingTechnique.cpp#L171

https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L171



https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L171

https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ClampingTechnique.cpp#L171

 Each frame, I prime it with the current CullVisitor:


https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ClampingTechnique.cpp#L384

https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L384



https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L384

https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ClampingTechnique.cpp#L384

 And then immediately use the result to set a uniform:


https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ClampingTechnique.cpp#L403

https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L403



https://github.com/gwaldron/__osgearth/blob/master/src/__osgEarth/ClampingTechnique.__cpp#L403


[osg-users] How can I call a vector method on a generic array type?

2012-12-27 Thread Preet
Hi,

I'm trying to call std::vector functions on generic array objects. So I'd
like to be able to get an osg::Array and call something like size() or
clear() on it, but I'm not sure how I can do this without casting it to one
of the 'proper' array types. Is this possible?


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


Re: [osg-users] How can I call a vector method on a generic array type?

2012-12-27 Thread Sergey Polischuk
Hi if you have only osg::Array pointer then all you can get directly is array size : array-getNumElements()as for others - you can get to them only with exact type (which you can get computed with help of array-getDataType() and array-getType() return values) Cheers  28.12.2012, 08:59, "Preet" prismatic.proj...@gmail.com:Hi,I'm trying to call std::vector functions on generic array objects. So I'd like to be able to get an osg::Array and call something like size() or clear() on it, but I'm not sure how I can do this without casting it to one of the 'proper' array types. Is this possible?  Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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