Re: [osg-users] Using Vertex Attributes

2011-03-26 Thread Fred Smith
There must be something I'm missing.

Below is a repro of my problem. This is a modification of the 
osgvertexattributes sample, from the trunk.

Copy/paste the following code after createSimpleTestModel:


Code:
class MyCallback : public osg::Drawable::ComputeBoundingBoxCallback
{
public:
MyCallback() {}
virtual osg::BoundingBox computeBound(const osg::Drawable drawable) const
{
osg::BoundingBox box(0, 0, 0, 1, 0, 1);
return box;
}
};

osg::Node* createSimpleTestModelATTRIBS()
{
osg::Group* group = new osg::Group;

osg::Geode* geode = new osg::Geode;
group-addChild(geode);

osg::Geometry* geometry = new osg::Geometry;
geometry-setUseDisplayList(false);
geode-addDrawable(geometry);

osg::Vec3Array* vertices = new osg::Vec3Array;
vertices-setName(in_vertex);
vertices-push_back(osg::Vec3(0.0,0.0,0.0));
vertices-push_back(osg::Vec3(0.0,0.0,1.0));
vertices-push_back(osg::Vec3(1.0,0.0,0.0));
vertices-push_back(osg::Vec3(1.0,0.0,1.0));
//geometry-setVertexArray(vertices);
geometry-setVertexAttribArray(6, vertices);
geometry-setVertexAttribNormalize(6, false);
geometry-setVertexAttribBinding(6, osg::Geometry::BIND_PER_VERTEX);

geometry-setComputeBoundingBoxCallback(new MyCallback());

geometry-addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4));

char vertexShaderSource[] = 
#version 150\n
in vec3 in_vertex;\n
uniform mat4 osg_ModelViewProjectionMatrix;\n
   void main(void)\n
   {\n
   gl_Position = osg_ModelViewProjectionMatrix * vec4(in_vertex, 
1.0);\n
   }\n;

char fragmentShaderSource[] = 
#version 150\n
out vec4 out_fragcolor;\n
void main(void)\n
{\n
out_fragcolor = vec4(1.0, 1.0, 0.0, 1.0);\n
}\n;

osg::Program* program = new osg::Program;
program-addShader(new osg::Shader(osg::Shader::VERTEX, 
vertexShaderSource));
program-addShader(new osg::Shader(osg::Shader::FRAGMENT, 
fragmentShaderSource));

program-addBindAttribLocation(std::string(in_vertex), 6);

geometry-getOrCreateStateSet()-setAttribute(program);

return group;
}




Now modify main() so that it reads:


Code:

bool runConvertToVertexAttributes = true; // Note: true here
if (arguments.read(--simple) || arguments.read(--s))
{
loadedModel = createSimpleTestModelATTRIBS(); // change the function 
name
}
   
   // [...]

if (runConvertToVertexAttributes)
{
// switch on the uniforms that track the modelview and projection 
matrices
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
itr != windows.end();
++itr)
{
(*itr)-getState()-setUseModelViewAndProjectionUniforms(true);
// Comment out this line (I don't think I need, so I do not use it)
//(*itr)-getState()-setUseVertexAttributeAliasing(true);
}
}




Result: nothing shows up.
Expected: we should see a square.

Now uncomment the setVertexArray line when building the geometry. You will see 
the square.

Cheers,
Fred

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





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


[osg-users] CMake issue with OpenTheads?

2011-03-26 Thread Philip Taylor
I just tried to regenerate my OSG build system and have come unstuck with an
OpenThreads CMake issue, with the directive

 

IF(NOT ANDROID)

INCLUDE(CheckAtomicOps)

ENDIF()

 

Running CMake 2.8.4 on WinXP with VS2008

Where is the source code: C:/Projects/OSG/OpenSceneGraph/trunk/src

Where to build the binaries: C:/Projects/OSG_build/trunk/bin

 

Is it me??? 

 

I am following the
http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Vi
sualStudio guidance.

 

 

PhilT

 

 

Check for working C compiler using: Visual Studio 9 2008

Check for working C compiler using: Visual Studio 9 2008 -- works

Detecting C compiler ABI info

Detecting C compiler ABI info - done

Check for working CXX compiler using: Visual Studio 9 2008

Check for working CXX compiler using: Visual Studio 9 2008 -- works

Detecting CXX compiler ABI info

Detecting CXX compiler ABI info - done

CMake Error at OpenThreads/CMakeLists.txt:13 (INCLUDE):

include could not find load file:

CheckAtomicOps

CMake Error: File
C:/Projects/OSG/OpenSceneGraph/trunk/src/PlatformSpecifics/Windows/OpenThrea
dsVersionInfo.rc.in does not exist.

CMake Error at OpenThreads/CMakeLists.txt:42 (CONFIGURE_FILE):

configure_file Problem configuring file

Looking for include files CMAKE_HAVE_PTHREAD_H

Looking for include files CMAKE_HAVE_PTHREAD_H - not found.

Found Threads: TRUE 

CMake Error: File
C:/Projects/OSG/OpenSceneGraph/trunk/src/packaging/pkgconfig/openthreads.pc.
in does not exist.

CMake Error at OpenThreads/CMakeLists.txt:119 (CONFIGURE_FILE):

configure_file Problem configuring file

CMake Error at osg/CMakeLists.txt:393 (SETUP_LIBRARY):

Unknown CMake command SETUP_LIBRARY.

CMake Warning (dev) in CMakeLists.txt:

No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower

if you wish to support older CMake versions for this project. For more

information run cmake --help-policy CMP.

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

Configuring incomplete, errors occurred!

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


Re: [osg-users] Interest in new releases of 2.8.x?

2011-03-26 Thread Chris 'Xenon' Hanson
On 3/16/2011 11:27 AM, Chris 'Xenon' Hanson wrote:
 On 3/16/2011 11:21 AM, Robert Osfield wrote:
 I'm all for an 2.8.4 release.
   Excellent.

  Was there anyone else interested in a 2.8.4 release? Is anyone else using 
2.8.3 at this
point or is everyone on trunk now?

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


Re: [osg-users] Interest in new releases of 2.8.x?

2011-03-26 Thread Jean-Sébastien Guay

Hi Chris,


   Was there anyone else interested in a 2.8.4 release? Is anyone else using 
2.8.3 at this
point or is everyone on trunk now?


We're using 2.8.3, but we have no real problem waiting for an eventual 
3.0 or whatever comes. Off the top of my head, there are no fixes that 
we absolutely need. That's why I didn't respond to your questions about 
2.8.3.1 or 2.8.4... And I guess others are probably in the same 
position, given the underwhelming response in this thread.


Sorry...

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


Re: [osg-users] Using Vertex Attributes

2011-03-26 Thread Sergey Polischuk
Hi Fred

You can check if issue is somehow related to bounds calculation by using 
setCullingActive(false) on your node or geometry.

Cheers, Sergey.

26.03.2011, 12:24, Fred Smith osgfo...@tevs.eu:
 There must be something I'm missing.

 Below is a repro of my problem. This is a modification of the 
 osgvertexattributes sample, from the trunk.

 Copy/paste the following code after createSimpleTestModel:

 Code:
 class MyCallback : public osg::Drawable::ComputeBoundingBoxCallback
 {
 public:
 MyCallback() {}
 virtual osg::BoundingBox computeBound(const osg::Drawable drawable) const
 {
 osg::BoundingBox box(0, 0, 0, 1, 0, 1);
 return box;
 }
 };

 osg::Node* createSimpleTestModelATTRIBS()
 {
 osg::Group* group = new osg::Group;

 osg::Geode* geode = new osg::Geode;
 group-addChild(geode);

 osg::Geometry* geometry = new osg::Geometry;
 geometry-setUseDisplayList(false);
 geode-addDrawable(geometry);

 osg::Vec3Array* vertices = new osg::Vec3Array;
 vertices-setName(in_vertex);
 vertices-push_back(osg::Vec3(0.0,0.0,0.0));
 vertices-push_back(osg::Vec3(0.0,0.0,1.0));
 vertices-push_back(osg::Vec3(1.0,0.0,0.0));
 vertices-push_back(osg::Vec3(1.0,0.0,1.0));
 //geometry-setVertexArray(vertices);
 geometry-setVertexAttribArray(6, vertices);
 geometry-setVertexAttribNormalize(6, false);
 geometry-setVertexAttribBinding(6, osg::Geometry::BIND_PER_VERTEX);

 geometry-setComputeBoundingBoxCallback(new MyCallback());

 geometry-addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4));

 char vertexShaderSource[] =
 #version 150\n
 in vec3 in_vertex;\n
 uniform mat4 osg_ModelViewProjectionMatrix;\n
    void main(void)\n
    {\n
        gl_Position = osg_ModelViewProjectionMatrix * vec4(in_vertex, 
 1.0);\n
    }\n;

 char fragmentShaderSource[] =
 #version 150\n
 out vec4 out_fragcolor;\n
 void main(void)\n
 {\n
     out_fragcolor = vec4(1.0, 1.0, 0.0, 1.0);\n
 }\n;

 osg::Program* program = new osg::Program;
 program-addShader(new osg::Shader(osg::Shader::VERTEX, 
 vertexShaderSource));
 program-addShader(new osg::Shader(osg::Shader::FRAGMENT, 
 fragmentShaderSource));

 program-addBindAttribLocation(std::string(in_vertex), 6);

 geometry-getOrCreateStateSet()-setAttribute(program);

 return group;
 }

 Now modify main() so that it reads:

 Code:

 bool runConvertToVertexAttributes = true; // Note: true here
 if (arguments.read(--simple) || arguments.read(--s))
 {
 loadedModel = createSimpleTestModelATTRIBS(); // change the function 
 name
 }

    // [...]

 if (runConvertToVertexAttributes)
 {
 // switch on the uniforms that track the modelview and projection 
 matrices
 osgViewer::Viewer::Windows windows;
 viewer.getWindows(windows);
 for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
 itr != windows.end();
 ++itr)
 {
 (*itr)-getState()-setUseModelViewAndProjectionUniforms(true);
 // Comment out this line (I don't think I need, so I do not use 
 it)
 //(*itr)-getState()-setUseVertexAttributeAliasing(true);
 }
 }

 Result: nothing shows up.
 Expected: we should see a square.

 Now uncomment the setVertexArray line when building the geometry. You will 
 see the square.

 Cheers,
 Fred

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

 ___
 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] Queer Problem: Saved .osg Model and osgViewer showing differences

2011-03-26 Thread Sanat Talmaki
Hi,

I am having a peculiar problem. I am creating a geode and saving it out as a 
.osg file. I am also adding this to the osgViewer to see the results of 
creating the geode. 

However to my surprise, the model looks correct when I see it in my program 
using an instance osgviewer. As seen in this image: [Image: 
http://forum.openscenegraph.org/files/viewerofsamefile_177.jpg ]

But I do not see the same result when I open the saved .osg file through 
osgviewer.exe or load it in a 3rd application later on. As seen in this image: 
[Image: http://forum.openscenegraph.org/files/savednodefile_919.jpg ]

I have attached screen shots of both. I cannot figure out why this would 
happen? Hoping for some help.

Thanks

Sincerely,
Sanat

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




Attachments: 
http://forum.openscenegraph.org//files/savednodefile_919.jpg
http://forum.openscenegraph.org//files/viewerofsamefile_177.jpg


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


Re: [osg-users] Interest in new releases of 2.8.x?

2011-03-26 Thread Chris 'Xenon' Hanson
On 3/26/2011 2:39 PM, Jean-Sébastien Guay wrote:
 We're using 2.8.3, but we have no real problem waiting for an eventual 3.0 or 
 whatever
 comes. Off the top of my head, there are no fixes that we absolutely need. 
 That's why I
 didn't respond to your questions about 2.8.3.1 or 2.8.4... And I guess others 
 are probably
 in the same position, given the underwhelming response in this thread.

  Ok, that's good to know. If folks are happy with 2.8.3, good. If not, we 
should work on
addressing the problem.

 Sorry...
 J-S

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


Re: [osg-users] Queer Problem: Saved .osg Model and osgViewer showing differences

2011-03-26 Thread Paul Martz

Did you try disabling the osgUtil::Optimizer?
  export OSG_OPTIMIZER=OFF (or whatever is appropriate for your shell)
   -Paul


On 3/26/2011 2:57 PM, Sanat Talmaki wrote:

Hi,

I am having a peculiar problem. I am creating a geode and saving it out as a 
.osg file. I am also adding this to the osgViewer to see the results of 
creating the geode.

However to my surprise, the model looks correct when I see it in my program 
using an instance osgviewer. As seen in this image: [Image: 
http://forum.openscenegraph.org/files/viewerofsamefile_177.jpg ]

But I do not see the same result when I open the saved .osg file through 
osgviewer.exe or load it in a 3rd application later on. As seen in this image: 
[Image: http://forum.openscenegraph.org/files/savednodefile_919.jpg ]

I have attached screen shots of both. I cannot figure out why this would 
happen? Hoping for some help.

Thanks

Sincerely,
Sanat

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




Attachments:
http://forum.openscenegraph.org//files/savednodefile_919.jpg
http://forum.openscenegraph.org//files/viewerofsamefile_177.jpg


___
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] Add ancillary data file to an archive

2011-03-26 Thread Eduardo Poyart
Hello,

In my application I need to create a file that consists of essentially an
OSGB file plus ancillary data. I have this ancillary data in either an
external binary file or an in-memory buffer.

I thought I could use osg::Archive to do the archiving and to handle the
OSGB data. If I can write a class that derives from osg::Object (called
something like AncillaryData) and that implements the interfaces to
save/load a memory buffer to an archive, I thought it could fit nicely into
the osg::Archive paradigm. AncillaryData would be able to save/load data
that is opaque to all of OSG and that is handled only by my application.

Would it be a good way to go? Is it better to do it differently? Any
pointers?

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


Re: [osg-users] Queer Problem: Saved .osg Model and osgViewer showing differences

2011-03-26 Thread Sanat Talmaki
Hi Paul,

I set the OPTIMIZER flag to off in my environment variables in windows. But I 
still get the same effect.

What are the other causes potentially, for this ?

Thanks,
Sanat

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





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


[osg-users] Reading a Tiff out of memory?

2011-03-26 Thread Barry
Hopefully a quick question

Under OS X it's easy to get existing images as tiff's

NSImage *theImage = [NSImage imageNamed:@NSExitFullScreenTemplate];
NSData *tiffForm = [theImage TIFFRepresentation];

Where NSExitFullScreenTemplate is a standard system image that the OS manages 
for us.

I've been exploring the osg::Image methods and there doesn't seem to be an easy 
way to set up an osg::Image using tiff data already residing in memory.
Files easy, but I don't see the call for using something already in Ram..

Or am I missing something?

Thanks for any advice.

Barry Evans



Reality is that which, when you stop believing in it, doesn't go away.
--Philip K. Dick

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