Re: [osg-users] Shader Composition

2011-09-14 Thread Robert Osfield
Hi Bo,

ShaderComposer isn't complete, and should be viewed as experimental,
but it's able to do a few composition tasks.  The osgshadercomposition
example is a test bed for this feature, unfortunately I've been
swamped with other work so haven't been able to complete the work on
ShaderComposition functionality.

Robert.

On Tue, Sep 13, 2011 at 8:47 PM, Bo Jiang jb4...@gmail.com wrote:
 Hi All,

 I have a node, and I want to shade it using different effect, i.e. I have 
 several groups of shaders (vertex+geometry+fragment), and each group 
 implements one effect.

 Now I want to combine all the effects together when display the node. I do 
 not know how to achieve it. I searched the forum and it seems that the 
 osg::ShaderComposer class is not finished yet? Or shall I need to use the 
 two-passes effect like class in osgFX?

 Thank you!

 Cheers,
 Bo

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





 ___
 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] Two Cameras, Two Render Targets?

2011-09-14 Thread Robert Osfield
Hi Yefei,

The OSG supports multiple render to texture Cameras seamlessly, it
should simply be a case of creating the Camera's and adding the
textures and appropriate subgraphs to them and then using these
textures.  The only twist would be that if you are using Viewer slave
Camera then you'll need to make sure that these slaves don't inherit
the main scene graph as is the default behavior of slave Camera.  A
render to texture Camera in the scene graph doesn't inherit any
subgraph so it'll just use what subgraph you assign to it.

Robert.

On Wed, Sep 14, 2011 at 1:01 AM, He, Yefei yefei...@uiowa.edu wrote:
 Hello, Folks,



 I’m working on an OSG application that requires two cameras rendering two
 different subscenes into textures, and apply the two textures to different
 geometries in the main scene.  I started out with the osgprerender example
 by creating two cameras and attaching them to two different textures. But
 the result was the two textures were identical, and the content was that
 from the first camera. I saw that Anthousis Andreadis reported a similar
 problem in April and later submitted a fix. My version of OSG does contain
 that fix. I looked into osgstereomatch and osgmultiplerendertargets, but I
 figured they are a bit different from my application. In those applications,
 a single camera is attached to multiple textures; in my case, two cameras
 are attached to two different textures. What do I need to do to make my
 application work? Are there any examples that I can look at?



 Thanks,



 Yefei

 ___
 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] 回复:Re: osgShadow compile problem with OSG 2.7.8

2011-09-14 Thread Robert Osfield
2011/9/14 蔡少波 beijihu...@126.com:
 Hello,I have a question .And I think only you can solve it:
 The example picking object have noticed the kdtree and the points in
 triangle special. I wan't to know how to uses the triangle
Thank you very much!

Could you please start a new thread to disucss a new topic rather than
piggy back off an existing unrelated topic.

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


[osg-users] help with osgVolume

2011-09-14 Thread Allen Wing
Hello there,
This is my first post. I'm a college student recently working on a project
dealing with volume rendering. I use osgVolume to render two series of dicom
files. But only one of them with MR modality can be rendered correctly, the
other with CT modality cannot. My questions are:
1. how does osgvolume parse dicom image? using osg::ImageSequence or other
external libraries?
2. since in my case osgVolume cannot render CT modality dicom files
correctly, I think osgVolume cannot parse them correctly. So what parameters
I need to extract from dicom file in order to correctly render dicom files?
Slice thickness, spacing between slice or z axis?
3.I tried to read osgVolume source code. But it contains too few comments to
understand. So can anyone provide some documentation, user manual or any
advices?

Thanks in advance.

I'm a beginner with osg so these questions may be too trivial. If it annoys
you, I apologize.

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


Re: [osg-users] help with osgVolume

2011-09-14 Thread Robert Osfield
Hi Allen,

On Wed, Sep 14, 2011 at 10:12 AM, Allen Wing wanglinse...@gmail.com wrote:
 Hello there,
 This is my first post. I'm a college student recently working on a project
 dealing with volume rendering. I use osgVolume to render two series of dicom
 files. But only one of them with MR modality can be rendered correctly, the
 other with CT modality cannot. My questions are:
 1. how does osgvolume parse dicom image? using osg::ImageSequence or other
 external libraries?

Dicom images are read using the DCMTK based dicom plugin found at
OpenSceneGraph/src/osgPlugins/dicom.  There is a fallback in this
plugin that uses ITK but it doesn't handle the range of dicom images
as well as DCMTK can.

 2. since in my case osgVolume cannot render CT modality dicom files
 correctly, I think osgVolume cannot parse them correctly. So what parameters
 I need to extract from dicom file in order to correctly render dicom files?
 Slice thickness, spacing between slice or z axis?

When you read dicom files using the dicom plugin you should pass the
directory name that contains the dicom files and it'll load them all,
place them into a single osg::Image and set the dimensions correct so
that osgVolume can set up the location of the volume brick properly.

 3.I tried to read osgVolume source code. But it contains too few comments to
 understand. So can anyone provide some documentation, user manual or any
 advices?

There isn't a manual I can point you at I'm afraid.

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


Re: [osg-users] [osgPlugins] VRML plugin: help in compiling

2011-09-14 Thread Paolo Piazzi
Hi,

now vrml plugin works! I can see almost snoman.wrl, but without animation and 
withot arms. Probably there is something wrong in the plugin or in the 
interface with openvrml libs.
The error are Impossible to find the specified module and no 
osg:Animation::AnimationManagerBase found in the subgraph, no animation 
available

Any ideas?
Thank you!

Bye,
Paolo

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





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


[osg-users] Issues with osgShadow and diffuse+reflections maps

2011-09-14 Thread Alessandro Terenzi
I'm trying different shadows techniques with some simple models and I'm facing 
some issues when I try to add shadows to a scene where an object has both a 
diffuse and reflection map. By providing some arguments to osgshadow (in order 
to change shadow texture unit for example) in some cases I manage to see the 
reflections but I never get the expected result (either the diffuse map 
disappears or the shadows are not correct).

If I just use a diffuse map (or just the reflection map) then some techniques 
work fine but others do not.

I'm attaching the sample model I tried. Can anyone suggest if there is a way to 
get the expected result? Am I supposed to change the shaders' code in some way?

Thanks.
Alessandro

PS: I'm using version OSG v3.0.1.

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




Attachments: 
http://forum.openscenegraph.org//files/test_diffuse_reflection_179.zip


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


[osg-users] [osgCompute] Experiences with osgCompute

2011-09-14 Thread Bart Postma
After wrapping up a project in which I used osgCompute together with 
OpenSceneGraph I have some mixed feelings about this library. I shall write 
them down below in the hope that they can be of help to the developers and 
anybody else that may also bumped to the specific issue. Perhaps/probably some 
of them may be fixed in an elegant manner and then please tell me how. Although 
I know how to work with OSG and CUDA I certainly do not consider myself to be 
an expert on OSG or CUDA.

1) I first thought that osgCompute supported multithreading applications, as is 
claimed on http://www.cg.informatik.uni-siegen.de/svt/osgcompute/:
The current SVN version of OpenSceneGraph (OSG-svn/trunk/2.9.x or later) or 
the upcoming release of OpenSceneGraph-2.8.1 is recommended for the support of 
multithreading with osgCuda
However, after a lot of searching, debugging, and scratching my head I found 
that multithreading is not supported. Turning on single-threaded solved my 
problem. Later I found in the doxygen documentation in the section Known issues 
(http://www.basementmaik.com/doc/osgcompute/html/KnownIssues.html):
Only single threaded applications are supported.
There seem to be contradicting statements here.

2) OsgCompute does not seem to support CUDA constant memory. I have to do a 
plain CUDA call: cudaMemCpyToSymbol

3) About the init function:
3.1) It was not clear to me that I can do stuff with osgCompute only after the 
init() function has been called. I wanted to fill CUDA memory objects with data 
before the init function was called (see 3.2 for the reason why). I was unaware 
that this was not possible and it took me a while to figure this out.

3.2) The lazy allocation with the init function, which is called before the 
launch function, is not desirable, especially not in real-time applications. 
Often you want to set up as much as possible at the start of your application 
and not do this during run-time (from a real-time performance perspective). I 
would prefer that the user should have the responsibility of initializing his 
data (e.g. in constructor) and not force the user to declare an init function.

3.3) The init function causes me to declare a lot of variables globally. 
Normally the constructor receives all the necessary data and consequently I use 
this data for initialization purposes only once, so there is no need to store 
the received data globally. But now if I want to do some fill CUDA memory with 
data or copy a constant to CUDA memory, I have to do this in the init function 
and not in the constructor. Consequently I store all this data globally, so the 
init function can access it.

3.4) What does the init function do in the Resource class (and subsequently in 
subclasses Module and Memory)? Documentation is not really concrete on this:
Init will check for internal parameters applied to resources and will create 
device dependent objects

3.5) I tried to get rid of this init function somehow and use constructors 
again. But then I had to remove the META_Object macro and that gave me more 
errors than I would like see and I did not want to spend too much time on this 
anymore.

4) About the map function:
4.1) When and what is synchronized between device and host? It's described 
rather vaguely. And are we talking about a complete memory copy or a simple 
pointer-copy between OpenGL and CUDA context?

4.2) In the osgEndianness demo we allocate a Memory object (corresponding to a 
cudaMalloc) and there is still a map() function called. As far as I know 
mappings are only performed on GL-buffer objects to map them from OpenGL 
context to CUDA context. Secondly, I think in (one of) the other examples you 
call map() each frame of a Memory object. Why? It makes sense to do this if we 
are dealing with a GL-buffer object, since GL manages the buffer object and may 
choose to move the buffer in memory somehow. But a map() on Memory object seems 
strange, since it is not a GL-buffer object. It is even stranger to call this 
map() each frame, since cudaMalloc gives us a device pointer that remains valid.

4.3) Why not call unmap after map in the provided examples? It is probably 
called somewhere behind the scenes, but is not clear to user (also when it is 
called).

5) Certain names are not very insightful, for example, the class 'Module'. The 
name 'Module' is a very general term and does not provide the user much 
information about this class. At first I thought the Computation class was the 
class that contained a CUDA program (would make sense I think: a class 
Computation that contains a program that performs GPU computations), but now I 
understand that a Module contains a CUDA program and Computation contains 
Modules.

6) There is a setImage function in osgCuda::Memory (why not in 
osgCompute::Memory?) and I really have no idea what the purpose of this 
function is. In osgCompute 0.5 it was called setArray() and was used to set the 
data of a Memory object (Buffer object in 

[osg-users] GLSL: Attribute vs Uniform

2011-09-14 Thread Paul Palumbo
How much faster is using an attribute property versus a uniform when 
passing data to a fragment shader?

Paul P.

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





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


Re: [osg-users] [vpb] Placing an object on a UTM file generated with osgdem

2011-09-14 Thread Ethan Fahy

Chris 'Xenon' Hanson wrote:
 On 9/13/2011 12:44 PM, Ethan Fahy wrote:
 
  Now I just need to find a forum post I saw that shows how to place an 
  object on the terrain based on an  lat/lot...
  
 
 http://forum.openscenegraph.org/viewtopic.php?t=6734
 


After reading those postings it looks like the relevant part to my case would 
be the following:

Code:

This is how you would place your model...

osg::Matrixd position;
ellipsoid-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadia
ns(lat),
osg::DegreesToRadians(lon), altitude, position);
transform-setMatrix(position);

where transform is an osg::MatrixTransform node that has your model as a
child node.

The X,Y,Z geocentric Cartesian coordinates from the lat,lon,alt can be
extracted by:

osg::Vec3d pos = position.getTrans(); 



I'm a little unclear on the full implementation of this though.  Do I wrap that 
code up into something like this after reading in both the terrain and a tree 
for example:


Code:

osg::ref_ptrosg::EllipsoidModel ellipsoid = new osg::EllipsoidModel();
osg::ref_ptrosg::MatrixTransform transform = new 
osg::MatrixTransform();
float lat = 50.0;
float lon = 50.0;
float altitude = 1000.0;
osg::Matrixd position;

ellipsoid-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(lat),osg::DegreesToRadians(lon),
 altitude, position);
transform-setMatrix(position);

osg::ref_ptrosg::Group root = new osg::Group();
root-addChild(terrain);
root-addChild(transform);
transform-addChild(tree);




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





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


Re: [osg-users] GLSL: Attribute vs Uniform

2011-09-14 Thread Robert Osfield
Hi Paul,

On Wed, Sep 14, 2011 at 1:14 PM, Paul Palumbo paul1...@yahoo.com wrote:
 How much faster is using an attribute property versus a uniform when 
 passing data to a fragment shader?

That exact difference would depend upon your driver, hardware and
shaders, but in general passing attributes is faster than passing
uniforms.  To know how much faster you'll need to profile it against
your data/shaders and hardware.

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


[osg-users] Intel Core i5, Ubuntu: Bug with element buffer object with both byte und ushort indices !!

2011-09-14 Thread Alexander Irion
Hello,

I have a quiet weird problem with Intel Core i5 integrated graphics under 
Ubuntu:

When I have an element buffer object, that consists of an byte index array, 
followed by an ushort index array, wrong triangles will be rendered. (See 
wrong_rendering.png, compared to right_rendering.png).

The attached osgt model file consists of two GL_TRIANGLES draw calls, that use 
the same buffer object for indices.

DrawElementsUByte::draw size:300 offset: 0
DrawElementsUShort::draw size:861 offset: 300

I modified the code to draw only once of them - either the ubyte array or the 
ushort array and in both cases the right triangles are rendered, whereas 
rendering fails, when both draw calls are made.

It looks like the driver interprets the ushort indices as byte indices, that 
would explain the fan looking triangles, that are drawn. The high byte (0) of 
an ushort index would then often be taken as vertex 0 for one of the three 
triangle vertices, so their would be many wrong triangles starting from vertex 
0 to some other vertices - exactly, as it looks in the attached screen shot of 
the wrong rendering.

The same model looks good on a system with Nvidia graphics, it also works on 
the Intel GPU, when the arrays reside in different buffer objects, or when 
element buffer objects are not used for the vertex indices.

From the application side, everything looks good inside osg, so I think this 
is a driver bug.

Does anyone who also has integrated Intel grahics under linux can confirm this 
bug?
(To verify, just start the osgviewerapp with the attached model file).

Would that samething for the Mesa guys to look at?

Regards,
--Alex


My spec:

Ubuntu 11.04

OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) Ironlake Desktop GEM 20100330 
DEVELOPMENT x86/MMX/SSE2
OpenGL version string: 2.1 Mesa 7.10.2
OpenGL shading language version string: 1.20

VGA compatible controller:
 product: Core Processor Integrated Graphics Controller
 vendor: Intel Corporation
 physical id: 2
 bus info: pci@:00:02.0
 version: 02
 width: 64 bits
 clock: 33MHz
 capabilities: msi pm vga_controller bus_master cap_list rom
 configuration: driver=i915 latency=0
 resources: irq:42 memory:f000-f03f 
memory:e000-efff ioport:1170(size=8)

CPU:
  product: Intel(R) Core(TM) i5 CPU 660  @ 3.33GHz
  vendor: Intel Corp.
  physical id: 5
  bus info: cpu@0
  version: 6.5.5
  serial: 0002-0655----
  slot: XU1 PROCESSOR
  size: 1199MHz
  capacity: 1199MHz
  width: 64 bits
  clock: 133MHz
  capabilities: x86-64 boot fpu fpu_exception wp vme de pse tsc msr pae 
mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 
ss ht tm pbe nx rdtscp constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc 
aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr 
pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept 
vpid cpufreq
  configuration: cores=2 enabledcores=2 id=1 threads=4

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




Attachments: 
http://forum.openscenegraph.org//files/optosgt_211.gz
http://forum.openscenegraph.org//files/right_rendering_125.png
http://forum.openscenegraph.org//files/wrong_rendering_148.png


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


Re: [osg-users] Intel Core i5, Ubuntu: Bug with element buffer object with both byte und ushort indices !!

2011-09-14 Thread Robert Osfield
Hi Alex,

Which version of the OSG are you using?  Just prior to the OSG-3.0
release I checked in code that aligned arrays within a buffer object
to 4 byte boundaries, this was done to address problems in Intel
drivers.

Robert.

On Wed, Sep 14, 2011 at 1:35 PM, Alexander Irion alexander.ir...@xse.de wrote:
 Hello,

 I have a quiet weird problem with Intel Core i5 integrated graphics under 
 Ubuntu:

 When I have an element buffer object, that consists of an byte index array, 
 followed by an ushort index array, wrong triangles will be rendered. (See 
 wrong_rendering.png, compared to right_rendering.png).

 The attached osgt model file consists of two GL_TRIANGLES draw calls, that 
 use the same buffer object for indices.

 DrawElementsUByte::draw size:300 offset: 0
 DrawElementsUShort::draw size:861 offset: 300

 I modified the code to draw only once of them - either the ubyte array or the 
 ushort array and in both cases the right triangles are rendered, whereas 
 rendering fails, when both draw calls are made.

 It looks like the driver interprets the ushort indices as byte indices, that 
 would explain the fan looking triangles, that are drawn. The high byte (0) of 
 an ushort index would then often be taken as vertex 0 for one of the three 
 triangle vertices, so their would be many wrong triangles starting from 
 vertex 0 to some other vertices - exactly, as it looks in the attached screen 
 shot of the wrong rendering.

 The same model looks good on a system with Nvidia graphics, it also works on 
 the Intel GPU, when the arrays reside in different buffer objects, or when 
 element buffer objects are not used for the vertex indices.

 From the application side, everything looks good inside osg, so I think this 
 is a driver bug.

 Does anyone who also has integrated Intel grahics under linux can confirm 
 this bug?
 (To verify, just start the osgviewerapp with the attached model file).

 Would that samething for the Mesa guys to look at?

 Regards,
 --Alex


 My spec:

 Ubuntu 11.04

 OpenGL vendor string: Tungsten Graphics, Inc
 OpenGL renderer string: Mesa DRI Intel(R) Ironlake Desktop GEM 20100330 
 DEVELOPMENT x86/MMX/SSE2
 OpenGL version string: 2.1 Mesa 7.10.2
 OpenGL shading language version string: 1.20

 VGA compatible controller:
             product: Core Processor Integrated Graphics Controller
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@:00:02.0
             version: 02
             width: 64 bits
             clock: 33MHz
             capabilities: msi pm vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:42 memory:f000-f03f 
 memory:e000-efff ioport:1170(size=8)

 CPU:
          product: Intel(R) Core(TM) i5 CPU         660  @ 3.33GHz
          vendor: Intel Corp.
          physical id: 5
          bus info: cpu@0
          version: 6.5.5
          serial: 0002-0655----
          slot: XU1 PROCESSOR
          size: 1199MHz
          capacity: 1199MHz
          width: 64 bits
          clock: 133MHz
          capabilities: x86-64 boot fpu fpu_exception wp vme de pse tsc msr 
 pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr 
 sse sse2 ss ht tm pbe nx rdtscp constant_tsc arch_perfmon pebs bts xtopology 
 nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 
 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow 
 vnmi flexpriority ept vpid cpufreq
          configuration: cores=2 enabledcores=2 id=1 threads=4

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




 Attachments:
 http://forum.openscenegraph.org//files/optosgt_211.gz
 http://forum.openscenegraph.org//files/right_rendering_125.png
 http://forum.openscenegraph.org//files/wrong_rendering_148.png


 ___
 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] [3rdparty] Scene Graph Viewing App

2011-09-14 Thread Andreas Ekstrand

Hi Conan,

Another tool you could use is Remo 3D (www.remograph.com). It's 
commercial, but the free demo version works as a viewer and supports 
plenty of file formats and an intuitive tree view.


Regards,
Andreas


On 2011-09-13 07:27, Sergey Kurdakov wrote:

Hi Conan,

maybe following would be useful:

there are several old tools

http://osgedit.sourceforge.net/
http://sourceforge.net/projects/osgscenemaker/

 not sure how well they could serve, but from screenshots it looks like
 you may access the structure ( but you would need to compile these 
tools with your version of osg )


commercial app to view structure is 
http://www.simlab-soft.com/3d-products/simlab-composer-main.aspx

it supports OSG files.

Regards
Sergey




___
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] ScreenCaptureHandler

2011-09-14 Thread Paul Palumbo
Can the osgViewer::ScreenCaptureHandler be configured to (render to and) 
capture an Intensity-Alpha 32-bit floating point image?  

Also, what output file formats in OSG support support 32-bit floating point 
output values?

Paul P.

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





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


Re: [osg-users] Calculating distance, in world CS between Camera node and vertices

2011-09-14 Thread Sergey Polischuk
vec4 worldSpaceCameraPosition = osg_ViewMatrixInverse * vec4(0,0,0,1);//you can 
use just translation column(or row?) of matrix instead
vec4 worldSpaceVertexPosition = osg_ViewMatrixInverse * gl_ModelViewMatrix * 
gl_Vertex;
vec4 worldSpaceVectorFromCameraToVertex = osg_ViewMatrixInverse * 
vec4((gl_ModelViewMatrix * gl_Vertex).xyz, 0.0);

Cheers

13.09.2011, 20:30, Conan Doyle o...@celticblues.com:
 How would I calculate the actual world positions, not distances, of the 
 camera and the vertices?

 CD

 hybr wrote:

  Hi, Conan

  gl_ModelViewMatrix * gl_Vertex is position of vertex in camera space
  If your view matrix dont have scale component, you dont need anything else 
 to calculate distance (by distance i mean vector length)
  In general case you can use:
  osg_ViewMatrixInverse * gl_ModelViewMatrix * gl_Vertex - this is world 
 space vector from camera to vertex

  Cheers,
  Sergey.

  13.09.2011, 18:19, Conan Doyle :
  Hi,

  I want to calculate the distance between my final render cameras position 
 and the vertices of each object rendered.  I want to pass the world 
 position of the camera into a shader and then use gl_Vertex position to 
 perform the calculation.  In search the OSG website, the net and this forum 
 (as I understand a good OSG newbie should) I found the following

  http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/CameraControlFindingWorldCoordinates
   Where in the world am I?
   To compute where a particular node is the scene graph is, in world 
 coordinates, you need to acquire the accumulated 4x4 matrix from the root 
 of the scene graph down to your node. osg::Node contains a convenience 
 method, Node::getWorldMatrices(..), that walks the parental chain from 
 your node to the root(s) of your scene graph, returning a list of 
 matrices. A list of matrices is returned rather than a single matrix as 
 the OpenSceneGraph supports sharing of nodes, so they may have multiple 
 parents, and if the parent chain has separate transforms in them the 
 different paths will result in different matrices - in this case you node 
 is effectively in more than one place at once! Multiple parents would be 
 typical in cases such as a wheel subgraph that is reused four times on a 
 car, each with a transform above it to place it in the appropriate place.
   To use this feature use code such as:

   osg::MatrixList worldMatrices = myNode-getWorldMatrices();

  for(osg::MatrixList::iterator itr = worldMatrices.begin();
  itr != worldMatrices.end();
  ++itr)
  {
  osg::Matrix matrix = *itr;
  osg::Vec3 center = myNode-getBound().center() * matrix;
  std::coutNode myNode-getName() center = center 
 worldMatrix = matrixstd::end;
  }
   
  I am wondering if this is what I need to do...  with myNode being my 
 viewer camera node, and then getting the worldMatrix for it If so, how 
 do I get the position from the worldMatrix?

  Conan

  Thank you!

  Cheers,
  Conan

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

  ___
  osg-users mailing list

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

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

   --
  Post generated by Mail2Forum

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

 ___
 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] Placing an object on a UTM file generated with osgdem

2011-09-14 Thread Ethan Fahy
To answer my own question, yes, the code snippet that I posted does work and 
allows me to attach an object to the terrain using lat lon elevation.  The next 
step is to be able to place an object on the terrain by only giving it a lat 
lot and having it figure out the elevation automatically...

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





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


Re: [osg-users] Intel Core i5, Ubuntu: Bug with element buffer object with both byte und ushort indices !!

2011-09-14 Thread Alexander Irion
Helllo Robert,

we use OSG-3.0 and this time its not the alignment problem, that we had on the 
Intel EMGD before.

The offset of the ushort array is 300 - so it is already dividable by 4, I also 
already tested with some other alignment values.

With my tests, I verified that the content of the element buffer is valid for 
both draw calls, and if I have only one of the draw calls, the right triangles 
are rendered - it only fails, when both glDrawElements are called.

I hacked in two lines in the DrawElementsUByte::draw() method for testing.

So, this fails with rendering garbage triangles:

glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);

but this:

glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
//glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);

or this:

//glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);


works well and draws the right triangles of either the indices 0-299 or 
300-1160. (Nothing else in the program is changed, so buffer contents is the 
same for all three test cases.)

When each glDrawElements() is doing right, calling both glDrawElements() in 
direct sequence would be expected to do also right and to show the sum of 
each render calls, which it is not doing.

So, in the meantime I will kick out the Intel graphics and go for a new Nvidia 
card ...

--Alex







robertosfield wrote:
 Hi Alex,
 
 Which version of the OSG are you using?  Just prior to the OSG-3.0
 release I checked in code that aligned arrays within a buffer object
 to 4 byte boundaries, this was done to address problems in Intel
 drivers.
 
 Robert.
 
 On Wed, Sep 14, 2011 at 1:35 PM, Alexander Irion  wrote:
 
  Hello,
  
  I have a quiet weird problem with Intel Core i5 integrated graphics under 
  Ubuntu:
  
  When I have an element buffer object, that consists of an byte index array, 
  followed by an ushort index array, wrong triangles will be rendered. (See 
  wrong_rendering.png, compared to right_rendering.png).
  
  The attached osgt model file consists of two GL_TRIANGLES draw calls, that 
  use the same buffer object for indices.
  
  DrawElementsUByte::draw size:300 offset: 0
  DrawElementsUShort::draw size:861 offset: 300
  
  I modified the code to draw only once of them - either the ubyte array or 
  the ushort array and in both cases the right triangles are rendered, 
  whereas rendering fails, when both draw calls are made.
  
  It looks like the driver interprets the ushort indices as byte indices, 
  that would explain the fan looking triangles, that are drawn. The high byte 
  (0) of an ushort index would then often be taken as vertex 0 for one of the 
  three triangle vertices, so their would be many wrong triangles starting 
  from vertex 0 to some other vertices - exactly, as it looks in the attached 
  screen shot of the wrong rendering.
  
  The same model looks good on a system with Nvidia graphics, it also works 
  on the Intel GPU, when the arrays reside in different buffer objects, or 
  when element buffer objects are not used for the vertex indices.
  
  From the application side, everything looks good inside osg, so I think 
  this is a driver bug.
  
  Does anyone who also has integrated Intel grahics under linux can confirm 
  this bug?
  (To verify, just start the osgviewerapp with the attached model file).
  
  Would that samething for the Mesa guys to look at?
  
  Regards,
  --Alex
  
  
  My spec:
  
  Ubuntu 11.04
  
  OpenGL vendor string: Tungsten Graphics, Inc
  OpenGL renderer string: Mesa DRI Intel(R) Ironlake Desktop GEM 20100330 
  DEVELOPMENT x86/MMX/SSE2
  OpenGL version string: 2.1 Mesa 7.10.2
  OpenGL shading language version string: 1.20
  
  VGA compatible controller:
              product: Core Processor Integrated Graphics Controller
              vendor: Intel Corporation
              physical id: 2
              bus info: pci@:00:02.0
              version: 02
              width: 64 bits
              clock: 33MHz
              capabilities: msi pm vga_controller bus_master cap_list rom
              configuration: driver=i915 latency=0
              resources: irq:42 memory:f000-f03f 
  memory:e000-efff ioport:1170(size=8)
  
  CPU:
           product: Intel(R) Core(TM) i5 CPU         660  @ 3.33GHz
           vendor: Intel Corp.
           physical id: 5
           bus info: cpu@0
           version: 6.5.5
           serial: 0002-0655----
           slot: XU1 PROCESSOR
           size: 1199MHz
           capacity: 1199MHz
           width: 64 bits
           clock: 133MHz
           capabilities: x86-64 boot fpu fpu_exception wp vme de pse tsc msr 
  pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr 
  sse sse2 ss ht tm pbe nx rdtscp constant_tsc arch_perfmon pebs bts 
  xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx 
  smx 

Re: [osg-users] [vpb] Placing an object on a UTM file generated with osgdem

2011-09-14 Thread Chris 'Xenon' Hanson
  Looks about right to me. Try it and see if it works for you.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Placing an object on a UTM file generated with osgdem

2011-09-14 Thread Chris 'Xenon' Hanson
On 9/14/2011 7:55 AM, Ethan Fahy wrote:
 To answer my own question, yes, the code snippet that I posted does work and 
 allows me to attach an object to the terrain using lat lon elevation.  The 
 next step is to be able to place an object on the terrain by only giving it a 
 lat lot and having it figure out the elevation automatically...

http://eckhart.stderr.org/doc/openscenegraph-doc/openscenegraph/classosgSim_1_1HeightAboveTerrain.html

  Use that to query the terrain elevation at a given location.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Deriving from osgParticle::Interpolator - abstract class trouble

2011-09-14 Thread Simon White
Hi guys,

I am having some trouble inheriting from osgParticle::Interpolator. I don't 
inherit from abstract classes often, so forgive me if i've missed something.

My class:

http://pastebin.com/4vy4Vqin

As far as I can tell, the only pure virtual function in Interpolator is the 
interpolator() function (going by this 
(http://aap.papnet.eu/osgALL/a01813_source.html) web page). As you can see, my 
class overrides this function and yet I still get the error about instantiating 
an abstract class when I try to make an object of it.

After a bit of googling, I found that the problem might have been that I wasn't 
making the overridden function const, but that didn't solve anything either.

Does anyone have any experience with this?

Thanks, Simon.

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





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


[osg-users] Floating Point Textures

2011-09-14 Thread Paul Leopard
I'm trying to use a float32 image for a texture in a plugin I have written. All 
goes well with the setup (the plugin exits without error) but upon rendering I 
get a seg fault. I initially wrote my code to load a BMP file for the texture 
to verify that there were no issues unrelated to the texture data source. Next 
I dumped my float32 2D array to a file and loaded it into ImageJ to verify that 
there were no issues with my intended texture data. I then replaced the BMP 
loading code with osg::Image::setImage(...) using the float32 2D array as the 
image data as follows:

Code:
   osg::Image* texImg = new osg::Image();
   const float32* pRadiance = frad.mData.get();
   const unsigned char* pData = reinterpret_castconst unsigned 
char*(pRadiance);
   unsigned char* pData1 = const_castunsigned char*(pData);
   
texImg-setImage(frad.mXWidth,frad.mYHeight,1,GL_LUMINANCE,GL_LUMINANCE,GL_FLOAT,pData1,osg::Image::NO_DELETE,1);

   osg::ref_ptrosg::Texture2D texture = new osg::Texture2D;
   texture-setDataVariance(osg::Object::DYNAMIC);
   texture-setImage(texImg);



Anyone see something here that would cause a seg fault?

Regards,
Paul

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





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


Re: [osg-users] Floating Point Textures

2011-09-14 Thread Paul Leopard
I used NO_DELETE since memory management of the array was handled outside of 
the image. When I copy the data to a new array and use USE_NEW_DELETE the seg 
fault goes away ... Is there a bug in the NO_DELETE option or am I missing 
something?

Thanks,
Paul

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





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


[osg-users] Loading .obj/.flt

2011-09-14 Thread Martin Haffner
Hi,

I have a .obj file which describes a car. I load this .obj with 
osgDB::readNodeFile(myFile.obj), do some operations and finally write the 
root node with osgDB::writeNodeFile(output.flt).

Now I noticed that the .obj Y and Z coordinates are swapped in the .flt file. 
Is there a way to prevent this swapping? Where does this swapping occur? During 
loading or saving?

Another question: Both readNodeFile() and writeNodeFile() have an optional 
options argument. Is there a documentation which options are available for .obj 
and .flt reader/writer?

Thank you!

Cheers,
Martin

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





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


Re: [osg-users] Loading .obj/.flt

2011-09-14 Thread Paul Martz

On 9/14/2011 10:11 AM, Martin Haffner wrote:

Hi,

I have a .obj file which describes a car. I load this .obj with 
osgDB::readNodeFile(myFile.obj), do some operations and finally write the root node 
with osgDB::writeNodeFile(output.flt).

Now I noticed that the .obj Y and Z coordinates are swapped in the .flt file. 
Is there a way to prevent this swapping? Where does this swapping occur? During 
loading or saving?

Another question: Both readNodeFile() and writeNodeFile() have an optional 
options argument. Is there a documentation which options are available for .obj 
and .flt reader/writer?


 osgconv --format obj
Plugin osgPlugins-2.8.5/osgdb_obj.dll
{
ReaderWriter : Wavefront OBJ Reader
{
extensions : .objAlias Wavefront OBJ format
options: AMBIENT=unit  Set texture unit for ambient 
texture
options: BUMP=unit Set texture unit for bumpmap 
texture
options: DIFFUSE=unit  Set texture unit for diffuse 
texture
options: DISPLACEMENT=unit Set texture unit for 
displacement texture
options: OPACITY=unit  Set texture unit for 
opacity/dissolve texture
options: REFLECTION=unit   Set texture unit for 
reflection texture
options: SPECULAR=unit Set texture unit for specular 
texture
options: SPECULAR_EXPONENT=unitSet texture unit for specular 
exponent texture
options: noRotation  Do not do the default rotate 
about X axis
options: noTesselateLargePolygonsDo not do the default 
tesselation of large polygons
options: noTriStripPolygons  Do not do the default tri 
stripping of polygons

}
}


Apparently you should put noRotation in the option string when you load the 
.obj file. (I'm not sure why doing the rotation is the default behavior; it 
seems odd to me that the plugin loader is making assumptions about the 
orientation of the application's world coordinate system.)

   -Paul


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


Re: [osg-users] Deriving from osgParticle::Interpolator - abstract class trouble

2011-09-14 Thread Tony Horrobin
Hi Simon,

As far as I can tell, the definition of class Interpolator is missing a call of 
the META_Object macro.  The Object class declares additional abstract methods 
that you need to override too.

This is against osg-3.0.1 vc9.

Could you try the following:

#include  osgParticle/Interpolator 

// Derp = Decelerate Interpolation
// Lerp = Linear Interpolation
class Derp : public osgParticle::Interpolator
{
public:
Derp() : osgParticle::Interpolator() {}

Derp(const Interpolator copy, const osg::CopyOp copyop = 
osg::CopyOp::SHALLOW_COPY)
: osgParticle::Interpolator(copy, copyop) {}

~Derp() { }

META_Object(test,Derp)

float Lerp(float t, float y1, float y2) const
{
float temp = y2 - y1;
temp *= t;
return y1 + temp;
}

virtual float interpolate(float t, float y1, float y2) const
{
float temp = 1-t;
temp = temp * temp;
return Lerp(1-temp, y1, y2);
}
};

int main()
{
Derp * derp = new Derp();

return 0;
}


Cheers,

-Tony

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





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


[osg-users] OSG static linking for commercial application

2011-09-14 Thread Aurelien Albert
Hi,

This is a question about legal statement, not technical.

I'm working on a commercial project based on OSG.

I made a dynamic library 3dstuff.dll with all my 3D stuff, this DLL uses OSG.

Can I use static linking of OSG with my 3dstuff.dll to distribute only this 
DLL with my executable file ?

Or is it an OSG license violation and I have to distribute OSG as a set of 
dynamic librairies ? (osg.dll, osgGA.dll, osgXX.dll )

I ask this question here because I found this :

The OpenSceneGraph Public License is designed to be compatible with use of 
proprietary applications, such applications can statically and dynamically link 
to the OpenSceneGraph and can be redistributed with the libraries free of 
charge. Your applications can be distributed under any license, be it open 
source or proprietary.

at http://www.openscenegraph.org/projects/osg/wiki/Legal

which seems to say ok, you can do that

But in the complete license text, here : 
http://www.openscenegraph.org/projects/osg/attachment/wiki/Legal/LICENSE.txt I 
didn't find anything about static linking.

Thanks.

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





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


Re: [osg-users] ScreenCaptureHandler

2011-09-14 Thread Robert Osfield
Hi Paul,

On Wed, Sep 14, 2011 at 2:26 PM, Paul Palumbo paul1...@yahoo.com wrote:
 Can the osgViewer::ScreenCaptureHandler be configured to (render to and) 
 capture an Intensity-Alpha 32-bit floating point image?

 Also, what output file formats in OSG support support 32-bit floating point 
 output values?

I really don't know whether it's possible, your the first to ask about
such usage so right on the bleeding edge of OSG usage ;-)

To support rendering to a 32bit floating point alpha channel you'll
need to create a RGBA floating point colour buffer, copy the whole
buffer to an osg::Image then pull on the alpha channel from this.
Whether you can create a 32bit floating point colour buffer will be
down to whether your driver and hardware can support it.

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


Re: [osg-users] Intel Core i5, Ubuntu: Bug with element buffer object with both byte und ushort indices !!

2011-09-14 Thread Robert Osfield
Hi Alex,

Oh well... sounds very much like a driver bug then.

Perhaps the best thing you could do is pre-process your scene graphs
so that they only contain a single DrawElementsUShort() rather than
multiple separate primitive sets.

Robert.

On Wed, Sep 14, 2011 at 2:59 PM, Alexander Irion alexander.ir...@xse.de wrote:
 Helllo Robert,

 we use OSG-3.0 and this time its not the alignment problem, that we had on 
 the Intel EMGD before.

 The offset of the ushort array is 300 - so it is already dividable by 4, I 
 also already tested with some other alignment values.

 With my tests, I verified that the content of the element buffer is valid for 
 both draw calls, and if I have only one of the draw calls, the right 
 triangles are rendered - it only fails, when both glDrawElements are called.

 I hacked in two lines in the DrawElementsUByte::draw() method for testing.

 So, this fails with rendering garbage triangles:

 glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
 glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);

 but this:

 glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
 //glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);

 or this:

 //glDrawElements(GL_TRIANGLES, 300, GL_UNSIGNED_BYTE, 0);
 glDrawElements(GL_TRIANGLES, 861, GL_UNSIGNED_SHORT, 300);


 works well and draws the right triangles of either the indices 0-299 or 
 300-1160. (Nothing else in the program is changed, so buffer contents is the 
 same for all three test cases.)

 When each glDrawElements() is doing right, calling both glDrawElements() in 
 direct sequence would be expected to do also right and to show the sum of 
 each render calls, which it is not doing.

 So, in the meantime I will kick out the Intel graphics and go for a new 
 Nvidia card ...

 --Alex







 robertosfield wrote:
 Hi Alex,

 Which version of the OSG are you using?  Just prior to the OSG-3.0
 release I checked in code that aligned arrays within a buffer object
 to 4 byte boundaries, this was done to address problems in Intel
 drivers.

 Robert.

 On Wed, Sep 14, 2011 at 1:35 PM, Alexander Irion  wrote:

  Hello,
 
  I have a quiet weird problem with Intel Core i5 integrated graphics under 
  Ubuntu:
 
  When I have an element buffer object, that consists of an byte index 
  array, followed by an ushort index array, wrong triangles will be 
  rendered. (See wrong_rendering.png, compared to right_rendering.png).
 
  The attached osgt model file consists of two GL_TRIANGLES draw calls, that 
  use the same buffer object for indices.
 
  DrawElementsUByte::draw size:300 offset: 0
  DrawElementsUShort::draw size:861 offset: 300
 
  I modified the code to draw only once of them - either the ubyte array or 
  the ushort array and in both cases the right triangles are rendered, 
  whereas rendering fails, when both draw calls are made.
 
  It looks like the driver interprets the ushort indices as byte indices, 
  that would explain the fan looking triangles, that are drawn. The high 
  byte (0) of an ushort index would then often be taken as vertex 0 for one 
  of the three triangle vertices, so their would be many wrong triangles 
  starting from vertex 0 to some other vertices - exactly, as it looks in 
  the attached screen shot of the wrong rendering.
 
  The same model looks good on a system with Nvidia graphics, it also works 
  on the Intel GPU, when the arrays reside in different buffer objects, or 
  when element buffer objects are not used for the vertex indices.
 
  From the application side, everything looks good inside osg, so I think 
  this is a driver bug.
 
  Does anyone who also has integrated Intel grahics under linux can confirm 
  this bug?
  (To verify, just start the osgviewerapp with the attached model file).
 
  Would that samething for the Mesa guys to look at?
 
  Regards,
  --Alex
 
 
  My spec:
 
  Ubuntu 11.04
 
  OpenGL vendor string: Tungsten Graphics, Inc
  OpenGL renderer string: Mesa DRI Intel(R) Ironlake Desktop GEM 20100330 
  DEVELOPMENT x86/MMX/SSE2
  OpenGL version string: 2.1 Mesa 7.10.2
  OpenGL shading language version string: 1.20
 
  VGA compatible controller:
              product: Core Processor Integrated Graphics Controller
              vendor: Intel Corporation
              physical id: 2
              bus info: pci@:00:02.0
              version: 02
              width: 64 bits
              clock: 33MHz
              capabilities: msi pm vga_controller bus_master cap_list rom
              configuration: driver=i915 latency=0
              resources: irq:42 memory:f000-f03f 
  memory:e000-efff ioport:1170(size=8)
 
  CPU:
           product: Intel(R) Core(TM) i5 CPU         660  @ 3.33GHz
           vendor: Intel Corp.
           physical id: 5
           bus info: cpu@0
           version: 6.5.5
           serial: 0002-0655----
           slot: XU1 PROCESSOR
           size: 1199MHz
           capacity: 1199MHz
           width: 64 bits
    

Re: [osg-users] OSG static linking for commercial application

2011-09-14 Thread Robert Osfield
Hi Albert,

You can statically link the OSG libraries as they are all OSGPL based,
a license which exists solely to enalbe you to embed or staically like
OSG.  Some of the plugins aren't OSGPL based so you'll need to take
care with those, most are OSGPL though.

Robert.

On Wed, Sep 14, 2011 at 6:36 PM, Aurelien Albert
aurelien.alb...@alyotech.fr wrote:
 Hi,

 This is a question about legal statement, not technical.

 I'm working on a commercial project based on OSG.

 I made a dynamic library 3dstuff.dll with all my 3D stuff, this DLL uses 
 OSG.

 Can I use static linking of OSG with my 3dstuff.dll to distribute only this 
 DLL with my executable file ?

 Or is it an OSG license violation and I have to distribute OSG as a set of 
 dynamic librairies ? (osg.dll, osgGA.dll, osgXX.dll )

 I ask this question here because I found this :

 The OpenSceneGraph Public License is designed to be compatible with use of 
 proprietary applications, such applications can statically and dynamically 
 link to the OpenSceneGraph and can be redistributed with the libraries free 
 of charge. Your applications can be distributed under any license, be it open 
 source or proprietary.

 at http://www.openscenegraph.org/projects/osg/wiki/Legal

 which seems to say ok, you can do that

 But in the complete license text, here : 
 http://www.openscenegraph.org/projects/osg/attachment/wiki/Legal/LICENSE.txt 
 I didn't find anything about static linking.

 Thanks.

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





 ___
 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] OSG static linking for commercial application

2011-09-14 Thread Jason Daly

On 09/14/2011 01:36 PM, Aurelien Albert wrote:

Hi,

This is a question about legal statement, not technical.

I'm working on a commercial project based on OSG.

I made a dynamic library 3dstuff.dll with all my 3D stuff, this DLL uses OSG.

Can I use static linking of OSG with my 3dstuff.dll to distribute only this 
DLL with my executable file ?

Or is it an OSG license violation and I have to distribute OSG as a set of 
dynamic librairies ? (osg.dll, osgGA.dll, osgXX.dll )

I ask this question here because I found this :

The OpenSceneGraph Public License is designed to be compatible with use of 
proprietary applications, such applications can statically and dynamically link to the 
OpenSceneGraph and can be redistributed with the libraries free of charge. Your 
applications can be distributed under any license, be it open source or proprietary.

at http://www.openscenegraph.org/projects/osg/wiki/Legal

which seems to say ok, you can do that

But in the complete license text, here : 
http://www.openscenegraph.org/projects/osg/attachment/wiki/Legal/LICENSE.txt I 
didn't find anything about static linking.


The relevant text is in the wxWindows exception #2 near the top:

   2. The exception is that you may use, copy, link, modify and
   distribute under the user's own terms, binary object code versions
   of works based on the Library.


Meaning that you are not required to distribute your own source code 
when you link it against OSG (either statically or dynamically).


This is provided that you don't copy any code into OpenSceneGraph or 
your own code that is licensed as LGPL or GPL-only (as stated in 
exception #3).


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


Re: [osg-users] [vpb] Compiling VPB/GDAL on Win7 with VS2010

2011-09-14 Thread Jonathan Klein
Well thanks. I thought that I need a debug build of VPB because I just hat OSGB 
Debug binaries in use. But than i realized, that i just need vpb to create the 
files and don't want to debug anything there, so i made a release build, where 
i had at first the same linker error as you, but thanks to that thread i could 
fix it.

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





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


Re: [osg-users] Two Cameras, Two Render Targets?

2011-09-14 Thread He, Yefei
Hi, Robert,

Thanks for the reaffirmation. I finally figured out what happened with my 
application. It loads an OpenFlight model as the main scene, in which two faces 
will use textures rendered by cameras. The two faces originally use an 
identical dummy texture as place holder. It turned out that the osg optimizer 
merged the second face with the first one into a single drawable. So when the 
first face's texture was replaced, so was the second, with the same texture. 
The debug print out actually reported this, but I saw both faces' textures were 
replaced and assumed they were independently replaced with different ones. 
After changing the model so that the two faces used different dummy textures, 
the osg optimizer stopping combining the two faces into the same drawable, and 
I was able to see two different textures on the model.

Regards,

Yefei   

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: Wednesday, September 14, 2011 3:16 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Two Cameras, Two Render Targets?

Hi Yefei,

The OSG supports multiple render to texture Cameras seamlessly, it should 
simply be a case of creating the Camera's and adding the textures and 
appropriate subgraphs to them and then using these textures.  The only twist 
would be that if you are using Viewer slave Camera then you'll need to make 
sure that these slaves don't inherit the main scene graph as is the default 
behavior of slave Camera.  A render to texture Camera in the scene graph 
doesn't inherit any subgraph so it'll just use what subgraph you assign to it.

Robert.

On Wed, Sep 14, 2011 at 1:01 AM, He, Yefei yefei...@uiowa.edu wrote:
 Hello, Folks,



 I’m working on an OSG application that requires two cameras rendering 
 two different subscenes into textures, and apply the two textures to 
 different geometries in the main scene.  I started out with the 
 osgprerender example by creating two cameras and attaching them to two 
 different textures. But the result was the two textures were 
 identical, and the content was that from the first camera. I saw that 
 Anthousis Andreadis reported a similar problem in April and later 
 submitted a fix. My version of OSG does contain that fix. I looked 
 into osgstereomatch and osgmultiplerendertargets, but I figured they 
 are a bit different from my application. In those applications, a 
 single camera is attached to multiple textures; in my case, two 
 cameras are attached to two different textures. What do I need to do to make 
 my application work? Are there any examples that I can look at?



 Thanks,



 Yefei

 ___
 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] QT WIdget

2011-09-14 Thread Jonathan Klein
Hi,

i'm writing a Qt Application, that should display a OSG Scene inside a widget. 
I found some sample code and tried to use it as an Widget:

http://pastebin.com/VJ45jUUN

I have a ui-File to define the rest of the gui. Now i try to add my OsgWidget:

Code:

QtGui::QtGui(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
ViewerQOSG *osgView=new ViewerQOSG(ui.centralWidget);
osgView-setSceneData(GetRootNode());

ui.MainLayout-addWidget(osgView);
ui.MainLayout-addWidget(new QPushButton(bin knopf, 
ui.centralWidget));//
}



My problem is: The widget flickers and disappears sometimes. This happens when 
I resize the window or if i rotate the scene with the mouse.

I don't really understand everything from the code, i copied the most from the 
sample. Any hints what i'm doing wrong?

Thank you!

Cheers,
Jonathan

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





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


Re: [osg-users] [osgOcean] Culling and intersects with ocean and model...

2011-09-14 Thread Michael Guerrero
Hi,

I have a decent solution to this problem that doesn't require modifications to 
the shader and can work with any number of ships in the scene.  The stencil 
buffer can be set up to mark the fragments on the inside of the boat as 
ineligible for rendering upon by the ocean.  Then when the ocean renders, it 
can fail the stencil test and not draw on those areas.  My process for this is:

1) Export the geometry in separate subgraphs so that all exterior boat geometry 
is under one branch and all interior geometry is under another.

2) Load the file and find interior and exterior graph root nodes.

3) Apply a stencil to the interior to always mark that fragment with an ID like 
this:


Code:
// The inner stencil should mark it
osg::Stencil* innerStencil = new osg::Stencil;
innerStencil-setFunction(osg::Stencil::ALWAYS);
innerStencil-setFunctionRef(STENCIL_VALUE);
innerStencil-setStencilPassAndDepthPassOperation(osg::Stencil::REPLACE);

interiorGroupState-setAttributeAndModes(innerStencil, osg::StateAttribute::ON);



4) Apply a stencil to the exterior to always unmark anything that might've been 
marked by a previous draw of the interior that is underneath (depth-wise) like 
this:


Code:
// The outer stencil should un-mark it so that if part of this mesh
// draws on top of the mNodeToStencil, it doesn't count as 'marked'
osg::Stencil* outerStencil = new osg::Stencil;
outerStencil-setFunction(osg::Stencil::ALWAYS);
outerStencil-setFunctionRef(0);
outerStencil-setStencilPassAndDepthPassOperation(osg::Stencil::REPLACE);

exteriorGroupState-setAttributeAndModes(outerStencil, osg::StateAttribute::ON);



5) Apply a stencil to the ocean geometry so that it tests to see if each 
fragment has already been drawn on with an interior boat pixel and if so, it 
fails the stencil test and doesn't draw like this:


Code:
// Tell the ocean tiles that they should not render on
// pixels that are occupied by surface vessels.
osg::Stencil* oceanStencil = new osg::Stencil;
oceanStencil-setFunction(osg::Stencil::NOTEQUAL);
oceanStencil-setFunctionRef(StencilActorComponent::STENCIL_VALUE);
oceanStencil-setStencilPassAndDepthPassOperation(osg::Stencil::KEEP);




6) Ensure that the ocean is drawn AFTER the boats so that the boats could have 
the stencil buffer already marked and the ocean can properly test before 
drawing.  I didn't have a great way to do this but this sufficed:


Code:
// This needs to be drawn after the surface vessels (this works, for now)
GetMatrixNode()-getOrCreateStateSet()-setRenderBinDetails(5, RenderBin);




The above worked wonderfully for me when I was just using a simple quad for my 
ocean and not using dtOcean.  However, after bring dtOcean into my application, 
either the stenciling no longer work or I'm not able to make the boats draw 
before the ocean using the method from above.

So all that said, my main questions are:

  How do I apply a stencil to my osgOcean::FFTOceanSurface?
  How do I control the render order of dtOcean?

Thank you!

Cheers,
Michael

PS Make sure you are using a stencil buffer or this won't work :P
I do this before creating my window:

Code:
osg::DisplaySettings* display = osg::DisplaySettings::instance();
display-setMinimumNumStencilBits(8);

[/code]

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





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


Re: [osg-users] OSG static linking for commercial application

2011-09-14 Thread Chris 'Xenon' Hanson
On 9/14/2011 12:08 PM, Jason Daly wrote:
 This is provided that you don't copy any code into OpenSceneGraph or your own 
 code that is
 licensed as LGPL or GPL-only (as stated in exception #3).

  This raises an old, but still relevant side issue.

  I imagine most people copy bits of working code from the examples into their
applications and then modify it. Technically, for a closed-source app this is a 
license
violation, but I believe that this is the very purpose the examples were 
intended for.

  Does there need to be a license amendment/exemption or something for the 
examples?

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Release builds with gcc-llvm on Mac (Xcode 4), cosf/sinf recursion

2011-09-14 Thread James Turner
I've encountered a problem with the osg/Math header, which a few previous 
emails on this list have alluded to (based on searching the recent archives), 
but which has an interesting explanation.

osg/Math defines the 'f' versions of cos/sin/floor/etc in terms of the double 
versions, on various platforms, including Mac. The implementation is an inline 
function, which casts the input argument, and calls the 'base' version from 
math.h

Unfortunately, LLVM (or the GCC frontend) is smart enough to turn the cast + 
call of the base version back into the floating point version - but the symbol 
look-up then resolves to the osg wrapper - and hence the problem we're seeing. 
Since osg/Math was created, OS-X does define the 'f' versions - but I'm not 
sure which version started doing so - the 10.6 SDK math.h includes the 'f' 
variants, but plain gcc 4.2 wasn't smart enough to turn the cast-to-double + 
call pattern into the float version.

The local workaround is simply to remove the __APPLE__ case around line 48 of 
osg/Math, but really it would be changed to a MAC_OS_X_VERSION_10_z, if someone 
can identify what value 'z' should have. If anyone still has a 10.5 SDK, they 
could check '/usr/include/architecture/i386/math.h' and see if the 'f' variants 
of the math functions are present. 

(What's the minimum version OSG claims to support at this time? 10.5 or still 
holding out with 10.4?)
(Potentially this affects iOS too, though I'm not sure if Apple have enabled 
gcc-llvm for ARM yet, by de default)

James

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


[osg-users] Fixed function pipeline in OSG 3.0.1

2011-09-14 Thread Pecoraro, Alexander N
In OSG version 3.0.1, if I don't explicitly attach a shader to my scene graph 
does it fall back on the fixed function pipeline or is a fixed function 
pipeline equivalent shader generated for it?

Thanks.

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


Re: [osg-users] Fixed function pipeline in OSG 3.0.1

2011-09-14 Thread Christiansen, Brad
Hi,

If you don't attach shaders then the fixed function pipeline is used, unless 
you are not using GLES2, in which case I think shaders are generated for you. I 
have never used this path so I am not sure though.

Cheers,

Brad

From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Pecoraro, 
Alexander N
Sent: Thursday, 15 September 2011 7:20 AM
To: OpenSceneGraph Users
Subject: [osg-users] Fixed function pipeline in OSG 3.0.1

In OSG version 3.0.1, if I don't explicitly attach a shader to my scene graph 
does it fall back on the fixed function pipeline or is a fixed function 
pipeline equivalent shader generated for it?

Thanks.

Alex


-
DISCLAIMER: This e-mail transmission and any documents, files and 
previous e-mail messages attached to it are private and confidential.  
They may contain proprietary or copyright material or information that 
is subject to legal professional privilege.  They are for the use of 
the intended recipient only.  Any unauthorised viewing, use, disclosure, 
copying, alteration, storage or distribution of, or reliance on, this 
message is strictly prohibited.  No part may be reproduced, adapted or 
transmitted without the written permission of the owner.  If you have 
received this transmission in error, or are not an authorised recipient, 
please immediately notify the sender by return email, delete this 
message and all copies from your e-mail system, and destroy any printed 
copies.  Receipt by anyone other than the intended recipient should not 
be deemed a waiver of any privilege or protection.  Thales Australia 
does not warrant or represent that this e-mail or any documents, files 
and previous e-mail messages attached are error or virus free.  

-

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


Re: [osg-users] help with osgVolume

2011-09-14 Thread Allen Wing
Hi Robert,
In my case, osgVolume cannot render CT dicom files correctly(they can be
rendered by other software).
Does that mean the dicom plugin cannot parse my dicom files?
Or it is because the dicom plugin uses ITK but not DCMTK? How can I know
whether the plugin use ITK or DCMTK, How can I switch between them?

Allen.

2011/9/14 Robert Osfield robert.osfi...@gmail.com

 Hi Allen,

 On Wed, Sep 14, 2011 at 10:12 AM, Allen Wing wanglinse...@gmail.com
 wrote:
  Hello there,
  This is my first post. I'm a college student recently working on a
 project
  dealing with volume rendering. I use osgVolume to render two series of
 dicom
  files. But only one of them with MR modality can be rendered correctly,
 the
  other with CT modality cannot. My questions are:
  1. how does osgvolume parse dicom image? using osg::ImageSequence or
 other
  external libraries?

 Dicom images are read using the DCMTK based dicom plugin found at
 OpenSceneGraph/src/osgPlugins/dicom.  There is a fallback in this
 plugin that uses ITK but it doesn't handle the range of dicom images
 as well as DCMTK can.

  2. since in my case osgVolume cannot render CT modality dicom files
  correctly, I think osgVolume cannot parse them correctly. So what
 parameters
  I need to extract from dicom file in order to correctly render dicom
 files?
  Slice thickness, spacing between slice or z axis?

 When you read dicom files using the dicom plugin you should pass the
 directory name that contains the dicom files and it'll load them all,
 place them into a single osg::Image and set the dimensions correct so
 that osgVolume can set up the location of the volume brick properly.

  3.I tried to read osgVolume source code. But it contains too few comments
 to
  understand. So can anyone provide some documentation, user manual or any
  advices?

 There isn't a manual I can point you at I'm afraid.

 Robert.
 ___
 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] [build] Android OSG display problem

2011-09-14 Thread Jayce Li
Hi,Rafa

I rebuild OSG for android using GLES2 and the problem still exist


Thank you!

Cheers,
Jayce

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





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


Re: [osg-users] [build] Android OSG build problem

2011-09-14 Thread Jayce Li
Hi, everyone

Problem has been solved.
Turns out that the files under \obj\local are exactly what I need for building 
an android application. It's the lib folder I need to link to when compiling 
native code under \jni folder in my own android application. The osg lib path 
is configured by OSG_ANDROID_DIR in Android.mk.


Thank you!

Cheers,
Jayce

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





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