Re: [osg-users] ATI FirePro M8900

2011-07-15 Thread J.P. Delport

Hi,

for posterity and the future frustrated, here is what had to be done 
make the FirePro believe it can do OpenGL.


Specs again:
Dell Precision M6600
AMD (ATI) FirePro M8900 (FireGL) Mobility Pro Graphics
Driver version: 2011/05/31 8.851.0.0
Windows 7 64-bit

Grep the OSG source code for Radeon and everywhere add FirePro for 
the existing workarounds. They have the same Pro-ness.


Short circuit State::computeVertexBufferObjectSupported() to return 
false no matter what.


Make the databasepager use display lists:
pager-setDrawablePolicy(osgDB::DatabasePager::USE_DISPLAY_LISTS);

After all this, OSG at least does not crash, but an annoying +-1s pause 
was occurring every now and then. This appears to be happening in other 
OpenGL apps too.


To get rid of the pauses we had to disable all eye-candy on Windows 7, 
i.e. switch to the classic theme.


I've now wasted enough time on this.

If you got this far, let it be a reminder to spend a bit more and get 
the NVidia GeForce/Quadro next time.


jp

PS. Wish I could find an AMD support email address to copy this too, but 
they're hiding behind web forms with lots of required fields. Bah.


On 12/07/2011 08:35, J.P. Delport wrote:

Hi Luc,

thanks for the feedback. I'm going to try disable VBO wherever possible
and see what happens. I'll probably have to make a visitor for all other
loaded objects or somehow convince OSG that the ATI does not support VBO.

I've been spared the ATI madness till now, so I'll check the list for
older VBO workarounds too.

It's sad that ATI/AMD misuses their advantage of being the underdog [1]
to keep churning out crap OpenGL support.

jp

[1] People like competition and always seem to give ATI/AMD another
chance, only to be disappointed again.

On 11/07/11 17:51, Luc Frauciel wrote:

I work on a Dell M6400 with a FirePro M7740 on Windows 7 64-bit.
Same issue.
Hours of installation/desinstallation of different drivers did nothing.

The only workaround I've found is to disable VBO :
pager-setDrawablePolicy(osgDB::DatabasePager::USE_DISPLAY_LISTS);
There is also an Env setting to do that I think.

It put an end to Geometric nightmare and random crashes.


I really don't know what's pro in Ati FirePro...

Luc



De : J.P. Delport jpdelp...@csir.co.za
A : osg users osg-users@lists.openscenegraph.org
Date: 07/11/2011 05:18 PM
Objet : [osg-users] ATI FirePro M8900
Envoyé par : osg-users-boun...@lists.openscenegraph.org






Hi all,

we've got users with shiny new Dell Precision M6600 laptops with the
FirePro M8900 ATI chips on Windows 7 64-bit. Terrain databases that work
perfectly well almost everywhere produce artistic but not quite pleasing
results in osgviewer, see attached.

Any ideas on how to work around ATI's OpenGL uselessness? We've already
suggested buying NVidia cards :/

Help on installing other driver versions, other than those blessed by
Dell with AMD shrugging their shoulders [1], would also be welcome.

cheers
jp

[1]
http://support.amd.com/us/kbarticles/Pages/737-28041SupportforATIMobility.aspx


--
This message is subject to the CSIR's copyright terms and conditions,
e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by
MailScanner,
and is believed to be clean.

[pièce jointe ati-junk.jpg supprimée par Luc Frauciel/STAR-APIC]
___
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




--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


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


[osg-users] Getting RGB-values out of frame

2011-07-15 Thread Diana Kittelmann
Hi,

I'm implementing a lidar scanner simulator ins osg and got kind oft stucked.

I'm loading a world from file as my scene and let my sensor fly through the 
world, everything works fine. From a 3d Party I got a Vertex- and Fragment 
Shader to calculate the actual view of the lidar scanner.

In other words what I get right now is an image with colored Pixel
-the color of a pixel tells me the distance between the sensor and point of 
object hit by the laser ray
-the image doesent have any depth informations
-when I get the distance-values I have to send them vie ethernet (not relevant 
here cause already implemennted) so waht I need as result ist a vector of 
long-values including the length of the laser rays

And now I don't know how I can get the distance or better I don't know how I 
can get the RGB-Values of the Pixel in the image.  (notice that image doesen't 
mean I get an Image-object but the actual picture shown in the View)

I tried to realize it via osg::Image:

Code:

osg::Image* buffer = new osg::Image;

...

void getBuffer()
{
buffer-readPixels(0,0,200,200,GL_RGB,GL_FLOAT);
float* bufferRaw;
bufferRaw = (float*) buffer-data();

...
}





With this I just get a wrong value (something undefined like -4.3160208e+008)

I have no idea if I am on the right way or totally wrong. I'm just new to OSG. 
So can anyone give me a tip what I should try or for what to search ...

I'm using OSG 2.8.1, have one View and one Camera (the one the view got by 
default) and I'm using a kind of complex class hierarchie (ie: I have a 
cameraView-clas which realizes the view, and I have a lidarView-class which 
realizes the lidar stuff and calls the shaders and which inherits from the 
cameraView). 

Thank you!

Cheers,
Diana

PS: 
The worst ist that it hast to be very fast. I have to write a real-time lidar 
scanner simulation.[/code]

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





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


Re: [osg-users] Getting RGB-values out of frame

2011-07-15 Thread J.P. Delport

Hi,

On 15/07/2011 11:14, Diana Kittelmann wrote:

Hi,

I'm implementing a lidar scanner simulator ins osg and got kind oft
stucked.

I'm loading a world from file as my scene and let my sensor fly
through the world, everything works fine. From a 3d Party I got a
Vertex- and Fragment Shader to calculate the actual view of the lidar
scanner.

In other words what I get right now is an image with colored Pixel
-the color of a pixel tells me the distance between the sensor and
point of object hit by the laser ray -the image doesent have any
depth informations -when I get the distance-values I have to send
them vie ethernet (not relevant here cause already implemennted) so
waht I need as result ist a vector of long-values including the
length of the laser rays

And now I don't know how I can get the distance or better I don't
know how I can get the RGB-Values of the Pixel in the image.  (notice
that image doesen't mean I get an Image-object but the actual picture
shown in the View)

I tried to realize it via osg::Image:

Code:

osg::Image* buffer = new osg::Image;

...

void getBuffer() { buffer-readPixels(0,0,200,200,GL_RGB,GL_FLOAT);
float* bufferRaw; bufferRaw = (float*) buffer-data();

... }



you have the right idea with readpixels, but you must make sure that the 
readpixels is happening after the camera has drawn so that the context 
where the data lives is still active. Stick it into a drawcallback. See 
the osgscreencapture example for inspiration. It also shows the other 
methods of reading data back to the CPU.







With this I just get a wrong value (something undefined like
-4.3160208e+008)

I have no idea if I am on the right way or totally wrong. I'm just
new to OSG. So can anyone give me a tip what I should try or for what
to search ...

I'm using OSG 2.8.1, have one View and one Camera (the one the view
got by default) and I'm using a kind of complex class hierarchie (ie:
I have a cameraView-clas which realizes the view, and I have a
lidarView-class which realizes the lidar stuff and calls the shaders
and which inherits from the cameraView).

Thank you!

Cheers, Diana

PS: The worst ist that it hast to be very fast. I have to write a
real-time lidar scanner simulation.[/code]


You'll probably be limited by the amount of data you can read back from 
the GPU to CPU. You'll have to test this on your setup and you can work 
out the required rate you'll need.


jp



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





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


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


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


[osg-users] stencil buffer and CSG Boolean operations

2011-07-15 Thread Craig Fletcher
Hi,
I am trying to use the stencil buffer to implement CSG Boolean operations.

As part of this I need to selectively render the front and back faces of the 
two objects in order to test depth and update the stencil buffer

What I would like to know is how can I enable face culling in OSG ? 
(I understand from the quick start guide that attaching an attribute to a 
stateset is only a desired state and doesn’t issue an OpenGL command, so it may 
not do it, the code stub below doesn’t seem to have any affect and the whole 
cylinder is rendered) 

osg::StateSet* state = myCylinderGeode-getOrCreateStateSet();
osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT);
state-setAttribute( cf );
 
The second question is how can I selectively render the first object (object a) 
modify the stencil and face culling then render the second object (object b)? 

Should I use a node mask on the cull traversal as mentioned in the node mask 
tutorial? (if so any pointers on how to do it would be great)

If anyone could help or point me in the right direction it would be greatly 
appreciated.  

The OpenGL code implementation is below.

The openGL  function is
firstInsideSecond(void (*a) (void), void (*b) (void), GLenum face, GLenum test)
{
  glEnable(GL_DEPTH_TEST);
  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
  glCullFace(face); /* controls which face of a to use */
  a();  /* draw a face of a into depth buffer */

  /* use stencil plane to find parts of a in b */
  glDepthMask(GL_FALSE);
  glEnable(GL_STENCIL_TEST);
  glStencilFunc(GL_ALWAYS, 0, 0);
  glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
  glCullFace(GL_BACK);
  b();  /* increment the stencil where the front face of b is 
   drawn */
  glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
  glCullFace(GL_FRONT);
  b();  /* decrement the stencil buffer where the back face
   of b is drawn */
  glDepthMask(GL_TRUE);
  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

  glStencilFunc(test, 0, 1);
  glDisable(GL_DEPTH_TEST);

  glCullFace(face);
  a();  /* draw the part of a that's in b */
}part of a that's in b */
The function call is
firstInsideSecond(a, b, GL_BACK, GL_NOTEQUAL);
with a and b being a box and a cylinder.


Thank you!

Cheers,
Craig

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





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


Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-15 Thread Rubén Díaz
Hi,

Thanks a lot for your reply.
I tried with the changes that you suggested and still didn't work using the 
graphic frontend for cmake.


Using the console, everything fine. 
(I used r6, and got osg from trunk).

Thanks again!

Cheers,
ruben

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





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


[osg-users] Update-Draw frame numbering coherence

2011-07-15 Thread Javier Taibo
  Hi all,

  I have an application where I request from the update thread some
operations that must be performed in a draw callback. The operations
must be performed in the draw of the same thread they were requested
from.

  I tried to check the frame from the draw callback, using
renderInfo.getState()-getFrameStamp()-getFrameNumber(). The problem
I found is that this frame number is the one of the frame currently
being processed in the UPDATE frame., as it is a reference to the
FrameStamp structure of the viewer.

  The solution I have applied is a change in the file
src/osgUtil/SceneView.cpp, method SceneView::cull, in the line 753,
replacing

state-setFrameStamp(_frameStamp.get());

  with

state-setFrameStamp( new osg::FrameStamp(*_frameStamp) );

  This way, instead of storing a pointer to the global FrameStamp in
the renderInfo structure, I build a copy of the FrameStamp object, so
the draw stage keep this information intact and is not overwritten by
the next frame in the update thread.

  I don't know if there is a better solution to this problem. Anyway,
I think that in the renderInfo argument of a draw callback it would be
nice to have the FrameStamp of the frame to which this callback
belongs.


  Thoughts? Anybody else has faced problems with frame numbering in
draw callbacks?


  Regards,

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


Re: [osg-users] [build] problem compiling osg 3.0.0 for Android

2011-07-15 Thread Jorge Izquierdo Ciges
Cheers for you! I didn't knew r6 was out... oh hell I'll have to add it to
the auto detection system :)

Have fun with Osg and Android.

2011/7/15 Rubén Díaz ruw...@hotmail.com

 Hi,

 Thanks a lot for your reply.
 I tried with the changes that you suggested and still didn't work using the
 graphic frontend for cmake.


 Using the console, everything fine.
 (I used r6, and got osg from trunk).

 Thanks again!

 Cheers,
 ruben

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





 ___
 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] stencil buffer and CSG Boolean operations

2011-07-15 Thread Sergey Kurdakov
Hi Craig,

while I do not respond to your question directly, but concerning real time
CSG booleans I'd suggest to look at papers


http://www.hpi.uni-potsdam.de/fileadmin/hpi/FG_Doellner/publications/2008/TD08a/VolumetricTest.pdf
http://www.hpi.uni-potsdam.de/fileadmin/hpi/FG_Doellner/publications/2008/TD08a/matthias_trapp_volumetric_tests_EG2008_poster.pdf
http://www.hpi.uni-potsdam.de/fileadmin/hpi/FG_Doellner/publications/2008/TD08b/132-Trapp-Efficient-LDI-Representation.pdf



see also http://www.opencsg.org/
and 
http://arxiv.org/ftp/arxiv/papers/1009/1009.0794.http://arxiv.org/ftp/arxiv/papers/1009/1009.0794.pdf
pdf http://arxiv.org/ftp/arxiv/papers/1009/1009.0794.pdf
http://www2.mae.cuhk.edu.hk/~http://www2.mae.cuhk.edu.hk/~cwang/pubs/TVCGMeshBoolean.pdf
cwang/pubs/TVCGMeshBoolean.pdfhttp://www2.mae.cuhk.edu.hk/~cwang/pubs/TVCGMeshBoolean.pdf

Regards
Sergey
On Fri, Jul 15, 2011 at 2:15 PM, Craig Fletcher c...@hw.ac.uk wrote:

 Hi,
 I am trying to use the stencil buffer to implement CSG Boolean operations.

 As part of this I need to selectively render the front and back faces of
 the two objects in order to test depth and update the stencil buffer

 What I would like to know is how can I enable face culling in OSG ?
 (I understand from the quick start guide that attaching an attribute to a
 stateset is only a desired state and doesn’t issue an OpenGL command, so it
 may not do it, the code stub below doesn’t seem to have any affect and the
 whole cylinder is rendered)

 osg::StateSet* state = myCylinderGeode-getOrCreateStateSet();
 osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT);
 state-setAttribute( cf );

 The second question is how can I selectively render the first object
 (object a) modify the stencil and face culling then render the second object
 (object b)?

 Should I use a node mask on the cull traversal as mentioned in the node
 mask tutorial? (if so any pointers on how to do it would be great)

 If anyone could help or point me in the right direction it would be greatly
 appreciated.

 The OpenGL code implementation is below.

 The openGL  function is
 firstInsideSecond(void (*a) (void), void (*b) (void), GLenum face, GLenum
 test)
 {
  glEnable(GL_DEPTH_TEST);
  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
  glCullFace(face); /* controls which face of a to use */
  a();  /* draw a face of a into depth buffer */

  /* use stencil plane to find parts of a in b */
  glDepthMask(GL_FALSE);
  glEnable(GL_STENCIL_TEST);
  glStencilFunc(GL_ALWAYS, 0, 0);
  glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
  glCullFace(GL_BACK);
  b();  /* increment the stencil where the front face of b
 is
   drawn */
  glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
  glCullFace(GL_FRONT);
  b();  /* decrement the stencil buffer where the back face
   of b is drawn */
  glDepthMask(GL_TRUE);
  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

  glStencilFunc(test, 0, 1);
  glDisable(GL_DEPTH_TEST);

  glCullFace(face);
  a();  /* draw the part of a that's in b */
 }part of a that's in b */
 The function call is
 firstInsideSecond(a, b, GL_BACK, GL_NOTEQUAL);
 with a and b being a box and a cylinder.


 Thank you!

 Cheers,
 Craig

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





 ___
 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] stencil buffer and CSG Boolean operations

2011-07-15 Thread Chris 'Xenon' Hanson
On 7/15/2011 4:15 AM, Craig Fletcher wrote:
 What I would like to know is how can I enable face culling in OSG ? 
 (I understand from the quick start guide that attaching an attribute to a 
 stateset is only a desired state and doesn’t issue an OpenGL command, so it 
 may not do it, the code stub below doesn’t seem to have any affect and the 
 whole cylinder is rendered) 

  It should issue the GL command if that state isn't already in effect.

 osg::StateSet* state = myCylinderGeode-getOrCreateStateSet();
 osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT);
 state-setAttribute( cf );

  If you have to, you could always use a custom Draw callback on your drawable:
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00190.html#_details

  To force issuing the openGL commands you want before and after it is drawn.

 The second question is how can I selectively render the first object (object 
 a) modify the stencil and face culling then render the second object (object 
 b)? 
 Should I use a node mask on the cull traversal as mentioned in the node mask 
 tutorial? (if so any pointers on how to do it would be great)

  Seems like this would be a task for Render Bins?

-- 
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] stencil buffer and CSG Boolean operations

2011-07-15 Thread Craig Fletcher
Hi Sergey,

Thanks for that, i'll take a look at them



Cheers,
Craig

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





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


Re: [osg-users] osgQT Hello World

2011-07-15 Thread Vitor Silva
Thanks for the help, that seems a good example. I'm trying to compile the 
example, but don't works.

The error is :
 undefined reference to 
`_imp___ZN5osgQt16GraphicsWindowQtC1EPN3osg15GraphicsContext6TraitsEP7QWidgetPK9QGLWidget6QFlagsIN2Qt10WindowTypeEE

Exists and is necessary a libosgQT.dll or the osgQT includes are just 
header-only ? 

I'm using the libraries: 
-losg -losgwidget -losgviewer -losgdb -losgga

Thanks again,
Cheers,
Vitor

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





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


Re: [osg-users] osgQT Hello World

2011-07-15 Thread Wang Rui
Hi Vitor,

Of course you will need the osgQt library and headers as dependence.

Wang Rui


2011/7/15 Vitor Silva vmon...@gmail.com:
 Thanks for the help, that seems a good example. I'm trying to compile the 
 example, but don't works.

 The error is :
  undefined reference to 
 `_imp___ZN5osgQt16GraphicsWindowQtC1EPN3osg15GraphicsContext6TraitsEP7QWidgetPK9QGLWidget6QFlagsIN2Qt10WindowTypeEE

 Exists and is necessary a libosgQT.dll or the osgQT includes are just 
 header-only ?

 I'm using the libraries:
 -losg -losgwidget -losgviewer -losgdb -losgga

 Thanks again,
 Cheers,
 Vitor

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





 ___
 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] stencil buffer and CSG Boolean operations

2011-07-15 Thread Sergey Polischuk
Hi, Craig

About state part - setAttribute()  call by default set attribute off, you 
should call setAttribute(cf, osg::StateAttribute::ON) + setMode(GL_CULL_FACE, 
osg::StateAttribute::ON) or setAttributeAndModes(cf) which by default enables 
attribute.
Also to be able to use stencil you should request visual with stencil or if you 
use fbo camera you should attach packed depth stencil buffer to it. Dont forget 
to enable stencil test with setMode(GL_STENCIL_TEST, osg::StateAttribute::ON).

Cheers,
Sergey.

15.07.2011, 14:15, Craig Fletcher c...@hw.ac.uk:
 Hi,
 I am trying to use the stencil buffer to implement CSG Boolean operations.

 As part of this I need to selectively render the front and back faces of the 
 two objects in order to test depth and update the stencil buffer

 What I would like to know is how can I enable face culling in OSG ?
 (I understand from the quick start guide that attaching an attribute to a 
 stateset is only a desired state and doesn’t issue an OpenGL command, so it 
 may not do it, the code stub below doesn’t seem to have any affect and the 
 whole cylinder is rendered)

 osg::StateSet* state = myCylinderGeode-getOrCreateStateSet();
 osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT);
 state-setAttribute( cf );

 The second question is how can I selectively render the first object (object 
 a) modify the stencil and face culling then render the second object (object 
 b)?

 Should I use a node mask on the cull traversal as mentioned in the node mask 
 tutorial? (if so any pointers on how to do it would be great)

 If anyone could help or point me in the right direction it would be greatly 
 appreciated.

 The OpenGL code implementation is below.

 The openGL  function is
 firstInsideSecond(void (*a) (void), void (*b) (void), GLenum face, GLenum 
 test)
 {
   glEnable(GL_DEPTH_TEST);
   glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
   glCullFace(face); /* controls which face of a to use */
   a();  /* draw a face of a into depth buffer */

   /* use stencil plane to find parts of a in b */
   glDepthMask(GL_FALSE);
   glEnable(GL_STENCIL_TEST);
   glStencilFunc(GL_ALWAYS, 0, 0);
   glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
   glCullFace(GL_BACK);
   b();  /* increment the stencil where the front face of b is
    drawn */
   glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
   glCullFace(GL_FRONT);
   b();  /* decrement the stencil buffer where the back face
    of b is drawn */
   glDepthMask(GL_TRUE);
   glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

   glStencilFunc(test, 0, 1);
   glDisable(GL_DEPTH_TEST);

   glCullFace(face);
   a();  /* draw the part of a that's in b */
 }part of a that's in b */
 The function call is
 firstInsideSecond(a, b, GL_BACK, GL_NOTEQUAL);
 with a and b being a box and a cylinder.

 Thank you!

 Cheers,
 Craig

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

 ___
 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] ATI FirePro M8900

2011-07-15 Thread David Glenn
Greetings!

I have to admit that I've seen issues with laptops, but not like this!

I have a desktop at home with two Radon 5800 crossfired tougher and used my 
software on that without any problem, then take it to a Laptop with what I 
thought was a higher speed mobile graphics card only to have it come to a 
screeching halt.

One of the things you have to look out for is that Laptops are built for power 
conservation and to not to be a Lap Heater. Both the Operating system and Video 
card driver are set from the factory in a conservation mode that you have to 
disable to get any performance from the darn thing!
Oh, don't think, Oh I'll just put it in performance mode and think you’ll get 
buy. You may also have to remove some of the background software components 
that were installed for convince sake of a laptop – like that thingy that you 
use with your finger to log-in to your computer. 

You may have already thought of this, but I thought I'd bring it up anyway for 
those who haven’t. I've had too many people bang on my head because they can't 
get my software to run on their laptops and after looking into their system, 
finding all this hidden background crap that was holding things up. 
 
Oh, and Linux users, don't think that since you’re not using WinDozze that you 
out of the woods either. I've seen my share of crap on laptops using Linux as 
well. 


D Glenn.


D Glenn (a.k.a David Glenn) - Moving Heaven and Earth!

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





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


Re: [osg-users] Background image...

2011-07-15 Thread Büsra Gülten
Thank your for your reply, Stephan. 

You were right. I changed my code: 

 - (void)applicationDidFinishLaunching:(UIApplication *)application {
 
  osg::setNotifyLevel(osg::DEBUG_INFO);
 
 _viewer = new osgViewer::Viewer();
 _root = new osg::Group;   
 
 
 //
 //Create a Group with Box, Sphere and Cone
 //
 osg::ref_ptrosg::ShapeDrawable shape1 = new osg::ShapeDrawable;
 shape1-setShape(new osg::Box(osg::Vec3(-3.0f, 0.0f, 0.0f), 2.0f, 2.0f, 
 2.0f)); 
 shape1-setColor(osg::Vec4(1.0f, 0.0f, 0.0f, 0.0f));
 
 osg::ref_ptrosg::ShapeDrawable shape2 = new osg::ShapeDrawable; 
 shape2-setShape(new osg::Sphere(osg::Vec3(3.0f, 0.0f, 0.0f), 1.0f)); 
 shape2-setColor(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
 
 osg::ref_ptrosg::ShapeDrawable shape3 = new osg::ShapeDrawable; 
 shape3-setShape(new osg::Cone(osg::Vec3(0.0f, 0.0f, 0.0f), 1.0f, 1.0f)); 
 shape3-setColor(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
 
 osg::ref_ptrosg::Geode geode = new osg::Geode; 
 geode-addDrawable(shape1.get());
 geode-addDrawable(shape2.get());
 geode-addDrawable(shape3.get());
 
 // try msaa. available for iOS = 4.0
 osg::DisplaySettings* settings = osg::DisplaySettings::instance();
 settings-setNumMultiSamples(4);

 OpenSceneGraph_iOSViewController* touch_handler = new 
 OpenSceneGraph_iOSViewController();
   
 unsigned int w(640);
 unsigned int h(480);
 
 osg::GraphicsContext::WindowingSystemInterface* wsi = 
 osg::GraphicsContext::getWindowingSystemInterface();
   
 if (wsi) 
 {
 wsi-getScreenResolution(0, w, h);
 }
 
 //
 //Camera
 //
 //create and attach ortho camera for hud text
 osg::ref_ptrosg::Camera hudCamera = new osg::Camera;
 
 // set the projection matrix
 hudCamera-setProjectionMatrix(osg::Matrix::ortho2D(0,w,0,h));
   
 // set the view matrix
 hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 hudCamera-setViewMatrix(osg::Matrix::identity());
 
 // only clear the depth buffer
 hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT);
   
 // draw subgraph after main camera view.
 hudCamera-setRenderOrder(osg::Camera::PRE_RENDER);; 
 
 hudCamera-addChild(touch_handler-getDebugNode());
 
 
 //
 // Texture for Background
 //
 osg::Geometry *rectBackground = new osg::Geometry; 
 osg::Vec3Array* vertices = new osg::Vec3Array(4); 
 (*vertices)[1].set(0.f, 0.f, 0.f); 
 (*vertices)[2].set((float)w, 0.f, 0.f); 
 (*vertices)[3].set((float)w, 0.f, (float)h); 
 rectBackground-setVertexArray(vertices); 
  
 osg::Vec2Array* texcoords = new osg::Vec2Array(4); 
 (*texcoords)[0].set(0.0f, (float)h); 
 (*texcoords)[1].set(0.0f, 0.0f); 
 (*texcoords)[2].set((float)w, 0.0f); 
 (*texcoords)[3].set((float)w, (float)h); 
 rectBackground-setTexCoordArray(0,texcoords); 
 
 osg::Vec3Array* normals = new osg::Vec3Array(1); 
 (*normals)[0].set(0.0f,1.0f,0.0f); 
 rectBackground-setNormalArray(normals); 
 rectBackground-setNormalBinding(osg::Geometry::BIND_OVERALL); 
 rectBackground-addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4)); 
 osg::Geode* Background_geode = new osg::Geode; 
 Background_geode-addDrawable(rectBackground); 
  
 // set up the texture state.    
 osg::ref_ptrosg::TextureRectangle Background_texture = new 
 osg::TextureRectangle; 
 Background_texture-setDataVariance(osg::Object::DYNAMIC); 
 
 // protect from being optimized away as static state. 
 Background_texture-setImage(osgDB::readImageFile(imagefile.jpg)); 
 osg::StateSet* stateset = rectBackground-getOrCreateStateSet(); 
 
 stateset-setTextureAttributeAndModes(0,Background_texture,osg::StateAttribute::ON);
  
 
 
 //
 // root
 //
 hudCamera-addChild(Background_geode); 
 
 osg::Node* one = hudCamera.get(); 
 osg::Node* two = geode.get(); 
 
 one-getOrCreateStateSet()-setRenderBinDetails(1, RenderBin);
 two-getOrCreateStateSet()-setRenderBinDetails(2, RenderBin);
 
 _root-addChild(one); 
 _root-addChild(two); 
 
 _root-getOrCreateStateSet()-setMode(GL_DEPTH_BITS, 
 osg::StateAttribute::OFF);
 two-getOrCreateStateSet()-setMode(GL_DEPTH_BITS, 
 osg::StateAttribute::ON); 
 
 //
 // viewer
 //
 _viewer-addEventHandler(touch_handler);
 _viewer-setSceneData(_root.get());
 _viewer-setCameraManipulator(new osgGA::MultiTouchTrackballManipulator);
   _viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);
 
 
 //SingleThreaded DrawTheadPerContext
   _viewer-realize();
   _viewer-frame();
   osg::setNotifyLevel(osg::INFO);
   
   [NSTimer scheduledTimerWithTimeInterval:1.0/30.0 target:self 
 selector:@selector(updateScene) userInfo:nil 

Re: [osg-users] RTT into a single color channel

2011-07-15 Thread Bolstad, Mark
So I've done some testing. I've decided to go the shader route as it will give 
the most flexibility. I've modified osgdistortion from the latest svn. At the 
end is a short patch to show the changes.

The main problem I'm getting is that the FBO texture doesn't appear to be 
passing to the shader properly. All I'm getting is a black screen. If I swap 
the shader to color based on texture coordinates, the output is correct. I'm 
sure that I'm probably missing something simple in the setup/texture binding, 
and any help is appreciated.

Mark

34,36d33
 #include osg/Program
 #include osg/Shader
 #include osg/Uniform
58,80d54
 ///
 // in-line GLSL source code for the microshader example
 
 static const char *shaderVertSource = {
 // passthru - Simple pass through vertex shader\n
 void main(void)\n
 {\n
 gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n
 gl_Position = ftransform();\n
 }\n
 };
 
 static const char *shaderFragSource = {
 uniform sampler2DRect textureIn;\n
 void main(void)\n
 {\n
 //gl_FragColor = vec4( gl_TexCoord[0].s, gl_TexCoord[0].t, 0.0, 1.0 
);\n
 gl_FragColor = texture2DRect( textureIn, gl_TexCoord[0].st );\n
 }\n
 };
 
 ///
 
94,98d67
   osg::Program* program = new osg::Program;
   program-setName( texture_shader );
   program-addShader( new osg::Shader( osg::Shader::VERTEX, 
shaderVertSource ) );
   program-addShader( new osg::Shader( osg::Shader::FRAGMENT, 
shaderFragSource ) );
 
156,157d124
 osg::Vec3 cursor = bottom;
 osg::Vec2 texcoord = bottom_texcoord;
198,201c165,166
 stateset-setTextureAttributeAndModes( 0, texture, 
osg::StateAttribute::ON );
 stateset-addUniform( new osg::Uniform( textureIn, 0 ) );
 stateset-setAttributeAndModes( program, osg::StateAttribute::ON );
 stateset-setMode(GL_LIGHTING,osg::StateAttribute::ON);
---
 stateset-setTextureAttributeAndModes(0, 
 texture,osg::StateAttribute::ON);
 stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF);
391d355
 osg::Vec3 cursor = bottom;
393,394d356
 
 
705c667
 if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osg);
---
 if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osgt);
786d747
 viewer.setUpViewOnSingleScreen( 0 );

Mark A. Bolstad
Scientific Computing
Janelia Farm Research Campus
Howard Hughes Medical Institute
19700 Helix Drive, Ashburn, VA  20147
email: bolst...@janelia.hhmi.org
office: +1.571.209.4623
web: http://www.hhmi.org/janelia/






On Jul 14, 2011, at 10:45 AM, J.P. Delport wrote:

 Hi,
 
 On 14/07/2011 16:37, Jason Daly wrote:
 On 07/14/2011 10:08 AM, Bolstad, Mark wrote:
 I like the idea of combining the passes into one, but if I had a blue
 object and had to mask it into the red channel, wouldn't it just be
 black?
 
 Yes, it would be black on the red and green passes, but it would show up
 on the blue pass. When you combined the three passes of the image to an
 RGB texture, you'd have your blue object. The flow would look something
 like this:
 
 - set the camera to draw to an RGB texture
 - set camera's color mask to red only
 - draw the first object
 - set camera's color mask to green only
 - draw the second object
 - set camera's color mask to blue only
 - draw the third object
 - fetch the texture from the camera and use it however you need it
 
 as J-S said, you save the combine pass and you don't even need any
 special shader magic.
 
 
 I had talked to a professor who had suggested a one-line fragment
 shader to do RGB- Luminance and use Color Masking to write into the
 appropriate channel. Would rendering straight into a Luminance texture
 with Color Masking work?
 
 Maybe I'm not understanding you correctly, but I don't think this would
 work. You'd end up with a luminance image (effectively, a grayscale
 image) at the end and not a color image.
 
 I think prof meant he must stick the calculated luminance value into all 
 three channels.
 
 jp
 
 
 
 In reality, this is actually more complicated in that it's not three
 objects, but three separate frames of animation. So the main loop is:
 
 while(1)
 {
 advance sim
 frame(); // Render to red
 advance sim
 frame(); // Render to green
 advance sim
 frame(); // Render to blue
 Render RTT texture to display.
 }
 
 Maybe if you explained what you're trying to do at a higher level, we'd
 be able to better help. What is the problem you're trying to solve?
 
 --J
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 -- 
 This message is subject to the CSIR's copyright terms and conditions, e-mail 
 legal notice, and implemented Open Document Format (ODF) standard. The full 
 disclaimer details can be 

Re: [osg-users] osgQT Hello World

2011-07-15 Thread Vitor Silva
Hi,

I recompiled the OSG with reference to Qt (with CMake) and the libosgQT.dll was 
generated too. 

The example works great.

Thank's a lot again!

Cheers,
Vitor

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





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


Re: [osg-users] Video textures on iOS (and audio)

2011-07-15 Thread Eric Wing
On 7/14/11, Alessandro Terenzi a.tere...@gmail.com wrote:
 Thanks Stephan,
 I'll study the possibilities more in depth.

If you have access to the WWDC 2011 videos, there were some sessions
related to this topic.

-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org