Re: [osg-users] glMultiTexCoord4f , OSG with OGL code

2009-08-06 Thread Stephan Huber
Hi,

Pau Moreno schrieb:
   brickVertexObject-readShaderFile  ( osg::Shader::VERTEX   , 
 /home/Pau/OSG/Test1/Debug/Shaders/TestG80_VS.glsl );
   brickFragmentObject-readShaderFile( osg::Shader::FRAGMENT , 
 /home/Pau/OSG/Test1/Debug/Shaders/TestG80_GS2.glsl );
   brickGeometryObject-readShaderFile( osg::Shader::GEOMETRY , 
 /home/Pau/OSG/Test1/Debug/Shaders/TestG80_FS.glsl );

are you sure, that your load the correct files? From the used naming
convention i think you loaded the geometry shader source into the
fragment-shader and vice versa.

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


Re: [osg-users] how to draw a Curved Surface on the top of terrain?

2009-08-06 Thread Pan Li
Hi,

thanks for all your replies;
use overlaynode,but the projected texture is not right,
any ideas?thanks!!
attached :
yellow lines-profile of geometry 


Code:
geometry-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,v-size())) ;
geode-addChild(geometry);
osgSim::OverlayNode::OverlayTechnique technique
= 
osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY;
osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode(technique);
overlayNode-setOverlaySubgraph(geode);
overlayNode-setOverlayTextureSizeHint(1024);
overlayNode-setOverlayTextureUnit(1);

// insert the OverlayNode between the coordinate system node and its children.
for(unsigned int i=0; iroot-getNumChildren(); ++i)
{
overlayNode-addChild( root-getChild(i) );
}
root-removeChildren(0, root-getNumChildren());
root-addChild(overlayNode);



thanks for your help!

Thank you!

Cheers,
Pan

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



attachment: error.JPG___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 3DS loader revisited?

2009-08-06 Thread Sukender
Hi Robert  Jan,

Ok. I'm pretty sure I won't be able to update the 3DS loader unless I really 
really need it to be updated. That's too bad because it could be nice. 
Moreover, I bet we could have a very nice reader that also reads animations 
keyframes and use osgAnimation for that. (sigh)
Anyway, thanks for the answers.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Mail d'origine -
De: Robert Osfield robert.osfi...@gmail.com
À: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Envoyé: Wed, 5 Aug 2009 17:40:54 +0200 (CEST)
Objet: Re: [osg-users] 3DS loader revisited?

Hi Sukender,

In the past (quite a few years ago now) I did sync with lib3ds, but it
didn't change for a long while so haven't kept up with it.  The OSG's
version has now diverged substationally from lib3ds with it's use of
istream's rather than FILE so an easy merge will no longer be
possible.

What could probably do is backport the features from the current
lib3ds you want.

Robert.

On Wed, Aug 5, 2009 at 3:30 PM, Sukendersuky0...@free.fr wrote:
 Hi all,

 I'm working on something that needs 3DS import (Well, a modified 3DS import, 
 that reads data in keyframes). However I noticed the underlying lib3DS seems 
 a bit old (and it seems the few problems I got are related). Is that really 
 true? Should we work on upgrading the loader, or is there a risk to break 
 compatibility?
 Any thoughts will be appreciated...
 Thanks!

 Sukender
 PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
 ___
 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


Re: [osg-users] [3rdparty] osgOcean 1.0 (LGPL) Released

2009-08-06 Thread Kim Bale
I think I see your problem Peter, you have to run CMake from the root
directory not the src directory the text box is a little misleading.

So the osgOcean directory tree looks a bit like this

..\osgOcean\ - direct cmake to here
..\osgOcean\src\
..\osgOcean\include\
..\osgOcean\resources\

So cmake should read:

Where is the source code: (your directory path)/osgOcean/
Where to build the binaries: (your directory path)/osgOcean/build/

I believe that should fix it.

Kim.



2009/8/6 Peter Clemenko III th3fly...@gmail.com:
 Hi,

 recently got a chance to test it again, same thing



 [Image: http://i16.photobucket.com/albums/b15/Th3Flyboy/screenies/gv.jpg ]

 [Image: http://i16.photobucket.com/albums/b15/Th3Flyboy/screenies/sv.jpg ]

 error message


 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1

   when parsing string

     C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe

   Invalid escape sequence \P

   Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
   cmake --help-policy CMP0010 for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):

 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1

   when parsing string

     C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe

   Invalid escape sequence \P

   Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
   cmake --help-policy CMP0010 for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):

 This warning is for project developers.  Use -Wno-dev to suppress it.

 Check for working C compiler: C:\Program Files\Microsoft Visual Studio 
 9.0\VC\bin\cl.exe
 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1

   when parsing string

     C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe

   Invalid escape sequence \P

   Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
   cmake --help-policy CMP0010 for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):
   CMakeLists.txt:2 (PROJECT)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Check for working C compiler: C:\Program Files\Microsoft Visual Studio 
 9.0\VC\bin\cl.exe -- works
 Detecting C compiler ABI info
 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCCompiler.cmake:1

   when parsing string

     C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe

   Invalid escape sequence \P

   Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
   cmake --help-policy CMP0010 for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):
   CMakeLists.txt:2 (PROJECT)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Detecting C compiler ABI info - done
 Check for working CXX compiler: C:\Program Files\Microsoft Visual Studio 
 9.0\VC\bin\cl.exe
 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1

   when parsing string

     C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe

   Invalid escape sequence \P

   Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
   cmake --help-policy CMP0010 for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):
   CMakeLists.txt:2 (PROJECT)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Check for working CXX compiler: C:\Program Files\Microsoft Visual Studio 
 9.0\VC\bin\cl.exe -- works
 Detecting CXX compiler ABI info
 CMake Warning (dev) at D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1 (SET):
   Syntax error in cmake code at

     D:/csp/devpack/Devpack 32 
 flybuild/osgOcean/build/CMakeFiles/CMakeCXXCompiler.cmake:1

[osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
Hi,
I have a model in ive format and osgviewer displays it fine. However if i 
convert it to osg, i get black and white shaded files as textures, which are of 
no use. I am using osgconv.exe with the following command line 

osgconv.exe -e osg -O OutputTextureFiles -O precision:0.001 model.ive model.osg

Is there anything which i am missing ??

Thank you!
Mach

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





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


Re: [osg-users] OSG and shaders

2009-08-06 Thread Hadrien Thomas
Thank you for the book reference. I will think about purchasing it. I can 
afford it but it's a big expense for me  :-* 

For now, I'm still blocked with OSG.
I want to map the same texture to the 6 faces of a cube.

I made a Geometry called cube and 6 DrawElementsUInt called face1/2/.../6.

I don't know how to setTexCoords to each QUADS.
I thought about making 6 Geometry so I can use a same vertice several times but 
I don't find any method able to link them into a cube as a single geometry.

Is there any other solution? Maybe I can do it with shaders but with so few 
experience I can't see the possibilities they bring.

Thanks again for your help :)

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





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


Re: [osg-users] OSG and shaders

2009-08-06 Thread Kim Bale
I agree with Paul, the Orange book is a *must have* title if you're
learning shaders.

http://books.google.co.uk/books?id=kDXOXv_GeswCdq=opengl+shader+languageprintsec=frontcoversource=bnhl=enei=E5Z6Svb-K5Cy-AbQ87lSsa=Xoi=book_resultct=resultresnum=5#v=onepageq=opengl%20shader%20languagef=false

2009/8/5 Paul Speed psp...@progeeks.com:
 And it deserves saying, if you can get your hands on an OpenGL Orange Book
 you'll be that many more steps ahead.  I thought it was really good at
 explaining things in depth while also being easily navigated to drill in on
 target areas.

 I had complex shaders up and running in a few days with that book... I have
 had some embedded-style coding experience before, though.

 -Paul

 Maxime BOUCHER wrote:

 Well,

  I'm doing an internship too.

 At the beginning I didn't know osg at all, neither shaders.
 There are still an extraordinary amount of things I ignore about OSG (my
 advice: when you try to do or understand something, take a look at how it's
 done in OpenGL).
 Shaders aren't as hard to use as OSG, I discovered about one month ago and
 I can now write some modests but nice effects.

 The essential is to read code and tutorials.
 Don't try to go fast, it's the best way to misunderstand what you
 manipulate and to write bad code, failing your internship. You have 6
 months, you can waste it OR spend 2 months to understand osg and shaders and
 then writting good code, masterizing your internship.

 Thus, first read a few osg tutorials (to understand how textures are
 mapped for example, it seems you don't), I think the 4 or 5 firsts should be
 enough.
 After, try to understand what is a shader (I guess you don't really).
 Then try to understand the shader tutorials from typhoonlabs, or this
 (http://www.siteduzero.com/tutoriel-3-8879-communiquer-avec-l-application-attributs-et-uniforms.html?bcsi-ac-20A76BC15DBD50F6=194870AE0303lbVE9ryZWUuZzrBgMzY7DS6IPWi9BwMAAMDCRwEQDgAAINVbBwA=),
 it's in french.
 I advice to look at osgshader example ONLY to understand (or copy the
 code) how to load and activate a shader, it's 5 lines.

 Don't take me for moralistic, I did these errors.

 Good luck and take your time, it's the best way to success.

 Cheers,
 Maxime

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





 ___
 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


Re: [osg-users] Computing depth buffer in osgVolume

2009-08-06 Thread Robert Osfield
Hi Yvon,

The present osgVolume shaders that I've written compute the ray start
position from the initial fragment generated by rendered the backface
of the cube, then shoots the ray forward towards the eye point and
then clamps this to the dimensions of the cube.  It then computes the
texcoords for this from these ray coords.

Robert.

On Wed, Aug 5, 2009 at 7:40 PM, Yvon Halbwachsy...@kalkulo.no wrote:
 Hi,

 I would like to add the computation of the z-depth value in the ray traced
 volume shaders. I'm pretty new to raytracing on gpu, so forgive me if this
 is a naive question!

 I've tried to add this code in the fragment shader, just after the line
 gl_FragColor = color:

      
      gl_FragColor = color;

      vec4 inter = gl_ModelViewProjectionMatrix * vec4(texcoord,1);
      gl_FragDepth = inter.z / inter.w;

      return;
      In theory my idea is to compute the position of the intersection with
 the volume, and use the model view  projection transformation matrix to get
 z buffer value computed. It looks good... but it's not right!

 Does any one have an idea about what I'm doing wrong?

 Thanks for any help,

 Regards,

 Yvon

 ___
 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] Importance Of Node Path List In Database Pager

2009-08-06 Thread Robert Osfield
Hi Ryan,

On Wed, Aug 5, 2009 at 10:36 PM, Kawicki, Ryan
Hryan.h.kawi...@boeing.com wrote:
 I was just curious to see if anything was committed to the 2.9.x / 2.10 
 baselines for this.  I know that you stated that you already had code in 
 place to fix this issue.  Thanks.

I thought I had code in place, but when I reviewed the code it wasn't
there, so my guess is that I probably didn't write it but thought
about it and implemented something simpler to address the particular
problem in hand.  There is no RefNodePath recorded by
DatabasePager::DatabaseRequest right now, so we still have to write
this.

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


Re: [osg-users] OSG and shaders

2009-08-06 Thread Maxime BOUCHER
Hi,


carnibirdy wrote:
 
 For now, I'm still blocked with OSG.
 I want to map the same texture to the 6 faces of a cube.
 
 I made a Geometry called cube and 6 DrawElementsUInt called face1/2/.../6.
 
 I don't know how to setTexCoords to each QUADS.
 I thought about making 6 Geometry so I can use a same vertice several times 
 but I can't find any method able to link them into a cube as a single 
 geometry.
 
 Is there any other solution? 
 

Look at this:
http://faculty.nps.edu/jasullivan/osgtutorials/


carnibirdy wrote:
 
 Maybe I can do it with shaders but with so few experience I can't see the 
 possibilities they bring.
 

It depends on what you want to do.
It seems to me you don't want to do it this way.


Cheers,

Max

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





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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Tanguy Fautre

Hi Robert,

You do have to understand that what is currently happening is an
implicit init/destroyOsg through DllMain. The problem is that DllMain is
full of limitations. Only a handful of kernel functions can be safely
called in DllMain. Worse, Microsoft in all their wisdom does not provide
the list of safe functions.

According to DllMain documentation on MSDN, and due to the fact that
it's an implementation detail, calling any C standard functions in
DllMain is undefined behaviour. Our particular scenario is just one
possible way things can go wrong. MSDN documentation states that an
access violation error is also possible.


I've been thinking last night to try finding a solution to the problem
that is less intrusive on the API than an explicit init/destroyOsg. I
was thinking of using a lazy initialisation on any singleton that
makes a C function call. For example:

static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);

could be replaced by

static Mutex s_mutex;

const char * getSingletonGlExtensionDisable()
{
ScopedLock lock(s_mutex);

static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);

return env;
}


Such a solution guarantees that no C functions is called in DllMain
during DLL loading (note that the Mutex construction is guaranteed to be
safe by MSDN doc). Although, destruction of the singletons still occurs
in DllMain, so it should be checked that the singleton destructors do
not call any C functions.

I'm aware that such a solution does have a performance impact because of
the mutex (the mutex is mandatory to guarantee thread safety). However,
if an object needs to often access a singleton, it can cache the
returned pointer (once an object's got the singleton, it is safe to use
the returned pointer without having to call getSingleton() again and
again, except of course when DllMain is called to unload the DLL).

It's not a perfect solution, but I think it's better than the current
undefined behaviour. What do you think?

Regards,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: 05 August 2009 13:26
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are
evil

Hi Tanguy,

On Wed, Aug 5, 2009 at 12:55 PM, Tanguy
Fautretang...@aristechnologies.com wrote:
 To come back to the deadlock issue, I don't think there is any way to
fix it without breaking the current OSG API compatibility. While I would
favour removing the singletons (and would heavily suggest other designs
for OSG 3.0), I perfectly understand and agree with you that such an
approach is unacceptable in the short term.

Um... I have yet to see a compelling reason for not using singletons
like Registry or a decent proposal for a replacement.   For OSG-3.0 my
plan is to focus on refactoring just the core scene graph and how
rendering is implemented, for the rest of the API changes we should
keep as minimal as possible to try and reduce to headache of porting
from OSG-2.x to OSG-3.x.  We can't avoid refactoring the core scene
graph state management to be able to do shader composition, but the
rest of changes we minimize.

 The least disruptive solution I can think of (while being quite
robust) would be to introduce an initOsg() and a destroyOsg() function.
It's a fairly common approach and is in fact the one mandated by MSDN
regarding the limitations of DllMain (and the deadlocks that may follow
if violated).

My gut reaction is YUK.   Design wise, implementation wise and support
wise I know it's a hack.


 initOsg() would initialize and construct all the global variables of
Osg when called, while destroyOsg() would take care of the destruction
of such objects.

OK. So this uber initOsg() method would need to initialize all global
variables and hence know about all global variance and hence be
tightly coupled with all global variables.  Now if you have a very
simply set of libs to work with, and everything is fixed in it's
relationship this might work, but... if you have a loosely coupled
design that allows you to extend it at runtime what then??  For
instance NodeKits... who inits these?   Do we have explict init's for
each NodeKit the user might use.  What about NodeKits that are pulled
in at runtime to enable the loading of a particular databases?


 The benefits are twofold:
 - The user would have a better control on the lifetime of the OSG and
its global variables (among other things, solving the deadlock issue
exposed in this discussion).
 - The user would have the ability to reset the library in a
predictable manner, which is currently impossible.

 A few points should be observed:
 1. init/destroyOsg needs to be referenced counted (allowing multiple
and re-entrant initializations)
 2. init/destroyOsg needs to be thread-safe
 3. init/destroyOsg needs to be aware that osg is divided into several
components (e.g. osg, osgDB, osgViewer, etc). It would 

Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Daniel Trstenjak

Hi Tanguy,

 static Mutex s_mutex;
 
 const char * getSingletonGlExtensionDisable()
 {
 ScopedLock lock(s_mutex);
 
 static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);
 
 return env;
 }

This doesn't make sense, because 'getenv' is called only once, during
the initialization of the static variable 'env'. After that the
value of 'env' doesn't change, but for every call to
'getSingletonGlExtensionDisable' a lock is used.

If the value of 'OSG_GL_EXTENSION_DISABLE' shouldn't change during
runtime:

static Mutex s_mutex;

const char* getSingletonGlExtensionDisable()
{
   static char* env = 0L;
   if (env == 0L) {
  ScopedLock lock(s_mutex);
  env = getenv(OSG_GL_EXTENSION_DISABLE);
   }

   return env;
}




Greetings,
Daniel


-- 

   
 Daniel Trstenjak Tel   : +49 (0)7071-9457-264
 science + computing ag   FAX   : +49 (0)7071-9457-511
 Hagellocher Weg 73   mailto: daniel.trsten...@science-computing.de
 D-72070 Tübingen WWW   : http://www.science-computing.de/  

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Tanguy Fautre
Hi Daniel,

Your proposed solution looks like a variant of the Double Checked Locking. 
Unfortunately, this design pattern is very subtly broken and not thread safe. 
See http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf for more 
information.

I've however shown this example just to illustrate a more general problem, as 
most of the getenv() are (in)directly called from within class constructors. 
Hence, what we're looking as is something more similar to the following.

static Mutex s_mutex;

Object  getSingletonObject()
{
ScopedLock lock(s_mutex);

static Object object;

return object;
}


Cheers,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Daniel 
Trstenjak
Sent: 06 August 2009 12:24
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are evil


Hi Tanguy,

 static Mutex s_mutex;
 
 const char * getSingletonGlExtensionDisable()
 {
 ScopedLock lock(s_mutex);
 
 static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);
 
 return env;
 }

This doesn't make sense, because 'getenv' is called only once, during
the initialization of the static variable 'env'. After that the
value of 'env' doesn't change, but for every call to
'getSingletonGlExtensionDisable' a lock is used.

If the value of 'OSG_GL_EXTENSION_DISABLE' shouldn't change during
runtime:

static Mutex s_mutex;

const char* getSingletonGlExtensionDisable()
{
   static char* env = 0L;
   if (env == 0L) {
  ScopedLock lock(s_mutex);
  env = getenv(OSG_GL_EXTENSION_DISABLE);
   }

   return env;
}




Greetings,
Daniel


-- 

   
 Daniel Trstenjak Tel   : +49 (0)7071-9457-264
 science + computing ag   FAX   : +49 (0)7071-9457-511
 Hagellocher Weg 73   mailto: daniel.trsten...@science-computing.de
 D-72070 Tübingen WWW   : http://www.science-computing.de/  

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


___
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] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Robert Osfield
Hi Tanguy,

I was wondering about the possibility of wrapping up the access to the
sensitive C functions using a Mutex.  We couldn't do it in local code,
but would need to do it via a single custom getenv() etc. function
implementation, otherwise we'd still end up with multiple functions
potentially accessing standard C functions like getenv in a parallel.

Like Daniel's suggestion of moving the Mutex into the getenv init
avoiding the overuse of the locking the mutex, doing the lock in
central function would also achieve this aim.

So perhaps we co do something like:

static Mutex s_mutex;

const char* serialized_getenv(const char* str)
{
ScopedLock lock(s_mutex);
return getenv(str);
}

void* serialized_otherSensitiveCFunction(...)
{
   ScopedLock lock(s_mutex);
   return otherSensitiveCFunction(...);
 }

Then all the init code would call these methods.  Note the
implementations would all be in the .cpp's.

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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Tanguy Fautre
Hi Robert,

Unfortunately serializing the access to getenv() is not likely to solve
the issue. The problem is not that OSG calls several getenv() in
parallel, the problem is that getenv() should not be called *at all* in
DllMain().

Serializing getenv() in OSG does not guarantee that another C function
will not be called in another thread unrelated to OSG. In fact, this is
exactly what is happening to us.

Wrt to Daniel's suggestion, it's a variant of the double checked
locking, which is unfortunately subtly broken (cf. previous post).


Regards,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: 06 August 2009 12:48
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are
evil

Hi Tanguy,

I was wondering about the possibility of wrapping up the access to the
sensitive C functions using a Mutex.  We couldn't do it in local code,
but would need to do it via a single custom getenv() etc. function
implementation, otherwise we'd still end up with multiple functions
potentially accessing standard C functions like getenv in a parallel.

Like Daniel's suggestion of moving the Mutex into the getenv init
avoiding the overuse of the locking the mutex, doing the lock in
central function would also achieve this aim.

So perhaps we co do something like:

static Mutex s_mutex;

const char* serialized_getenv(const char* str)
{
ScopedLock lock(s_mutex);
return getenv(str);
}

void* serialized_otherSensitiveCFunction(...)
{
   ScopedLock lock(s_mutex);
   return otherSensitiveCFunction(...);
 }

Then all the init code would call these methods.  Note the
implementations would all be in the .cpp's.

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson

On Thu, 06 Aug 2009 10:31:57 +0200, Mach Bhai sar...@dsi.co.ae wrote:


Hi,
I have a model in ive format and osgviewer displays it fine. However if  
i convert it to osg, i get black and white shaded files as textures,  
which are of no use. I am using osgconv.exe with the following command  
line


osgconv.exe -e osg -O OutputTextureFiles -O precision:0.001 model.ive  
model.osg


Try

osgconv.exe -e osg -O OutputTextureFiles precision 4 model.ive model.osg

precision takes an integer
multiple options are space separated

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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Daniel Trstenjak

Hi Tanguy,

 Your proposed solution looks like a variant of the Double Checked
 Locking. Unfortunately, this design pattern is very subtly broken and
 not thread safe. See
 http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf for more
 information.

It depends what you want to make thread safe. If the call to
'getSingletonGlExtensionDisable' should be thread safe, than
you're right. If it's enough to make the call to 'getenv'
thread safe, than the solution should be alright.
 

Greetings,
Daniel

-- 

   
 Daniel Trstenjak Tel   : +49 (0)7071-9457-264
 science + computing ag   FAX   : +49 (0)7071-9457-511
 Hagellocher Weg 73   mailto: daniel.trsten...@science-computing.de
 D-72070 Tübingen WWW   : http://www.science-computing.de/  

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
Thanks but it didnt work. I am still not getting correct textures.

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





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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Robert Osfield
Hi Tanguy,

On Thu, Aug 6, 2009 at 12:53 PM, Tanguy
Fautretang...@aristechnologies.com wrote:
 Unfortunately serializing the access to getenv() is not likely to solve
 the issue. The problem is not that OSG calls several getenv() in
 parallel, the problem is that getenv() should not be called *at all* in
 DllMain().

 Serializing getenv() in OSG does not guarantee that another C function
 will not be called in another thread unrelated to OSG. In fact, this is
 exactly what is happening to us.

OK... but as yet I'm still not clear on why you suggestion avoids the
init.  Is it simple that static's in the global scope are getting
initialized automatically, while ones inside methods are only
initialized on first call... So you've moved the static initializer
into the method...

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson
On Thu, 06 Aug 2009 14:00:15 +0200, Joakim Simonsson joa...@autosim.no  
wrote:



On Thu, 06 Aug 2009 10:31:57 +0200, Mach Bhai sar...@dsi.co.ae wrote:


Hi,
I have a model in ive format and osgviewer displays it fine. However if  
i convert it to osg, i get black and white shaded files as textures,  
which are of no use. I am using osgconv.exe with the following command  
line


osgconv.exe -e osg -O OutputTextureFiles -O precision:0.001 model.ive  
model.osg


Try

osgconv.exe -e osg -O OutputTextureFiles precision 4 model.ive  
model.osg


precision takes an integer
multiple options are space separated


When I try the OutputTextureFiles option, I also get black and white  
striped textures.


What image format do you use? I use .rgb.

If you also use .rgb, perhaps it is something with the .rgb plugin...

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
Yes i am also getting rgb files. It might be that something is wrong with that 
plugin but i cannot verify. Can we specify the format of the texture ?

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson

No, it is not possible.

The current osg implementation looks for the filename extension for the  
texture inside the .ive file.
If the texture originally was an .rgb texture, it will try to write it to  
that format as well.


On Thu, 06 Aug 2009 14:17:43 +0200, Mach Bhai sar...@dsi.co.ae wrote:

Yes i am also getting rgb files. It might be that something is wrong  
with that plugin but i cannot verify. Can we specify the format of the  
texture ?


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





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



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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Tanguy Fautre
Hi Robert,

As you said, doing (2)

const char * getSingletonGlExtensionDisable()
{
ScopedLock lock(s_mutex);
static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);
return env;
}

instead of (1)

static const char * env = getenv(OSG_GL_EXTENSION_DISABLE);

Ensures that the singleton initialization occurs only when the function
getSingletonGlExtensionDisable is called.

The problem is that solution (1) implies that the initialization is done
in DllMain: when osg.dll is loaded, the singleton will be automatically
initialized, which leads to getenv() being called in DllMain.

Solution (2) delays the initialization until the function getSingleton()
is called. If there is no global singleton left (or more precisely, if
there is no global scoped variable initialization code calling
getSingleton()), then you have the guarantee that the singleton will
only be initialized when the user starts explicitly calling osg
functions/classes.

In other words, solution (2) guarantees that DllMain has long been
executed before any singleton initialization occurs. Which is exactly
want we want.

Regards,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: 06 August 2009 13:14
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are
evil

Hi Tanguy,

On Thu, Aug 6, 2009 at 12:53 PM, Tanguy
Fautretang...@aristechnologies.com wrote:
 Unfortunately serializing the access to getenv() is not likely to
solve
 the issue. The problem is not that OSG calls several getenv() in
 parallel, the problem is that getenv() should not be called *at all*
in
 DllMain().

 Serializing getenv() in OSG does not guarantee that another C function
 will not be called in another thread unrelated to OSG. In fact, this
is
 exactly what is happening to us.

OK... but as yet I'm still not clear on why you suggestion avoids the
init.  Is it simple that static's in the global scope are getting
initialized automatically, while ones inside methods are only
initialized on first call... So you've moved the static initializer
into the method...

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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Robert Osfield
Hi Tanguy,

As a first step I've just moved the GLExtension.cpp code that does the
static getenv() into the  osg::getGLExtensionDisableString() method so
it now reads:

std::string osg::getGLExtensionDisableString()
{
static const char* envVar = getenv(OSG_GL_EXTENSION_DISABLE);
static std::string
s_GLExtensionDisableString(envVar?envVar:Nothing defined);

return s_GLExtensionDisableString;
}

This isn't yet thread safe, but since the problem in hand isn't
directly a threading one this should be at least a little step towards
helping solve the problem.  Modified file attached.

Could you try this modification out at your end to see if it is
appropriate step forward.  A quick search shows other places where
there is static getenv in the global scope so I don't expect this one
tweak to be a complete solution, but if it does look like a way
forward then we can start rolling the fix out more generally.

Cheers,
Robert.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/
#include osg/GLExtensions
#include osg/GL
#include osg/GLU
#include osg/Notify
#include osg/Math
#include osg/buffered_value

#include stdlib.h
#include string.h
#include stdio.h
#include float.h

#include string
#include vector
#include set

#if defined(WIN32)
#include windows.h
#endif

typedef std::setstd::string  ExtensionSet;
static osg::buffered_objectExtensionSet s_glExtensionSetList;
static osg::buffered_objectstd::string s_glRendererList;
static osg::buffered_valueint s_glInitializedList;

static osg::buffered_objectExtensionSet s_gluExtensionSetList;
static osg::buffered_objectstd::string s_gluRendererList;
static osg::buffered_valueint s_gluInitializedList;

float osg::getGLVersionNumber()
{
// needs to be extended to do proper things with subversions like 1.5.1, etc.
char *versionstring   = (char*) glGetString( GL_VERSION );
if (!versionstring) return 0.0;

std::string vs( versionstring );
return( asciiToFloat( vs.substr( 0, vs.find(   ) ).c_str() ) );
}

bool osg::isExtensionInExtensionString(const char *extension, const char *extensionString)
{
const char *startOfWord = extensionString;
const char *endOfWord;
while ((endOfWord = strchr(startOfWord,' ')) != 0)
{
if (strncmp(extension, startOfWord, endOfWord - startOfWord) == 0)
return true;
startOfWord = endOfWord+1;
}
if (*startOfWord  strcmp(extension, startOfWord) == 0)
return true;
   
   return false;
}

bool osg::isGLExtensionSupported(unsigned int contextID, const char *extension)
{
return osg::isGLExtensionOrVersionSupported(contextID, extension, FLT_MAX);
}

bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *extension, float requiredGLVersion)
{
ExtensionSet extensionSet = s_glExtensionSetList[contextID];
std::string rendererString = s_glRendererList[contextID];

// first check to see if GL version number of recent enough.
bool result = requiredGLVersion = osg::getGLVersionNumber();

if (!result)
{
// if not already set up, initialize all the per graphic context values.
if (!s_glInitializedList[contextID])
{
s_glInitializedList[contextID] = 1;

// set up the renderer
const GLubyte* renderer = glGetString(GL_RENDERER);
rendererString = renderer ? (const char*)renderer : ;

// get the extension list from OpenGL.
const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
if (extensions==NULL) return false;

// insert the ' ' delimiated extensions words into the extensionSet.
const char *startOfWord = extensions;
const char *endOfWord;
while ((endOfWord = strchr(startOfWord,' '))!=NULL)
{
extensionSet.insert(std::string(startOfWord,endOfWord));
startOfWord = endOfWord+1;
}
if (*startOfWord!=0) extensionSet.insert(std::string(startOfWord));

#if defined(WIN32)

// add WGL extensions to the list

typedef const char* WINAPI WGLGETEXTENSIONSSTRINGARB(HDC);
WGLGETEXTENSIONSSTRINGARB* wglGetExtensionsStringARB = 0;
setGLExtensionFuncPtr(wglGetExtensionsStringARB, wglGetExtensionsStringARB);

typedef const char* WINAPI WGLGETEXTENSIONSSTRINGEXT();

Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
So how can this issue be resolved ?

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson

You are using compressed textures in the ive file, right?

I figured out that the rgb plugin can't write compressed textures.

The only pixel formats that are supported are:


GLenum pixelFormat = img.getPixelFormat();

raw.sizeZ =
pixelFormat == GL_COLOR_INDEX? 1 :
pixelFormat == GL_RED? 1 :
pixelFormat == GL_GREEN? 1 :
pixelFormat == GL_BLUE? 1 :
pixelFormat == GL_ALPHA? 1 :
pixelFormat == GL_RGB? 3 :
pixelFormat == GL_BGR ? 3 :
pixelFormat == GL_RGBA? 4 :
pixelFormat == GL_BGRA? 4 :
pixelFormat == GL_LUMINANCE? 1 :
pixelFormat == GL_LUMINANCE_ALPHA ? 2 : 1;

When an compressed pixelformat (0x83f0) is encountered, it is treated as  
an unknown pixel format. And hence 1 is used for sizeZ...



On Thu, 06 Aug 2009 14:42:03 +0200, Mach Bhai sar...@dsi.co.ae wrote:


So how can this issue be resolved ?


The issue can be solved by extending the rgb plugin, so that it can write  
compressed textures.


OR

Don't compress your textures when you create the ive file...

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


[osg-users] Hello from New Orleans

2009-08-06 Thread Paul MARTZ
OSG BOF was a success. Attendance was light, 65 people, but overall  
conference attendance was down this year.  Traveling today, more later  
including photos.


Paul Martz
Skew Matrix Software
http://www.skew-matrix.com
+1 303 859 9466

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
I will want to go with the first approach and add support for writing 
compressed textures. 
So how can I go about uncompressing this data ? Any clues ?

and thanks for your help.

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





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


Re: [osg-users] Deadlock when loading osg.dll, singletons are evil

2009-08-06 Thread Tanguy Fautre
Hi Robert,

We've got a custom build of OSG where we've commented out all the unsafe
getenv (we do not use env variables in our application anyway).

I'm gonna give your patch a few runs. In theory, it should not deadlock
(considering all the other unsafe getenv are already commented out).


Cheers,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: 06 August 2009 13:28
To: OpenSceneGraph Users
Subject: Re: [osg-users] Deadlock when loading osg.dll, singletons are
evil

Hi Tanguy,

As a first step I've just moved the GLExtension.cpp code that does the
static getenv() into the  osg::getGLExtensionDisableString() method so
it now reads:

std::string osg::getGLExtensionDisableString()
{
static const char* envVar = getenv(OSG_GL_EXTENSION_DISABLE);
static std::string
s_GLExtensionDisableString(envVar?envVar:Nothing defined);

return s_GLExtensionDisableString;
}

This isn't yet thread safe, but since the problem in hand isn't directly
a threading one this should be at least a little step towards helping
solve the problem.  Modified file attached.

Could you try this modification out at your end to see if it is
appropriate step forward.  A quick search shows other places where there
is static getenv in the global scope so I don't expect this one tweak to
be a complete solution, but if it does look like a way forward then we
can start rolling the fix out more generally.

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson

On Thu, 06 Aug 2009 14:55:12 +0200, Mach Bhai sar...@dsi.co.ae wrote:

I will want to go with the first approach and add support for writing  
compressed textures.

So how can I go about uncompressing this data ? Any clues ?


You have to write an S3TC uncompressor.

I have done this in a school project some years ago... If you want I can  
try to dig up that code.




and thanks for your help.



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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
If you can do that, it would be very kind of you.

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Joakim Simonsson

Gotta go now. See what I can do tomorrow.

On Thu, 06 Aug 2009 15:24:40 +0200, Mach Bhai sar...@dsi.co.ae wrote:


If you can do that, it would be very kind of you.


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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
thanks i am looking forward to your help

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Robert Osfield
Hi Mach,

The .dds plugin supports writing compressed textures, so changing the
extension of the images from .rgb to .dds would probably do the trick.

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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
Thanks, i only have the ive files, i dont have the original texture files.

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Mach Bhai
Hi,

After tinkering with the code, i changed the filename to dds in the code and 
then in the resulting osg file also, i changed all references to .dds

Worked like a charm :)

Thanks to all of you.

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread dtidrow
 Hi Mach,

 The .dds plugin supports writing compressed textures, so changing the
 extension of the images from .rgb to .dds would probably do the trick.

 Robert.

I had a similar problem with .ive files containing compressed textures,
but named with .rgb extensions.  I had to do basically what Robert is
suggesting, though I don't recall whether I wrote a visitor to do the
renaming or modded one of the plugins.  As soon as I find the code I'll
post the relevant sections.

Don

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


[osg-users] Z-buffer transparency / Alpha

2009-08-06 Thread Maxime BOUCHER
Hi,

 I know Z-buffer isn't very in fond of transparency, and actually, when I 
capture it on a model having transparent faces it stores strange things (a kind 
of luminance image of some textures on parts corresponding to these 
transparents faces).

 Thus, I tried to deactivate it, but I didn't find how.
I tried all this stuff:

Code:

_root_stateset-setMode(GL_BLEND, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_ALPHA_TEST, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_ALPHA_TEST_FUNC, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_ALPHA_TEST_REF, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_LUMINANCE_ALPHA, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_LUMINANCE, StateAttribute::OFF | 
StateAttribute::OVERRIDE);
_root_stateset-setMode(GL_ALPHA, StateAttribute::OFF | 
StateAttribute::OVERRIDE);



 But, if one of it (ALPHA_TEST), stopped the transparency, my Z-buffer has 
always kept being corrupted.
 Then, my question is, how can I really deactivate the transparency?

 Of course, if you have good ideas to have transparency and a working Z-buffer, 
I would be very pleased :).


Thank you!

Cheers,
Maxime

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





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


[osg-users] osgShadow and nested RTT-cams

2009-08-06 Thread Felix Heide
Hey folks,

i have a problem with using the osgShadow nodekit together with nested 
RTT-Cams. A scenegraph as illustrated in the following image works fine:

[Image: http://img7.imageshack.us/img7/5274/sgwithoutrttcam.png ]

But problems arise, when i use an RTT-Cam to render this scenegraph to an FBO. 
The FBO is used as a texture which is put on a simple quad-geode. The 
quad-geode is then rendered by the Viewers-Camera with orthogonal projection. 
In fact all this stuff is done to apply warping in the fragment shader pass. 
The resulting scenegraph is illustrated in the following figure:

[Image: http://img9.imageshack.us/img9/8421/sgwithrttcam.png ]

The results are strange shadow artifacts. The shadows move with the RTT-Cameras 
viewpoint. In addition sometimes flickering in the shadows can be noticed. 
Except the shadows, the whole scene is rendered as it should be.

At first, i thought it would have something to do with the shadowMap's cam. 
Line 192 in ShadowMap.cpp (osg 2.8.0) is  

Code:
_camera-setReferenceFrame(osg::Camera::ABSOLUTE_RF_INHERIT_VIEWPOINT);



If i understand the Reference Frame concept right, this line makes the 
shadowMaps cam inherit its viewpoint from the viewers cam and not the nested 
rtt-cam, which would be the right one. So i tried to set the Referende Frame to 
ABSOLUTE_RF by accessing the current camera in a cull-callback attached to the 
ShadowScene node. That did not help.

Hope someone has a tip for me.

Cheers,
Felix

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





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


Re: [osg-users] osgconv.exe textures getting mangled

2009-08-06 Thread Chris 'Xenon' Hanson
Joakim Simonsson wrote:
 Gotta go now. See what I can do tomorrow.
 On Thu, 06 Aug 2009 15:24:40 +0200, Mach Bhai sar...@dsi.co.ae wrote:
 If you can do that, it would be very kind of you.

  LibSquish:
http://code.google.com/p/libsquish/

  Supports the DXT1, DXT3 and DXT5 formats for both compression and 
decompression.

  http://en.wikipedia.org/wiki/S3_Texture_Compression

-- 
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] how to draw a Curved Surface on the top of terrain?

2009-08-06 Thread Chris 'Xenon' Hanson
Pan Li wrote:
 I want to draw a curved surface dynamic, like the function Mesure area in 
 skyline.
 now i have the profile line of the curved surface,but just lines,not a 
 polygon or a surface.

  Well, the example you showed is using texturing. I suspect if that's the 
effect you
want, you'll need to take the perimeter data you have, rasterize it into a 2D 
texture
(GDAL can do this for you) and add the texture as a second layer.

-- 
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


[osg-users] Displaysetting CHECKERBOARD

2009-08-06 Thread Katja Oechsner

Hey everyone,

I have a problem with the Displaysetting CHECKERBOARD. I have a dpl-tv with 
stereo glasses and need to use the checkerboard-option for this. I am using 
one window with two channels, one for each eye. The StereoMode is for both 
channels checkerboard, stencil is 8 and the quadbuffer is true. The problem 
is, that I see both views (left and right) on the same channel and nothing 
on the other channel. I used the same configuration with stereomode 
vertical_interlace and it worked fine.
If I set quadbuffer to false, I see the same picture on both channels (no 
stereo separation), but at least there is a picture on both channels.
I think that I just configured something wrong. Which traits-option could be 
wrong? Maybe someone could send me an example, where checkerboard works.


I allready checked the example osgViewerQT and couldn't find any difference.

Thanks in advance
Katja


VISUAL ENGINEERING SOLUTIONS - Wir machen Innovation sichtbar!

_
Katja Kristin Oechsner  |  VISENSO GmbH  | Nobelstr. 15 | D-70569 Stuttgart

Fon Office   ++ 49 - 711 - 849 700 0
Fon Direct   ++ 49 - 711 - 849 700 24
Fax Office   ++ 49 - 711 - 849 700 79

k...@visenso.de | http://www.visenso.de
__
Geschäftsführer: Dr. Andreas Wierse, Martin Zimmermann
Registergericht: Amtsgericht Stuttgart
Registernummer: HRB 720380 


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


Re: [osg-users] glMultiTexCoord4f , OSG with OGL code

2009-08-06 Thread Pau Moreno
Hi,

I saw this mistake before and I correct it but I'm still having the same error. 
With all the shaders :S Any idea?

Thank you!

Cheers,
Pau

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





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


Re: [osg-users] glMultiTexCoord4f , OSG with OGL code

2009-08-06 Thread Pau Moreno
Ok, I finally can solve it with this function:

loadShaderSourceFromFile(...)

No I'm not having errors of compiling shaders, and executing it. Returning to 
the topic of this post: If I comment the MultitexCoord line, nothing is showing 
in the viewer, but that's logic. The problem if is it uncommented ( I need 
theis function so I can pass my parameters to the shader in each vertex I have) 
the application crashes, and I got a Warning:

Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,)

Any Ideas? Thanksss!!

Cheers,
Pau

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





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


Re: [osg-users] OpenSceneGraph-2.8.2 released

2009-08-06 Thread Sukender

MD5 checksums for VC8:


AA3E9C1E092C49F0D1967CD189E22598  
libopenscenegraph-2.8.2-win32-x86-vc80sp1-Debug.zip
AFD1D03805A9C8A77D176C1E21100951  
libopenscenegraph-2.8.2-win32-x86-vc80sp1-Release.zip
F2A9756CC140883639CEF1FF92765BB5  
libopenscenegraph-dev-2.8.2-win32-x86-vc80sp1-Debug.zip
E4CF9E8FA1B62692BAC7710E6E7617B6  
libopenscenegraph-dev-2.8.2-win32-x86-vc80sp1-Release.zip
71EE87AED6D8B85A1985FA03108DFABE  
libopenscenegraph-wrappers-2.8.2-win32-x86-vc80sp1-Debug.zip
9CABA9E674D04B053D7B86876531E7F6  
libopenscenegraph-wrappers-2.8.2-win32-x86-vc80sp1-Release.zip
BC3FE01CD98B038070E98EB0CBE3FF59  
libopenthreads-2.8.2-win32-x86-vc80sp1-Debug.zip
8E0E2201F0322484C9976B71BA9F43AF  
libopenthreads-2.8.2-win32-x86-vc80sp1-Release.zip
1C70B1FAEF8EE2F401B2E7C50F02B855  
libopenthreads-dev-2.8.2-win32-x86-vc80sp1-Debug.zip
348501BED03D7C4BDCF1C3ABC6B81EA0  
libopenthreads-dev-2.8.2-win32-x86-vc80sp1-Release.zip
BC3CBE97DFC002342A09B174688EF6FD  
openscenegraph-2.8.2-win32-x86-vc80sp1-Debug.zip
991D1F3AD64EFC8BC11295705F13EABB  
openscenegraph-2.8.2-win32-x86-vc80sp1-Release.zip
E97296DE41691293160806CD35CDE06A  
openscenegraph-all-2.8.2-win32-x86-vc80sp1-Debug.zip
3EBE7180455C0EF783A69A9321058515  
openscenegraph-all-2.8.2-win32-x86-vc80sp1-Release(2).zip
B04251102E3DEC4F3ECEA95711DAF2B7  
openscenegraph-examples-2.8.2-win32-x86-vc80sp1-Debug.zip
FFFD93785A9C177FE7D4F2D149481606  
openscenegraph-examples-2.8.2-win32-x86-vc80sp1-Release.zip


// Name confilcts with VC9:
30A4E5B5614AD979E615E5EEB5A9C765  openscenegraph-doc-2.8.2.zip



Le Wed, 05 Aug 2009 14:57:15 +0200, Sukender suky0...@free.fr a écrit:


Hi Robert,

Yes, all binaries are ready.
Attached to this message is an archive containing an MD5 for each VC9 file, 
plus one containing all VC9 MD5. However, I can't send you MD5 for VC8 right 
now (and it seems I won't be until a few days).

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Mail d'origine -
De: Robert Osfield robert.osfi...@gmail.com
À: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Envoyé: Wed, 5 Aug 2009 09:57:25 +0200 (CEST)
Objet: Re: [osg-users] OpenSceneGraph-2.8.2 released

Hi Sukender,

Thanks for uploading these.  Are they all ready to upload?

Could you provide the md5sum's and sizes of these files so I can
verify they have been uploaded OK?

Cheers,
Robert.

On Tue, Aug 4, 2009 at 10:11 AM, Sukendersuky0...@free.fr wrote:

Hi Robert,

As expected, I did a mistake when building two VC9 packages (documentation was missing in 
packages named all because I forgot to generate the doc before). Sorry.
Please use openscenegraph-all-2.8.2-win32-x86-vc90-Debug(2).zip and 
openscenegraph-all-2.8.2-win32-x86-vc90-Release(2).zip (instead of the without 
(2) ones). Same thing for openscenegraph-all-2.8.2-win32-x86-vc80sp1-Release(2).zip 
as told in my previous mail.
Upload should be complete in less that 30 min.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Mail d'origine -
De: Sukender suky0...@free.fr
À: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Envoyé: Tue, 4 Aug 2009 07:41:21 +0200 (CEST)
Objet: Re: [osg-users] OpenSceneGraph-2.8.2 released

Hi Robert, hi Jose-Luis, hi all,

I'm uploading VC8sp1 binaries for 2.8.2, as for VC9sp1. However, You'll have to delete 
openscenegraph-all-2.8.2-win32-x86-vc80sp1-Release.zip (which was truncated beacause of 
a transfer termination) and use/rename 
openscenegraph-all-2.8.2-win32-x86-vc80sp1-Release(2).zip instead.

BTW, Jose-Luis and Robert, may packages maintainers have a full read/write 
access to a specific FTP folder, such as one with their name? That would avoid 
such things, as I could have replaced the truncated file. (And I have to check 
something on VC9 binaries I uploaded ; I just hope all went right or I'll have 
to upload renamed files again!)

And a final question: should the site have a link (or text reference) to download a 
doc package on the wiki/Support page? Something like this:
Reference Guides - online reference for OpenSceneGraph API's. Offline documentation 
may be downloaded from one of the precompiled binaries set on the download page.

Cheers,

--
Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Mon, 03 Aug 2009 16:51:57 +0200, suky0...@free.fr a écrit:


Hi Robert, hi all,

Uploading VC9sp1 binaries for 2.8.2 (release  debug - ETA: 3 minutes)... I'll 
try to do the same with VC8sp1 tonight or tomorrow.
Please tell if anything went wrong.
Cheers,

PS: I'll certainly become active again on the mailing list from now :)

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Mail d'origine -
De: Robert Osfield robert.osfi...@gmail.com
À: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Envoyé: Tue, 28 Jul 2009 08:33:04 +0200 (CEST)
Objet: [osg-users] OpenSceneGraph-2.8.2 released

Hi All,

I'm delighted to 

[osg-users] Problems compiling OSG 2.8.2 on Solaris 10

2009-08-06 Thread Rydzak, Carol-P28503
Hi list!  
I have run the commands listed in the readme for osg and this is what I
am getting.  We have the version 7.4.4 version of the Mesa libraries
installed (libGL.so  libGLU.so).  Can someone please help me out with
fixing this problem?  I would expect that anyone running on Solaris
would have come across this problem.  At least I am hoping so!  Thanks
in advance.

Linking CXX executable ../../bin/osgviewer
Undefinedfirst referenced
 symbol in file
sunOglCurPrimTablePtr
/software/ossim/OpenSceneGraph-2.8.2/lib/libosg.so
sunOglCurrentContext
/software/ossim/OpenSceneGraph-2.8.2/lib/libosg.so
ld: fatal: Symbol referencing errors. No output written to
../../bin/osgviewer
collect2: ld returned 1 exit status
make[2]: *** [bin/osgviewer] Error 1
make[1]: ***
[applications/osgviewer/CMakeFiles/application_osgviewer.dir/all] Error
2
make: *** [all] Error 2

Carol Rydzak 

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


[osg-users] osg::Image with signed int

2009-08-06 Thread Pau Moreno
Hi,

I've create an int matrix[16][256] and I need to pass it to the GPU. So what 
I've done is create a osg::Image, but when I have to pass the data to setImage, 
I have to do a cast to my data, because it needs an unsigned char *.

My matrix contains signed ints so I cannot cast it to a unsigned char, as I 
loose information. How can I do it?

Thanks!

Cheers,
Pau

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





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


Re: [osg-users] Vec2ul and isomorphic variants?

2009-08-06 Thread Chris 'Xenon' Hanson
Tomlinson, Gordon wrote:
 Hi Chris
 We for one use vec arrays out side these, it would be nice to have OSG
 support all the typically POD types :).
 It would makes a few thing more straight forward for us

  I started looking at this issue. I can certainly create VecnBlah types out the
ying-yang, but it seems like there should be a way to do this with templates. 
I'm not sure
I'm enough of a template guru to do this properly myself.

  So, two questions:

  1. Robert, are you even in support of refactoring the existing Vec* classes 
into
manifestations of a template if it can be done transparently and cleanly with 
regard to
existing code?

  2. Any template gurus out there want to consult with me on doing this 
properly?


  I'm also looking for a STL expert who knows for_each, mem_fun and bin1st 
better than I
to tell me what I'm doing wrong on a piece of GDAL code related to VPB. But 
that's a
different issue. Anyone who wants to point out my mistake, contact me privately 
and I'll
send you the code snippet that is eluding me.

-- 
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