[osg-users] Pixel Buffer Object and Texture2D

2010-09-24 Thread Anthony Face
Hi,

I tried many thing with out success and i would like to close this step.

I use one texture to set a video on the back-screen. This is already made but 
with out PBO.
How can i use PBO to Write in using memcpy?
it is usefull, i saw it on openGL pure but i wouldn't like to use it directly.

I found the osgExemple for read PBO but not to Write it...

Someone have a such code example or can help me?

thanks you in advance.





Thank you!

Cheers,
Anthony


 (http://www.hordes.fr?ref=litllechicken)

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





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


Re: [osg-users] isCurrent() doesn't really work.

2010-09-24 Thread Robert Osfield
Hi David,

Interesting observation, this is certainly a bug
GraphicsContext::isCurrent().  Your suggestion of a method to get the
current context sounds like a good means for a new implementation.

My suggestion would be to have a static
GraphicsContext::getCurrentContext() method, and then have it check
the Thread::CurrentThread() against a thread safe map of the contexts
that have been made current on each thread.  The
GraphicContext:makeCurrent() and GraphicsContext::releaseContext()
methods would also need to manipulate this map to keep it updated.

If you want to dive in a have a bash at implementing this then it'd be
appreciated ;-)

Cheers,
Robert.


On Thu, Sep 23, 2010 at 10:18 PM, David Guthrie
dguth...@alionscience.com wrote:
 I was looking at the isCurrent call and way contexts and made current and 
 released.

 isCurrent is not virtual, and simply checks to see if the thread on which the 
 context was made current matches the current thread.

 Every OpenGL api I've looked at provides a way to get a handle to the active 
 context, which could be compared to the handle of the context in the 
 GraphicsContext implementation.  That would mean the isContext would always 
 work.

 Currently something like

 A-makeCurrent();
 B-makeCurrent();
 A-isCurrent();

 won't work, but it could be fixed pretty easily.

 At the same time, releaseContext() could check to see if the context is 
 actually the active context and do nothing if it isn't.

 In wgl, glx, agl, and cgl you can call GetCurrentContext with the respective 
 prefix to accomplish this.  Even Qt has QGLContext::currentContext().

 I'll be happy to implement it in some cases, although I am still working with 
 2.8.3 and the changes will have to be ported to the trunk.

 Thanks,
 David Guthrie

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





 ___
 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 2.9.9 - Problem building osgSim

2010-09-24 Thread Robert Osfield
Hi Erin,

On Thu, Sep 23, 2010 at 10:34 PM, Erin Morrow erin.mor...@arup.com wrote:
 So this issue (and many others) arises from the GL.h file that QT installs in 
 place of the default windows version. Reverting to the vanilla GL.h file 
 fixes it. Does anyone understand why QT does this and are there any tips for 
 making QT play nice with OSG?

It does rather sounds like the QT GL.h is a bit wayward and has
started doing more #define's than it really should.  If changing the
variable name on the OSG fixes this then this should be an easy change
to apply.  Could you get things compiling with the variable name
change and then post the resulting file to osg-submissions.

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


Re: [osg-users] Build error on OS X in examples_osgviewerCocoa

2010-09-24 Thread Robert Osfield
Hi Eduardo,

I don't have an OSX box, nor expertise with Cocoa, so can't directly
help fix the problem.

One thing I can raise as a possible solution is to remove this
example.  osgViewer now directly supports Cocoa so a stand alone
example is possibly not required anymore.

Thoughts OSX users?

Robert.

On Fri, Sep 24, 2010 at 2:10 AM, Eduardo Poyart poy...@gmail.com wrote:
 Hello,
 I've sent this e-mail to osg-users@lists.openscenegraph.org but I didn't
 receive it on the list. I'm re-sending it just in case.
 Here is my problem:
 When building OpenSceneGraph on OS X 10.6.4 and creating application
 bundles, I have the error below, on the examples_osgviewerCocoa target. It
 happened on OSG 2.9.8 and it's still happening on 2.9.9.
 This only happens when I set cmake to build application bundles, and only
 on examples_osgviewerCocoa. A Copy Files step is set up with a path of ../.,
 which Xcode doesn't like.
 I think recreating the examples_osgviewerCocoa target should fix it for me,
 but there must be a way to fix it in the cmake configuration files... or is
 no one else getting this?
 Thanks
 Eduardo
 --
 PBXCp
 /Users/epoyart/OpenSceneGraph-2.9.9-build/bin/Debug/osgviewerCocoad.app/Contents/MacOS/.././Info.plist
 examples/osgviewerCocoa/Info.plist

 cd /Users/epoyart/OpenSceneGraph-2.9.9

 /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
 -exclude .DS_Store -exclude CVS -exclude .svn -strip-debug-symbols
 -resolve-src-symlinks
 /Users/epoyart/OpenSceneGraph-2.9.9/examples/osgviewerCocoa/Info.plist
 /Users/epoyart/OpenSceneGraph-2.9.9-build/bin/Debug/osgviewerCocoad.app/Contents/MacOS/../.

 pbxcp: error: open():
 /Users/epoyart/OpenSceneGraph-2.9.9-build/bin/Debug/osgviewerCocoad.app/Contents/MacOS/.././Info.plist
 [/SourceCache/pbx_tools/pbx_tools-1706/pbxcp/file_utils.m:420]: No such file
 or directory

 Command
 /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
 failed with exit code 1
 -


 ___
 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] Pixel Buffer Object and Texture2D

2010-09-24 Thread Robert Osfield
Hi Anthony,

It does sound like you might be over-complicating things.  The OSG
natively supports copying image data to textures using
PixelBufferObject, all you need to do is assign an
osg::PixelBufferObject to an osg::Image, then assign this osg::Image
to the texture you want, and the OSG will do the rest for you.   The
osg::ImageStream class which subclasses from osg::Image by defaults
assigns a PBO, so all the video related plugins will automatically use
PBO for copy data from main member to the GPU.

Robert.


On Fri, Sep 24, 2010 at 8:12 AM, Anthony Face litllechic...@hotmail.com wrote:
 Hi,

 I tried many thing with out success and i would like to close this step.

 I use one texture to set a video on the back-screen. This is already made but 
 with out PBO.
 How can i use PBO to Write in using memcpy?
 it is usefull, i saw it on openGL pure but i wouldn't like to use it directly.

 I found the osgExemple for read PBO but not to Write it...

 Someone have a such code example or can help me?

 thanks you in advance.





 Thank you!

 Cheers,
 Anthony

 
  (http://www.hordes.fr?ref=litllechicken)

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





 ___
 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 error on OS X in examples_osgviewerCocoa

2010-09-24 Thread Stephan Maximilian Huber
Hi,

Am 24.09.10 09:57, schrieb Robert Osfield:

 One thing I can raise as a possible solution is to remove this
 example.  osgViewer now directly supports Cocoa so a stand alone
 example is possibly not required anymore.
 
 Thoughts OSX users?

I think this example should be refactored to show the new usage-pattern
to include osgViewer::GraphicsWindowCocoa with an existing Cocoa
application similar to the MFC/Qt examples.

Unfortunately I have no spare time coding this.

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


Re: [osg-users] Problem with samples

2010-09-24 Thread Wojciech Lewandowski
Thanks Farshid, 

I think you should post it in separate thread with proper subject.  I guess 
large number of people will be grateful for sharing this info ; - )

Wojtek



From: Farshid Lashkari 
Sent: Friday, September 24, 2010 6:19 AM
To: osg-users@lists.openscenegraph.org 
Subject: Re: [osg-users] Problem with samples


Hi, 


I've also been experiencing the fullscreen issue with nVidia cards on Windows 
7. Just wanted to let you know that I found a workaround.


When creating the OpenGL context, I changed the swap method from 
WGL_SWAP_EXCHANGE_ARB to WGL_SWAP_COPY_ARB. This completely solved the issue 
for me.


Hopefully nVidia will fix their drivers in a future release.


Cheers,
Farshid


On Thu, Sep 2, 2010 at 7:00 AM, Martin Anderson poet_mar...@yahoo.co.uk wrote:

  Hi,

  Thanks for all your responses guys - that seems to answer the problem !

  Will try the offered fixes when I get home from work


  Thank you!

  Cheers,
  Martin

  --
  Read this topic online here:

  http://forum.openscenegraph.org/viewtopic.php?p=31274#31274






  ___
  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] Collision between two 3DS objects in OSG.

2010-09-24 Thread BARRAL Adrien
Hello,

In an OSG scene, I have to objects imported from a 3DS file. I can grossly 
approximate these objects with bounding boxes (but not with bounding spheres).
I load my objects in this way :


Code:

Registry::instance()-getDataFilePathList().push_back(resources/data);
ref_ptr ReaderWriter::Options  options = new ReaderWriter::Options;
options-setObjectCacheHint( ReaderWriter::Options::CACHE_NONE);
m_ksterNode = osgDB::readNodeFile(FILE_NAME, options);




So my object is an osg::Node. I had seen that OSG::Node have a method 
computeBound wich return a bounding Sphere (but I want a bounding box).

I had seen that both osg::Geode, osg::Drawable and osg::Shape can return a 
bounding box thanks to the method getBoundingBox.

I read a method to wich explain how to convert an OSG::Drawable object into an 
bullet TriangleMesh object to perform fine collision detection with bullet. 
But, my imported object isn't a OSG::Drawable, that is an OSG::Node.

So here are my questions :
1 - How to convert an OSG::Node into an osg::Drawable or osg::Geode ?
2 - If question 1 is absurd, my second question is : How to load a 3DS object 
as a osg::Drawable or osg::Geode (and not as an osg::Node).

I had read a nice tutorial 
(http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/collisions/collisions.html)
 on the collision detection, but this tutorial doesn't answer to my questions.


So , thanks very much for your answers, 


Regads, A. BARRAL

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





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


Re: [osg-users] Collision between two 3DS objects in OSG.

2010-09-24 Thread Gordon Tomlinson
HI 

I would recommend reading the OSG Starter guide written by Paul Martz the
PDF is free,  http://osgbooks.com/books/osg_qs.html

You don't seem to fully understand how the scenegraph is created in OSG and
what is created etc, the 3DS loader does create Geodes and you will have
them if you load a file.


I would also recommend looking at the examples there are many and they show
how geodes and nodes are used. Also search the OSG mail archive for
information on Geodes and drawable and how to access them,


__
Gordon Tomlinson 

gor...@gordontomlinson.com IM: gordon3db...@3dscenegraph.com 
www.vis-sim.com
www.gordontomlinson.com
www.PhotographyByGordon.com

__

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of BARRAL
Adrien
Sent: Friday, September 24, 2010 11:27 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Collision between two 3DS objects in OSG.

Hello,

In an OSG scene, I have to objects imported from a 3DS file. I can grossly
approximate these objects with bounding boxes (but not with bounding
spheres).
I load my objects in this way :


Code:

Registry::instance()-getDataFilePathList().push_back(resources/data);
ref_ptr ReaderWriter::Options  options = new ReaderWriter::Options;
options-setObjectCacheHint( ReaderWriter::Options::CACHE_NONE);
m_ksterNode = osgDB::readNodeFile(FILE_NAME, options);




So my object is an osg::Node. I had seen that OSG::Node have a method
computeBound wich return a bounding Sphere (but I want a bounding box).

I had seen that both osg::Geode, osg::Drawable and osg::Shape can return a
bounding box thanks to the method getBoundingBox.

I read a method to wich explain how to convert an OSG::Drawable object into
an bullet TriangleMesh object to perform fine collision detection with
bullet. But, my imported object isn't a OSG::Drawable, that is an OSG::Node.

So here are my questions :
1 - How to convert an OSG::Node into an osg::Drawable or osg::Geode ?
2 - If question 1 is absurd, my second question is : How to load a 3DS
object as a osg::Drawable or osg::Geode (and not as an osg::Node).

I had read a nice tutorial
(http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/collisions
/collisions.html) on the collision detection, but this tutorial doesn't
answer to my questions.


So , thanks very much for your answers, 


Regads, A. BARRAL

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





___
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] Windows 7 Aero Color Scheme issue

2010-09-24 Thread Martin Naylor
Hi Magnus,
Not sure about the answer to your question.
But I believe this to be fixed in the latest NVidia Beta driver(well for my
single screen anyway).
I did look at the code and my brain went numb trying to find a fix.
Might be worth trying the latest beta drivers see if it still occurs?

Regards

Martin.





-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Magnus
Kessler
Sent: 24 September 2010 06:43
To: OpenSceneGraph Users
Subject: Re: [osg-users] Windows 7 Aero Color Scheme issue

On Thursday 08 July 2010, Martin Naylor wrote:
 Hi,
 Yeah its certainly Aero...
 I two have the same issue, disabling Aero sorts its out, but mine is on a
 single screen.
 Alt-Tab will make it work as well.
 Have a look here http://www.opengl.org/pipeline/article/vol003_7/
 
 Are we using GDI? I don't understand the viewer code, I might have
 another attempt later...
 http://bugreports.qt.nokia.com/browse/QTBUG-6988 might of interest.
 
 This what I posted a while back:
 I did mention this a while back about osgShadow.
 All my are examples do this now after installing a new Nvidia GTX 480
 card(from a gtx 9800), with the latest drivers from Nvidia.
 My guess you are running Windows Vista/7, try alt tab?
 For a permanent fix disable the pesky Aero desktop!
 I tried looking for a fix last night and its something to do with
 swapbuffers either being called or not, I cannot remember it was late and
 the viewer code was baffling me!
 Ok it might be
 
 Never found a fix, i have looked into the viewer code, but never got to
 the bottom of it.
 
 
 Martin.
 
 

I made an interesting observation recently. One and the same code 
(essentially osgviewer) showed the black screen when starting up in the 
automatically chosen DrawThreadPerContext threading mode, but worked fine 
when SingleThreaded was forced. What is different in the way the OpenGL 
context is created in these two cases?

Magnus
___
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] [osgPlugins] NO Normal Map from FBX.

2010-09-24 Thread Dario Minieri
Hi,

I was noticing that the Normals maps, assigned in 3DSMAX, aren't exported in 
the osg format. The Normal map file reference is in the FBX model but no in the 
converted osg file.

This is a my problem? I'm using OSG 2.8.3 with the FBX SDK 2010.2.

Thank you!

Cheers,
Dario

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





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


Re: [osg-users] Windows 7 Aero Color Scheme issue

2010-09-24 Thread Wojciech Lewandowski

Hi Guys,

Have you seen last post from Farshid Lashkari in Re: [osg-users] Problem 
with samples thread ?


Start Quote
I've also been experiencing the fullscreen issue with nVidia cards on 
Windows 7. Just wanted to let you know that I found a workaround.
When creating the OpenGL context, I changed the swap method from 
WGL_SWAP_EXCHANGE_ARB to WGL_SWAP_COPY_ARB. This completely solved the issue 
for me.

Hopefully nVidia will fix their drivers in a future release.
Farshid
End Quote

IMHO He has found the workaround and but also the source of the problem. I 
just checked his solution and it simply works.
So I think that with Aero DWM not having front buffer but internal Direct3D 
texture, its quite understandable why COPY works better than EXCHANGE. Its 
hard to understand though why NvIdia drivers  suggest EXCHANGE in 
ChoosePixelFormat when it does not work correctly. Btw I checked with 
DescribePixelFormat if the returned PixelFormat is compatible with 
PFD_SUPPORTS_COMPOSITION . And yes, returned description structure reports 
this compatibility. So this whole issue looks weird and definitely points to 
the drivers as the source of the problem. The drivers have the option to 
return PixelFormat with SWAP_COPY method but it keeps returning 
SWAP_EXCHANGE.


Regards,
Wojtek


--
From: Martin Naylor martinnay...@virginmedia.com
Sent: Friday, September 24, 2010 2:11 PM
To: 'OpenSceneGraph Users' osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Windows 7 Aero Color Scheme issue


Hi Magnus,
Not sure about the answer to your question.
But I believe this to be fixed in the latest NVidia Beta driver(well for 
my

single screen anyway).
I did look at the code and my brain went numb trying to find a fix.
Might be worth trying the latest beta drivers see if it still occurs?

Regards

Martin.





-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Magnus
Kessler
Sent: 24 September 2010 06:43
To: OpenSceneGraph Users
Subject: Re: [osg-users] Windows 7 Aero Color Scheme issue

On Thursday 08 July 2010, Martin Naylor wrote:

Hi,
Yeah its certainly Aero...
I two have the same issue, disabling Aero sorts its out, but mine is on a
single screen.
Alt-Tab will make it work as well.
Have a look here http://www.opengl.org/pipeline/article/vol003_7/

Are we using GDI? I don't understand the viewer code, I might have
another attempt later...
http://bugreports.qt.nokia.com/browse/QTBUG-6988 might of interest.

This what I posted a while back:
I did mention this a while back about osgShadow.
All my are examples do this now after installing a new Nvidia GTX 480
card(from a gtx 9800), with the latest drivers from Nvidia.
My guess you are running Windows Vista/7, try alt tab?
For a permanent fix disable the pesky Aero desktop!
I tried looking for a fix last night and its something to do with
swapbuffers either being called or not, I cannot remember it was late and
the viewer code was baffling me!
Ok it might be

Never found a fix, i have looked into the viewer code, but never got to
the bottom of it.


Martin.




I made an interesting observation recently. One and the same code
(essentially osgviewer) showed the black screen when starting up in the
automatically chosen DrawThreadPerContext threading mode, but worked 
fine

when SingleThreaded was forced. What is different in the way the OpenGL
context is created in these two cases?

Magnus
___
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] Regarding image::data

2010-09-24 Thread Mahendra G.R
Hello Guys,

I have a small situation here, i'm trying to write float data into an image
file using image-data(x,y,z)[0] = 0.352 (an example), but it automatically
converts it into char, how can i prevent this?

Thanks,
Best regards

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


Re: [osg-users] Regarding image::data

2010-09-24 Thread Robert Osfield
Hi Mahendra? G.R?

All you need to do is cast the data return type to float.

Robert.

On Fri, Sep 24, 2010 at 2:04 PM, Mahendra G.R mahen...@mahendragr.com wrote:
 Hello Guys,

 I have a small situation here, i'm trying to write float data into an image
 file using image-data(x,y,z)[0] = 0.352 (an example), but it automatically
 converts it into char, how can i prevent this?

 Thanks,
 Best regards

 --
 http://www.mahendragr.com

 ___
 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] Regarding image::data

2010-09-24 Thread Werner Modenbach
Hi Mahendra G.R,

what type does image have?
If it is something like RGBA you try to assign a float to an unsigned byte. 
This will do implicit conversion.

- Werner -

On Friday 24 September 2010 15:21:37 Robert Osfield wrote:
 Hi Mahendra? G.R?
 
 All you need to do is cast the data return type to float.
 
 Robert.
 
 On Fri, Sep 24, 2010 at 2:04 PM, Mahendra G.R mahen...@mahendragr.com 
wrote:
  Hello Guys,
  
  I have a small situation here, i'm trying to write float data into an
  image file using image-data(x,y,z)[0] = 0.352 (an example), but it
  automatically converts it into char, how can i prevent this?
  
  Thanks,
  Best regards
  
  --
  http://www.mahendragr.com
  
  ___
  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

-- 
TEXION Software Solutions

TEXION GmbH -  Rotter Bruch 26a  -  D 52068 Aachen - HRB 14999 Aachen
Fon: +49 241 475757-0, Fax: +49 241 475757-29, web: http://www.texion.eu

Geschäftsführer/Managing Director: Werner Modenbach
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] QTKit plugin checked in, OSX users please test ;-)

2010-09-24 Thread Robert Osfield
Hi All,

I'm please to write that today I checked into svn/trunk Eric Wing's
work on a QTKit/CoreVideo plugin for OSX.  This plugin should pave the
way for deprecating the old Quicktime plugin, and open the door for
easier support for 32bit and 64bit builds under OSX.

Thanks Eric Wing, and the DigitalLearningFoundation for funding this effort.

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


Re: [osg-users] OSG 2.9.9 - Problem building osgSim

2010-09-24 Thread Erin Morrow
Hi,

For now I think the best thing is to compile OSG with the standard GL.h and 
only use the Qt version when absolutely necessary for our project specific work.

Thank you!

Cheers,
Erin

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





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


Re: [osg-users] Regarding image::data

2010-09-24 Thread Mahendra G.R
Hello,

@Robert, Mahendra is ok :).

Btw, i gave GL_FLOAT as the type, i took Robert's suggestion and itseems
working, however, i'm getting values from 0-255 (converted?) and not the
actual float values stored.

this is what i'm exactly doing :

code:


(float)image-data(0,0,0)[0] = 0.33
  [1] = 0.56
  [2] = .83

and printing them back casting to float.  what am i doing wrong?



Thanks,
Best regards.
On Fri, Sep 24, 2010 at 3:31 PM, Werner Modenbach 
werner.modenb...@texion.eu wrote:

 Hi Mahendra G.R,

 what type does image have?
 If it is something like RGBA you try to assign a float to an unsigned byte.
 This will do implicit conversion.

 - Werner -

 On Friday 24 September 2010 15:21:37 Robert Osfield wrote:
  Hi Mahendra? G.R?
 
  All you need to do is cast the data return type to float.
 
  Robert.
 
  On Fri, Sep 24, 2010 at 2:04 PM, Mahendra G.R mahen...@mahendragr.com
 wrote:
   Hello Guys,
  
   I have a small situation here, i'm trying to write float data into an
   image file using image-data(x,y,z)[0] = 0.352 (an example), but it
   automatically converts it into char, how can i prevent this?
  
   Thanks,
   Best regards
  
   --
   http://www.mahendragr.com
  
   ___
   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

 --
 TEXION Software Solutions

 TEXION GmbH -  Rotter Bruch 26a  -  D 52068 Aachen - HRB 14999 Aachen
 Fon: +49 241 475757-0, Fax: +49 241 475757-29, web: http://www.texion.eu

 Geschäftsführer/Managing Director: Werner Modenbach
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




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


Re: [osg-users] OSG 2.9.9 compile issues on Mac with Qt 4.6.3, other Qt issues

2010-09-24 Thread Erin Morrow
Hi JS,

Can you confirm that the 2 examples you mention in your post made it into the 
2.9.9 developer release? 

Thank you!

Cheers,
Erin

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





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


Re: [osg-users] Regarding image::data

2010-09-24 Thread Robert Osfield
Hi Mahendra,



On Fri, Sep 24, 2010 at 2:46 PM, Mahendra G.R mahen...@mahendragr.com wrote:
 code:


 (float)image-data(0,0,0)[0] = 0.33
   [1] = 0.56
   [2] = .83

 and printing them back casting to float.  what am i doing wrong?

This is really a C++ question.  If you want to access the each colour
components then you'd be best casting the data pointer to a (float*)
then use this to access the components.

float* pixel = static_castfloat*(image-data(i,j,k));
pixel[0] = r;
pixel[1] = g;
pixel[2] = b;

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


Re: [osg-users] Build error on OS X in examples_osgviewerCocoa

2010-09-24 Thread Robert Osfield
Hi Stephan,

On Fri, Sep 24, 2010 at 9:29 AM, Stephan Maximilian Huber
ratzf...@digitalmind.de wrote:
 I think this example should be refactored to show the new usage-pattern
 to include osgViewer::GraphicsWindowCocoa with an existing Cocoa
 application similar to the MFC/Qt examples.

 Unfortunately I have no spare time coding this.

If no one has time to rewrite it right now, would it be appropriate to
moved the osgviewerCocoa example to deprecated section of the svn
repository, then when someone has the time for them to write a new
Cocoa example?

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


[osg-users] Workaround for nVidia + fullscreen + Windows 7

2010-09-24 Thread Farshid Lashkari
Hi,

Wojtek suggested I create a separate thread for this, so here it is.

I've also been experiencing the fullscreen issue with nVidia cards on
Windows 7. Just wanted to let you know that I found a workaround.

When creating the OpenGL context, I changed the swap method from
WGL_SWAP_EXCHANGE_ARB to WGL_SWAP_COPY_ARB. This completely solved the issue
for me.

Others have reported that this fixed the issue for them as well.

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


[osg-users] [build] OSG Namespace Functions

2010-09-24 Thread Matt Caron
Hi,

I built OSG from source on Windows and I have just gotten past the Hello World 
program.  I am now trying to load a mesh using the following line:


Code:

osg::Node* pLoadedModel = osgDB::readNodeFile(cow.osg);




However I get the following error:

1..\HelloWorld2\HelloWorld.cpp(8) : error C2039: 'readNodeFile' : is not a 
member of 'osgDB'
1..\HelloWorld2\HelloWorld.cpp(8) : error C3861: 'readNodeFile': identifier 
not found

Now I suppose this makes sense because while I have a directory called osgDB/ 
with all of the osgDB classes in it, I don't have any header file for osgDB 
itself.

Can anyone tell me where the lib for osgDB should be?  Or clarify what is going 
wrong here?


Thank you!

Cheers,
Matt[/code]

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





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


[osg-users] NodeTrackerManipulator changes view at every keyswitchmanipulator call

2010-09-24 Thread Anna Palazzolo
Hi all,

when I select the NodeTrackerManipulator using the keyswitchmanipulator more 
then one time, the view position changes every time.

The problem I'm speaking about can be seen running the osgsimulation example 
(I'm running the osg trunk examples, but I guess it's always been there: the 
same was happening with the 2.8.3 too):
the NodeTrackerManipulator can be chosen pushing the 0 (zero) key: try pressing 
it more times, or simply switch from the TrackBallManipulator to 
NodeTrackerManipulator (1 key and 0 key):
- when selecting the TrackBallManipulator the cessna starts moving from the 
same view in which it was left by the NodeTrackerManipulator (correct behavior)
- when selecting the NodeTrackerManipulator it changes view position at every 
manipulator switch.

I've looked in the forum about such a problem, but could not find anything :(

I've looked into the code, and it seems related to how the getMatrix(), 
setByMatrix and getInverseMatrix are implemented in the NodeTrackerManipulator: 
- in the getMatrix() it uses nodecenter, noderotation, _rotation and _distance 
to calculate the matrix
- then in the setByMatrix method it sets the _rotation quaternion using this 
matrix
- finally in the getInverseMatrix method it uses again all nodecenter, 
noderotation, _rotation and _distance to calculate the return matrix. 

So it seems that nodecenter and noderotation are used twice, and this maybe 
could explain the change in the view at every keyswitchmanipulator call.

Any ideas?

Thank you!

Regards,
Anna

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





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


Re: [osg-users] [build] OSG Namespace Functions

2010-09-24 Thread Magnus Kessler
On Friday 24 September 2010 16:27:58 Matt Caron wrote:
 Hi,
 
 I built OSG from source on Windows and I have just gotten past the Hello
 World program.  I am now trying to load a mesh using the following line:
 
 
 Code:
 
 osg::Node* pLoadedModel = osgDB::readNodeFile(cow.osg);
 
 
 
 
 However I get the following error:
 
 1..\HelloWorld2\HelloWorld.cpp(8) : error C2039: 'readNodeFile' : is not a
 member of 'osgDB' 1..\HelloWorld2\HelloWorld.cpp(8) : error C3861:
 'readNodeFile': identifier not found
 
 Now I suppose this makes sense because while I have a directory called
 osgDB/ with all of the osgDB classes in it, I don't have any header file
 for osgDB itself.
 
 Can anyone tell me where the lib for osgDB should be?  Or clarify what is
 going wrong here?
 

It's not quite clear from your message if your code includes the header needed 
for readNodeFile().

Do you have

#include osgDB/ReadFile

in your code?

HTH,

Magnus

 
 Thank you!
 
 Cheers,
 Matt[/code]
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=32038#32038
 
 
 
 
 
 ___
 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] Workaround for nVidia + fullscreen + Windows 7

2010-09-24 Thread Robert Osfield
Hi Farshid,

On Fri, Sep 24, 2010 at 4:24 PM, Farshid Lashkari fla...@gmail.com wrote:
 Wojtek suggested I create a separate thread for this, so here it is.
 I've also been experiencing the fullscreen issue with nVidia cards on
 Windows 7. Just wanted to let you know that I found a workaround.
 When creating the OpenGL context, I changed the swap method from
 WGL_SWAP_EXCHANGE_ARB to WGL_SWAP_COPY_ARB. This completely solved the issue
 for me.
 Others have reported that this fixed the issue for them as well.

Did you modify the OSG to achieve this?  If so could you post the
changes.  Perhaps this could be made as an runtime option in
osgViewer.

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


Re: [osg-users] Workaround for nVidia + fullscreen + Windows 7

2010-09-24 Thread Farshid Lashkari
Hi Robert,

On Fri, Sep 24, 2010 at 9:28 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Did you modify the OSG to achieve this?  If so could you post the
 changes.  Perhaps this could be made as an runtime option in
 osgViewer.


My application handles all the windowing code itself, so I didn't need to
make any changes to OSG.

I noticed that GraphicsWindowWin32.cpp hard codes the swap method
to WGL_SWAP_EXCHANGE_ARB. To apply this workaround the users would just need
to change this to WGL_SWAP_COPY_ARB and recompile. Having this configurable
would be ideal, however I'm not very familiar with osgViewer, so I'm
probably not the best person to make this change, otherwise I would have
already submitted a patch ;)

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


Re: [osg-users] [build] OSG Namespace Functions

2010-09-24 Thread Matt Caron
I did not have the correct include statement, you're suggestion to check it was 
right on.  I realized that was the problem a few minutes ago and I edited my 
post to say that, but thanks for the help anyway.

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





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


Re: [osg-users] osgBullet: Stereo mode / TriMesh Collision Shapes

2010-09-24 Thread Johannes Scholz
Hi Sergey,

thanks for your hint to GImpact, I will look into it next week!


Hi Paul,

did you have time to try the solution from Sergey, yet?

Otherwise I would try it myself next week, when I'm back in the office.


Best regards and thanks for your help so far,

Johannes

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





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


Re: [osg-users] Workaround for nVidia + fullscreen + Windows 7

2010-09-24 Thread Chris 'Xenon' Hanson
On 9/24/2010 10:40 AM, Farshid Lashkari wrote:
 I noticed that GraphicsWindowWin32.cpp hard codes the swap method
 to WGL_SWAP_EXCHANGE_ARB. To apply this workaround the users would just need 
 to change
 this to WGL_SWAP_COPY_ARB and recompile. Having this configurable would be 
 ideal, however
 I'm not very familiar with osgViewer, so I'm probably not the best person to 
 make this
 change, otherwise I would have already submitted a patch ;)

  At least at one time in the past, SWAP_COPY performed slower than 
SWAP_EXCHANGE (because
it does a copy, duh). I don't know if this is relevant anymore.

 Cheers,
 Farshid

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
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] osgBullet: Stereo mode / TriMesh Collision Shapes

2010-09-24 Thread Paul Martz

(Posting to osgworks-users, as it is where the discussion actually belongs.)

On 9/24/2010 11:03 AM, Johannes Scholz wrote:

Hi Paul,

did you have time to try the solution from Sergey, yet?

Otherwise I would try it myself next week, when I'm back in the office.


I've thought about it. His suggestion assumes that computeLocalToWorld will 
contain only model (non-view) transformations. This is an invalid assumption if 
the scene graph contains Camera nodes.


I imagine we could have logic like this:
  Check the NodePath for the presence of Camera nodes.
  If Camera nodes are present in the path
Get the view matrix as in existing code
  else do as Sergey suggests:
Get the accumulated model transform from the NodePath
View = inverseModel * modelViewMatrix
But this appears to be quite a bit of code bulk to support a corner case usage 
situation.


Given that SceneView is deprecated, and there are workarounds available for 
anaglyphic stereo, it doesn't appear to me that any change is in order for 
osgWorks / osgBullet.


--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] isCurrent() doesn't really work.

2010-09-24 Thread David Guthrie
I was just thinking of making isCurrent() virtual and implementing it for each 
of the windowing implementations.

Then in releaseContext, it could check to see if the context being released is 
actually the current context.  

It may be nice to get the current GraphicsContext, but the cost of that is 
someone could change the context using a direct api call and the osg calls 
would be broken again.  Using the native api call internally would prevent that.

Having a GetCurrentContext static call like you said could still be 
implemented, and it could be made more robust by verifying it using the 
isCurrent() call that works with the system level api.  The best it could do, 
however, if isCurrent() returns false on the suspected current context would be 
to return NULL.  Either way, the GetCurrentContext() call would be an 
additional feature to fixing isCurrent().

Cheers,
David

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





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


[osg-users] Logitech Joystick Extreme 3D pro USB OSG

2010-09-24 Thread Patrick Pagano
Hi,

I would like to know how to get my Logitech Joystick Extreme 3D pro USB to work 
with Open Scene Graph. Is there an existing version for Windows XP that might 
already work with USB Joysticks? 

... 

Thank you!

Cheers,
Patrick

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





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


Re: [osg-users] Logitech Joystick Extreme 3D pro USB OSG

2010-09-24 Thread Tomlinson, Gordon
Under wndows, your joystick should just work, as certain functions are mapped 
direclty to mouse functions.
 
If you want specifics actions and use of other buttons and features of your 
joystick then you will have to add code to do that
 
 



From: osg-users-boun...@lists.openscenegraph.org on behalf of Patrick Pagano
Sent: Fri 9/24/2010 1:59 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Logitech Joystick Extreme 3D pro USB  OSG



Hi,

I would like to know how to get my Logitech Joystick Extreme 3D pro USB to work 
with Open Scene Graph. Is there an existing version for Windows XP that might 
already work with USB Joysticks?

...

Thank you!

Cheers,
Patrick

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





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


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


Re: [osg-users] Logitech Joystick Extreme 3D pro USB OSG

2010-09-24 Thread Ben Cain
I've used SDL (Simple Direcmedia Layer) alongside OSG with success
(for the Joystick you mentioned as well as gamepads, etc.).  SDL is
lightweight and simple to use.

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


Re: [osg-users] OSG 2.9.9 compile issues on Mac with Qt 4.6.3, other Qt issues

2010-09-24 Thread Jean-Sébastien Guay

Hello Erin,


Can you confirm that the 2 examples you mention in your post made it into the 
2.9.9 developer release?


In the previous post on this thread I mentioned more than 2 examples...

Do you mean the osgQtWidgets and osgQtBrowser examples, or the 
osgViewerQtContext and osgViewerQtWidget examples?


In any case, all four are in 2.9.9 (since it is made off the trunk). You 
just need to configure with Qt in CMake and they should be included in 
your build. CMake should find your Qt automatically, but if it doesn't 
or it finds the wrong one, I find putting the right path in the 
QT_QMAKE_EXECUTABLE variable and pressing Configure again makes it use 
that path for all other components it needs.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Logitech Joystick Extreme 3D pro USB OSG

2010-09-24 Thread Patrick Pagano
I have installed binaries on windows and when i run OSGviewer with an .obj or 
an .flt i do not get any Joystick control. Perhaps i am using the wrong thing 
to load and joystick around models? The mouse and the number keys all work. Is 
there a flag that can be set at commandline to use the joystick?

... 

Thank you!

Cheers,
Patrick

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





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


Re: [osg-users] OSG 2.9.9 compile issues on Mac with Qt 4.6.3, other Qt issues

2010-09-24 Thread Erin Morrow
Hi,

I was referring to the osgViewerQt* examples - though I can see that is not 
clear in my original post! Thank you for the clarification. I have built all 
the QT examples in 2.9.9 at this point and they seem to be working great.

Cheers,
Erin

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





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


Re: [osg-users] Workaround for nVidia + fullscreen + Windows 7

2010-09-24 Thread Wojciech Lewandowski
Hi,

Exactly as Farshid Said I have modified PreparePixelFormatSpecification 
function in GraphicsWindowWin32.cpp to test the workaround. Interestingly 
PreparePixelFormatSpecification has a input allowSwapExchangeARB parameter as 
if someone had similar problem before. But this parameter is used when function 
is called but not influenced directly by GraphicContext::Traits. In my opinion 
the best option would be expose Swap method in the GraphicContext::Traits.

I may try to come up with a patch on monday.  Anyone to beat me on this ;-)  ?

Wojtek

From: Farshid Lashkari 
Sent: Friday, September 24, 2010 6:40 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] Workaround for nVidia + fullscreen + Windows 7


Hi Robert,


On Fri, Sep 24, 2010 at 9:28 AM, Robert Osfield robert.osfi...@gmail.com 
wrote: 
  Did you modify the OSG to achieve this?  If so could you post the
  changes.  Perhaps this could be made as an runtime option in
  osgViewer.




My application handles all the windowing code itself, so I didn't need to make 
any changes to OSG.


I noticed that GraphicsWindowWin32.cpp hard codes the swap method to 
WGL_SWAP_EXCHANGE_ARB. To apply this workaround the users would just need to 
change this to WGL_SWAP_COPY_ARB and recompile. Having this configurable would 
be ideal, however I'm not very familiar with osgViewer, so I'm probably not the 
best person to make this change, otherwise I would have already submitted a 
patch ;)


Cheers,
Farshid









___
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] shadows and custom shaders

2010-09-24 Thread Michael Irby II
Hi guys,

So I have been reworking to support the shadows. Does the tex gen coords get 
stored in the texture matrix? Am I wrong to assume I can still use the 
fixed-function tex gen coords with a shader?

Werner,

I noticed you said you replaced the OSG shader with your own. Do you happen to 
know what happens when you stop using an uber-shader to render everything in 
your scene. My scene has many shaders in the graph. To me it seems like some 
data might be getting overridden down the traversal of the scene.

Thanks.

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





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


Re: [osg-users] shadows and custom shaders

2010-09-24 Thread Jean-Sébastien Guay

Hi Michael,


So I have been reworking to support the shadows. Does the tex gen coords get 
stored in the texture matrix? Am I wrong to assume I can still use the 
fixed-function tex gen coords with a shader?


Texture coordinate generation is done by the Vertex stage, so as soon as 
you start using a vertex shader you need to do tex coord generation for 
your shadow texture unit too. Check the vertex shaders in 
src/osgShadow/StandardShadowMap.cpp for guidance.



I noticed you said you replaced the OSG shader with your own. Do you happen to 
know what happens when you stop using an uber-shader to render everything in 
your scene. My scene has many shaders in the graph. To me it seems like some 
data might be getting overridden down the traversal of the scene.


If you use different shaders on different nodes, you need to do shadow 
texgen computation (vertex shader) and shadow application (fragment 
shader) in all of them. You can easily factor out those functions into 
small shader files that you will include everywhere you use your own 
shaders. That's what the shaders in StandardShadowMap.cpp do - the main 
shader declares a DynamicShadow() function and calls it, and the shadow 
shader defines that function. You can do the same, just write your own 
main shader, declaring the DynamicShadow() function and calling it, and 
include the same shadow shader (with the code of DynamicShadow()) in all 
of them.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] shadows and custom shaders

2010-09-24 Thread Michael Irby II
Thanks J-S. Yea I finally got it working. I did it by taking over the cull step 
of the shadow maps and getting rid of the fixed function tex gen and then 
pushing the matrices for the shadow projection into my vertex shaders and doing 
the math there.

Thanks for your help.

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





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


Re: [osg-users] shadows and custom shaders

2010-09-24 Thread Jean-Sébastien Guay

Hi Michael,


Thanks J-S. Yea I finally got it working. I did it by taking over the cull step 
of the shadow maps and getting rid of the fixed function tex gen and then 
pushing the matrices for the shadow projection into my vertex shaders and doing 
the math there.


I think you may have overcomplicated things for yourself a bit... You 
dind't have to remove any fixed function state at all, since when you 
use shaders it's implicitly replaced by your shader. Also, in the shader 
you have everything you need to be able to calculate the texgen already 
(care of the TexGen and some other calculations). This is all spelled 
out in the shaders at the top of src/osgShadow/StandardShadowMap.cpp, as 
I mentioned before.


You have a function called DynamicShadow:

void DynamicShadow( in vec4 ecPosition )
{
// generate coords for shadow mapping
gl_TexCoord[1].s = dot( ecPosition, gl_EyePlaneS[1] );
gl_TexCoord[1].t = dot( ecPosition, gl_EyePlaneT[1] );
gl_TexCoord[1].p = dot( ecPosition, gl_EyePlaneR[1] );
gl_TexCoord[1].q = dot( ecPosition, gl_EyePlaneQ[1] );
}

(the gl_EyePlane* are set up by the TexGen) and you call it like this:

vec4  ecPos  = gl_ModelViewMatrix * gl_Vertex;
DynamicShadow( ecPos );

And as I said, you can put the first part in a file that you will add to 
every osg::Program you have, in addition to your own shader that will 
have the second set of lines in it. Same for the fragment shader,, where 
you would do the shadowmap lookup using the texcoords that were 
calculated above in the vertex shader. That way you're not duplicating 
much code, you're reusing the same file in many places. And you're 
working within the system instead of replacing big parts of it, which I 
find preferable since it's less prone to break later on if OSG changes.


Anyways, good to know you have something that works, but I just wanted 
to point out that there may be a better way.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org