Re: [osg-users] need help compiling statically

2020-05-27 Thread OpenSceneGraph Users
For static linking, you’ll almost certainly need to specify ALL dependent libs. 
For example, I see osgText there but no reference to freetype or fontconfig. 
Generally this is where using a build system like CMake has advantages since it 
will know the full list of dependencies.

Generally, if I’m dealing with some library libfoo.a with unknown dependencies, 
I look at the undefined globals and try to infer their source. So 

nm -g —undefined-only libfoo.a | c++filt

and have a look at what is missing.

> On 28/05/2020, at 6:28 AM, OpenSceneGraph Users 
>  wrote:
> 
> So, no ideas?
> 
> On Friday, May 15, 2020 at 4:57:52 AM UTC-3, Rodrigo Dias wrote:
> 
> Now I get that long list of "undefined reference" through many of OSG source 
> files (can paste it here, if you need). I've read somewhere that the order of 
> libraries are important, so I've tried them in the order given by "make":
> 

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


Re: [osg-users] need help compiling statically

2020-05-27 Thread OpenSceneGraph Users
So, no ideas?

On Friday, May 15, 2020 at 4:57:52 AM UTC-3, Rodrigo Dias wrote:
>
> Hi!
>
> My program is working fine in my own machine. I want to test it in a 
> different machine now (both using Debian 10), so I want to compile it 
> statically. For dynamic compiling, I use:
>
> g++ terreno1.cpp -losg -losgDB -losgGA -losgSim -losgText -losgUtil 
> -losgViewer -o terreno1
>
> For static, I learned here  
> that I need to use -Wl,-Bstatic at the beginning of the library list, and 
> -Wl,-Bdynamic at the end. Before that (with only the beginning part), I was 
> getting:
>
> /usr/bin/ld: cannot find -lgcc_s
> /usr/bin/ld: cannot find -lgcc_s
> collect2: error: ld returned 1 exit status
>
> Now I get that long list of "undefined reference" through many of OSG 
> source files (can paste it here, if you need). I've read somewhere that the 
> order of libraries are important, so I've tried them in the order given by 
> "make":
>
> g++ terreno1.cpp -Wl,-Bstatic -lOpenThreads -losg -losgUtil -losgDB 
> -losgGA -losgText -losgViewer -losgSim -Wl,-Bdynamic -o terreno1
>
> and also in the reversed order:
>
> g++ terreno1.cpp -Wl,-Bstatic -losgSim -losgViewer -losgText -losgGA 
> -losgDB -losgUtil -losg -lOpenThreads -Wl,-Bdynamic -o terreno1
>
> both with and without -lOpenThreads (which is not required for dynamic 
> compiling). Nothing worked so far.
>
> Can anyone please tell me what am I doing wrong? My source code can be 
> seen here 
> .
>
> Thanks,
>
> Rodrigo.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/34b5f20c-6396-4e3f-b6df-f4e135b98ee2%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Need Help

2017-12-07 Thread michael kapelko
Hi. What do you want to achieve?

On 7 December 2017 at 05:44, Mr.lv  wrote:
> I meet a question , how can i get exactly  pointArray of
> osgUtil::PolytopeIntersector::Intersection?
>
>  osg::ref_ptr picker = new
> osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, mx - w, my - h,
> mx + w, my + h);
>  osgUtil::IntersectionVisitor iv(picker);
>
>  getViewer()->getCamera()->accept(iv);
>
>  if (picker->containsIntersections())
>  {
>   osgUtil::PolytopeIntersector::Intersection intersection =
> picker->getFirstIntersection();
>
>   osg::Drawable* dr = intersection.drawable;
>
>   osg::Vec3Array* vArray =
> (osg::Vec3Array*)dr->asGeometry()->getVertexArray();
>
>   osg::Geode* geode = createLineByLocal(vArray);
>   if (!geode)return;
>   osg::Node* node = getWorldNode(geode);
>   if (!node)return;
>   add2TempLyr(node);
> }
>
> what i got was wrong ,  who can helo me? thank you very much!
>
> ___
> 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] need help

2017-03-02 Thread Trajce Nikolov NICK
Hi,

have a look at the osggeometry example. Probably you will need to have a
quad with the tiff image on it and you can then draw a line

On Thu, Mar 2, 2017 at 9:57 AM, Venky Balu 
wrote:

> HI ,
> i am new to OSG i have to develop an application that contain tiff image
> on that image i have to draw line .
> but i am not able to draw line on image.
> could you please suggest me how to solve this.
>
> Regards,
> venkat
> 9840564652
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


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


Re: [osg-users] Need Help regarding Camera Manipulator for simulation of Micro Air Vehicle

2013-07-31 Thread Chris Hanson
It would all depend on what you're filling in as the setViewMatrixAsLookAt
arguments. Explain how you're calling it.


On Thu, Jul 25, 2013 at 5:52 AM, Alexander Kale wrote:

> Hi,
>
> This is Alex. I am working on a project for simulation of Micro Air
> Vehicle. My application is to have the camera or viewer fixed at some
> location say runway and should track the MAV flying by adjusting it's view
> angle and area. I tried to use the setViewMatrixAsLookAt function, but the
> camera is following the MAV as it is moving. The position and attitude data
> I will feed from the simulink model in realtime.
>  Can anybody suggest me the best way to implement this.
>
> ...
>
> Thank you!
>
> Cheers,
> Alexander
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=55440#55440
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography
• Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS •
Android
@alphapixel  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Need help with switching between manual and automatic camera movement

2013-04-18 Thread Martin Záleta
Hi,

I guess I kinda forgot to describe my problem in detail. In part it was because 
I was hoping, that someone would suggest me a better solution to this problem, 
since registering viewer handle in a keyboard event handler doesn't really seem 
to me like much of a good solution, but it was the best I could come up with.

Anyway, what you wrote has helped me resolve the issue I had, so at least it's 
working somehow.

Thank you!

Cheers,
Martin

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





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


Re: [osg-users] Need help with switching between manual and automatic camera movement

2013-04-18 Thread Trajce Nikolov NICK
Hi Martin,

what are you experiencing, where you see the problems? It is sort of not
stated in your email. in your first code snipped in the update I would do
this to have the matrices in the world space:

Matrixd oldMatrix = cam->getInverseViewMatrix();

.
.
 cam->setViewMatrix(osg::Matrixd::inverse(newMatrix));


This should setup your matrices correctly. Also once the matrixes are in
world space then you can easelly transition from automatic to manual state
by setting the camera manipulator by matrix. I think when you add and
remove camera manipulators, it goes to your home position of the
manipulator (see CameraManipulator::setHomePosition), so you have to take
into account this as well. If you want to spin it around between two
rotations try using quaternions (from the matrix, it is getRotate()) and
slerp (quaternion method) between two different orientation. These above is
just guessing since you havn't stated your problem. Maybe the best would be
if you put your whole code into sample and post it here, someone might have
time to look and help

Nick


On Thu, Apr 18, 2013 at 6:53 PM, Martin Záleta  wrote:

> Hi,
>
> In my OSG application, I am trying to implement a functionality, that
> would allow me to switch between usual manual movement and an automatic one
> (such as spinning on spot), but I haven't had any success yet.
>
> My last attempt was to set an update callback to the camera, that would
> spin it around, such as this:
>
>
> Code:
> void CameraCallback::operator()(Node* node, NodeVisitor* nv)
> {
> Camera * cam = static_cast(node);
>
> if(cam && Settings::Instantiate()->getCameraMode() ==
> CAMERA_ROTATE)
> {
> Matrixd oldMatrix = cam->getViewMatrix();
>
> Matrixd cameraRotation;
> cameraRotation.makeRotate(oldMatrix.getRotate());
> cameraRotation.rotate(DegreesToRadians(5.0), 0, 0, 1);
>
> Matrixd cameraTrans;
> cameraTrans.makeTranslate(oldMatrix.getTrans());
>
> Matrixd newMatrix = cameraRotation * cameraTrans;
> cam->setViewMatrix(newMatrix);
> }
>
> traverse(node, nv);
> }
>
>
>
> ... and then I had the viewer object registered by the class that handles
> keyboard events and tried to update it accordingly:
>
>
> Code:
> void registerViewer(Viewer* v)  { viewer = v; man =
> viewer->getCameraManipulator(); }
>
> bool KeyboardEventHandler::handle(const GUIEventAdapter& ea,
> GUIActionAdapter& aa)
> {
> ...
> case 'n':
> case 'N':
> Settings::Instantiate()->ToggleCamera();
>
> if(Settings::Instantiate()->getCameraMode() == CAMERA_MANUAL)
> {
> viewer->setCameraManipulator(man);
> viewer->getCamera()->setAllowEventFocus(true);
> }
> else
> {
> viewer->setCameraManipulator(NULL);
> viewer->getCamera()->setAllowEventFocus(false);
> }
>
> break;
> ...
> }
>
>
>
> Hopefully these snippets are enough for someone to explain me, what I am
> doing wrong and how to do it the right way.
>
> Thank you!
>
> Cheers,
> Martin
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53691#53691
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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


Re: [osg-users] Need help fixing my atmospheric transmission shader, it's so close to working!

2012-01-30 Thread Sergey Polischuk
Only your terrain have texture and for your trees - function call 
texture2D(baseTexture, gl_TexCoord[0].st) return black (0,0,0,1). Your trees 
have per-vertex color attribute, and your ground dont(?) (i dont know to what 
value it defaults). Simplest options to fix this - set 1x1 white texture to 
your trees or add color array to ground (with black color values) and use 
texture2D(baseTexture, gl_TexCoord[0].st) + gl_Color, or write different 
shaders (one version with texture, one without). If gl_Color defaults to black 
without color array, you can use vec4 color = texture2D(baseTexture, 
gl_TexCoord[0].st) + gl_Color; without any changes.

30.01.2012, 17:30, "Ethan Fahy" :
> I should have mentioned before that only the red channel is of any 
> importance; There is a viewer further down the pipeline that picks up the red 
> channel values from the framebuffer so the green and blue channels don't 
> matter at all.  I just set the green and blue channels to the red channel in 
> case I ever want to use a different viewer and see things in grey-scale.
>
> I tried to do a bit of research on GLSL texture binding but am very confused 
> by it and not sure what I could change about my shader to fix binding issues.
>
> I tried using this line:
>
> Code:
> vec4 color = texture2D(baseTexture, gl_TexCoord[0].st) + gl_Color;
>
> thinking that by adding the texture color to the tree colors I might get the 
> correct result.  This actually makes me see both the terrain texture and the 
> tree colors.  This may then be the correct solution, but I'm not sure if it 
> is really doing what I think it's doing...
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=45118#45118
>
> ___
> 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] Need help fixing my atmospheric transmission shader, it's so close to working!

2012-01-30 Thread Ethan Fahy
I should have mentioned before that only the red channel is of any importance; 
There is a viewer further down the pipeline that picks up the red channel 
values from the framebuffer so the green and blue channels don't matter at all. 
 I just set the green and blue channels to the red channel in case I ever want 
to use a different viewer and see things in grey-scale.

I tried to do a bit of research on GLSL texture binding but am very confused by 
it and not sure what I could change about my shader to fix binding issues.

I tried using this line:

Code:
vec4 color = texture2D(baseTexture, gl_TexCoord[0].st) + gl_Color;


thinking that by adding the texture color to the tree colors I might get the 
correct result.  This actually makes me see both the terrain texture and the 
tree colors.  This may then be the correct solution, but I'm not sure if it is 
really doing what I think it's doing...

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





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


Re: [osg-users] Need help fixing my atmospheric transmission shader, it's so close to working!

2012-01-28 Thread Sergey Polischuk
Hi

this piece completely eliminate any green and blue values of original color, if 
you trees dont have red color component they will look black.
> color.r = color.r * exp( -1.0 * ExtinctionCoefficient * eyeDistance );
> color.g = color.r;
> color.b = color.r;

Sampling texture when it not currently bound iirc should return (0,0,0,1), here 
you get your black color (also this could cause crash on some drivers).

27.01.2012, 23:19, "Ethan Fahy" :
> My scene contains virtualplanetbuilder-generated terrain that has a texture 
> wrapped on it along with surface objects such as trees that I generated by 
> creating osg primitives and coloring them "PER_VERTEX" without using any 
> textures.
>
> I have written an atmospheric transmission shader that decreases the r,g and 
> b values as a function of distance from the viewer to the object.  However, I 
> can't seem to get the shader to work properly on both the terrain and trees 
> at the same time.  Here is the code:
>
> Vertex Shader:
>
> Code:
> varying float eyeDistance;
> void main(void)
> {
> gl_TexCoord[0] = gl_MultiTexCoord0;
> gl_FrontColor = gl_Color;
> eyeDistance = length(gl_ModelViewMatrix * gl_Vertex);
> gl_Position = ftransform();
> }
>
> Fragment Shader:
>
> Code:
> uniform float ExtinctionCoefficient;
> uniform sampler2D baseTexture;
> varying float eyeDistance;
> void main(void)
> {
> vec4 color = texture2D(baseTexture, gl_TexCoord[0].st);
> color.r = color.r * exp( -1.0 * ExtinctionCoefficient * eyeDistance );
> color.g = color.r;
> color.b = color.r;
> gl_FragColor = color;
> }
>
> The above shader pair will successfully make the terrain darker in color as I 
> zoom out, but the trees all look completely black no matter what, even if 
> they originally had varying colors without the shader.
>
> If instead of setting "color" in the frag shader to texture2D() I instead set 
> it equal to "gl_Color", the shader then works on all the objects in the scene 
> but I no longer see any remnants of the underlying terrain texture.  Based on 
> this page 
> http://stackoverflow.com/questions/2552676/change-the-color-of-a-vertex-in-a-vertex-shader
>  I would have expected that setting color = texture2D(baseTexture, 
> gl_TexCoord[0].st) * gl_Color would have produced the result I was looking 
> for, but instead the result is identical to if I leave out * gl_Color.
>
> I think my shader code is very close to being correct and just needs a nudge 
> in the right direction.  Anyone?
>
> Thanks very much in advance.
>
> -Ethan
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=45086#45086
>
> ___
> 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] [Need Help] Entire 3d environment needs to be bump mapped.

2011-07-14 Thread Smelik, R.M. (Ruben)
Dear Zach,

The older post are right. For bump-mapping, you'll need two things: a bump 
mapping shader and a normal map texture for each of the objects you'd like to 
bump map (assigned to a different texture unit than your diffuse texture, e.g. 
unit 1). 

The good thing of the scene graph concept is that you create a hierarchy of 
objects. If every object in your scene indeed has a bump map texture assigned 
to it, you can just attach your bump map shader to the state set of the root 
(i.e. topmost) node of your scenegraph. Objects in the hierarchy will inherit 
this shader. The same goes for the required uniforms (e.g. the uniform that 
maps the texture2D sampler name in your shader to the OpenGL texture unit the 
bump is assigned to).

Hope that helps,

Ruben


From: osg-users-boun...@lists.openscenegraph.org 
[osg-users-boun...@lists.openscenegraph.org] on behalf of Zach Lenker 
[zach.len...@vrsim.net]
Sent: Thursday, July 14, 2011 12:12 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] [Need Help] Entire 3d environment needs to be bump mapped.

Hi,

The subject sums up what my basic goal is. We have a 3D environment that has 
roughly 50+ objects inside of it. Each object needs to have bump mapping 
applied to it. My confusion comes in at the part where we are applying the bump 
mapping to each object though OSG.

I have done a few hours of searching these forums and Google and haven't really 
found anything concrete to go on. Anything that I found relating to this issue 
was a year old (or more). Those posts were saying that in OSG I would have to 
write a bump mapping shader and apply it to the model. Those posts also seemed 
to be targeted toward getting a single (or a few) object(s) to be bump mapped. 
Is that still the only approach? If so how do I go about applying the bump 
shader to each individual object within the single environment file?

Currently using OSG 2.6, we are not bound to any file type constraints (we are 
currently using ".IVE" for the environment file).

I tried my best to put any information that would be needed, but if you need 
more information or more clarity, please let me know.

Thank you!

Cheers,
Zach

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
This e-mail and its contents are subject to the DISCLAIMER at 
http://www.tno.nl/emaildisclaimer

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


Re: [osg-users] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread Frederic Bouvier
Hi Laith,

OSG defines the osg_ViewMatrixInverse uniform. You have to add

uniform mat4 osg_ViewMatrixInverse;

in your shader to use it and find the camera location in world coordinates.

Otherwise, there is the gl_ModelViewMatrixInverse uniform if you want to 
transform the camera position from eye coordinates (0,0,0) into local
object coordinates.

Regards,
-Fred

- "Robert Osfield"  a écrit :

> Hi Laith,
> 
> In OpenGL the camera position is always at 0,0,0, and the scene is
> transformed into cameras coordinates by the modelview matrix.
> 
> So... one has to ask are you wanting to do calculations in the
> eye/camera coordinates, world coordinates or local object
> coordinates?
>  You can transform the camera position into world or local object
> coordinates by multipling by the inverse of the view or modelview
> matrices respectively.
> 
> Robert.
> 
> On Thu, Jan 13, 2011 at 6:34 AM, Laith Dhawahir
>  wrote:
> > Heey Guys,
> > I hope you will fine,
> > anyway, i have question about how i can get the camera position
> inside shader from open scene graph do i must pass it, or open scene
> graph already do that.
> >
> > Thank you!
> >
> > Cheers,
> > Laith
> >
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=35600#35600
> >
> >
> >
> >
> >
> > ___
> > 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] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread Robert Osfield
Hi Laith,

In OpenGL the camera position is always at 0,0,0, and the scene is
transformed into cameras coordinates by the modelview matrix.

So... one has to ask are you wanting to do calculations in the
eye/camera coordinates, world coordinates or local object coordinates?
 You can transform the camera position into world or local object
coordinates by multipling by the inverse of the view or modelview
matrices respectively.

Robert.

On Thu, Jan 13, 2011 at 6:34 AM, Laith Dhawahir
 wrote:
> Heey Guys,
> I hope you will fine,
> anyway, i have question about how i can get the camera position inside shader 
> from open scene graph do i must pass it, or open scene graph already do that.
>
> Thank you!
>
> Cheers,
> Laith
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=35600#35600
>
>
>
>
>
> ___
> 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] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread David Callu
Hi Lait,

If you want the camera position in world coordinate, you have to pass it
yourself.
OSG, like OpenGL only work in Eye Coordinate inside the shader.

HTH
David Callu


2011/1/13 Laith Dhawahir 

> Heey Guys,
> I hope you will fine,
> anyway, i have question about how i can get the camera position inside
> shader from open scene graph do i must pass it, or open scene graph already
> do that.
>
> Thank you!
>
> Cheers,
> Laith
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=35600#35600
>
>
>
>
>
> ___
> 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] Need Help ! Open Scene Graph For IPhone Shaders Issues

2010-12-23 Thread Laith Dhawahir
Heey,
Thanks all for trying to help me, i solved the problem. and i succesfully run 
the following code 

Code:

#import "iphoneViewerAppDelegate.h"

#include 
#include 
#include  
#include 
#include 
#include 
#include 
#include 
#include  
#include 
#include 
#include 
#include 
#include 
#include 

#define kAccelerometerFrequency30.0 // Hz
#define kFilteringFactor0.1


#define SHADER_COMPAT \
"#ifndef GL_ES\n" \
"#if (__VERSION__ <= 110)\n" \
"#define lowp\n" \
"#define mediump\n" \
"#define highp\n" \
"#endif\n" \
"#endif\n"

static const char* vertSource = {
SHADER_COMPAT
"// colors a fragment based on its position\n"
"varying mediump vec4 color;\n"
"void main(void) {\n"
"color = gl_Vertex;\n"
"gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
"}\n"
};

static const char* fragSource = {
SHADER_COMPAT
"varying mediump vec4 color;\n"
"void main(void) {\n"
"gl_FragColor = clamp( color, 0.0, 1.0 );\n"
"}\n"
};


@implementation iphoneViewerAppDelegate
@synthesize _window;
//
//Called once app has finished launching, create the viewer then realize. Can't 
call viewer->run as will 
//block the final inialization of the windowing system
//
- (void)applicationDidFinishLaunching:(UIApplication *)application {

//get the screen size
CGRect lFrame = [[UIScreen mainScreen] bounds];
unsigned int w = lFrame.size.width;
unsigned int h = lFrame.size.height;

// create the main window at screen size
self._window = [[UIWindow alloc] initWithFrame: lFrame]; 

//show window
[_window makeKeyAndVisible];

//create our graphics context directly so we can pass our own window 
osg::ref_ptr traits = new 
osg::GraphicsContext::Traits;

// Init the Windata Variable that holds the handle for the Window to 
display OSG in.
osg::ref_ptr windata = new 
osgViewer::GraphicsWindowIOS::WindowData(_window);

// Setup the traits parameters
traits->x = 0;
traits->y = 0;
traits->width = w;
traits->height = h;
traits->depth = 16; //keep memory down, default is currently 24
traits->red = 33;
traits->blue = 66;
traits->green = 99;
traits->windowDecoration = true;//false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->windowName = "osgViewer";

traits->inheritedWindowData = windata;

// Create the Graphics Context
osg::ref_ptr graphicsContext = 
osg::GraphicsContext::createGraphicsContext(traits.get());

graphicsContext->clear();


//create the viewer
viewer = new osgViewer::Viewer();

//if the context was created then attach to our viewer
if(graphicsContext)
{
viewer->getCamera()->setGraphicsContext(graphicsContext);

double w = traits->width;
double h = traits->height;

if(wgetCamera()->setViewport(new osg::Viewport(0, 0, w ,  h 
));
//  
viewer->getCamera()->setProjectionMatrixAsFrustum(-5,5,-5,5,1e-6,100);
//  
viewer->getCamera()->setProjectionMatrixAsPerspective(30,traits->width/traits->height);

}

osg::setNotifyLevel(osg::INFO);

root = new osg::MatrixTransform();

osg::Geode* geode = new osg::Geode();
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new 
osg::Box(osg::Vec3(1, 1, 1), 1));

geode->addDrawable(drawable);

osg::Program* program = new osg::Program;
program->setName("shader");
program->addShader(new osg::Shader(osg::Shader::VERTEX, vertSource));
program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragSource));
geode->getOrCreateStateSet()->setAttributeAndModes(program, 
osg::StateAttribute::ON);

root->addChild(geode);

//viewer = new osgViewer::Viewer();

//viewer->setUpViewInWindow(100, 100, 800, 600, 0);

viewer->setSceneData(root.get());
viewer->setCameraManipulator(new osgGA::TrackballManipulator);

viewer->realize();

/*  
//if the context was created then attach to our viewer
if(graphicsContext)
{
viewer->getCamera()->setGraphicsContext(graphicsContext);
//viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 
traits->width, traits->height));
}


osg::setNotifyLevel(osg::DEBUG_FP);

root = new osg::MatrixTransform();

osg::Geode* geode = new osg::Geode();
osg::ShapeDrawable* drawable = new osg::ShapeDrawable( new 
osg::Box(osg::Vec3(0,1,1),1));

drawable->setColor(osg::Vec4(1.0f,0.0f,1.0f,0.5f));
drawable->getOrCreateStateSet();
geode->a

Re: [osg-users] Need Help ! Open Scene Graph For IPhone Shaders Issues

2010-12-22 Thread Ulrich Hertlein
Hi,

On 23/12/10 0:23 , Laith Dhawahir wrote:
> Code:
> 
>   //if the context was created then attach to our viewer
> if(graphicsContext)
> {
> viewer->getCamera()->setGraphicsContext(graphicsContext);
> //viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 
> traits->width, traits->height));
>   }
>   
>   osg::setNotifyLevel(osg::DEBUG_FP);
>   
>   root = new osg::MatrixTransform();
>   
>   osg::Geode* geode = new osg::Geode();
>   osg::ShapeDrawable* drawable = new osg::ShapeDrawable( new 
> osg::Box(osg::Vec3(0,1,1),1));
>   
>   drawable->setColor(osg::Vec4(1.0f,0.0f,1.0f,0.5f));
>   drawable->getOrCreateStateSet();
>   geode->addDrawable(drawable);
>   
>   root->addChild(geode);*/
>   
>   viewer->setSceneData(root.get());
> viewer->setCameraManipulator(new osgGA::TrackballManipulator);
> viewer->realize();

Since this is just a code fragment it's hard/impossible to get an overall 
picture.
For example, the line 'root->addChild(geode)' has a closing comment on it, 
which could
mean that the entire block you've sent is commented.

Certainly *not* adding the geode to the scene root would explain why you're not 
seeing
anything.

Why don't you post the entire setup function to save us from guessing?

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


Re: [osg-users] Need Help ! Open Scene Graph For IPhone Shaders Issues

2010-12-22 Thread Laith Dhawahir
Hey Eric,
Thanks for replay to me :).

actually sorry i use them in the code, but it seem i miss to write them
anyway.. here is the code i use currently:


Code:

//if the context was created then attach to our viewer
if(graphicsContext)
{
viewer->getCamera()->setGraphicsContext(graphicsContext);
//viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 
traits->width, traits->height));
}


osg::setNotifyLevel(osg::DEBUG_FP);

root = new osg::MatrixTransform();

osg::Geode* geode = new osg::Geode();
osg::ShapeDrawable* drawable = new osg::ShapeDrawable( new 
osg::Box(osg::Vec3(0,1,1),1));

drawable->setColor(osg::Vec4(1.0f,0.0f,1.0f,0.5f));
drawable->getOrCreateStateSet();
geode->addDrawable(drawable);

root->addChild(geode);*/

viewer->setSceneData(root.get());
viewer->setCameraManipulator(new osgGA::TrackballManipulator);
viewer->realize();  




yes i use realize and setCameraManipulator

... 

Thank you!

Cheers,
Laith[/code]

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





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


Re: [osg-users] Need Help ! Open Scene Graph For IPhone Shaders Issues

2010-12-22 Thread Eric Zaremba
Hi,

First, I don't see any call to realize();
Second, do you set any camera manipulator or position to look at your box?

Eric

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





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


Re: [osg-users] Need help about Night Vision Effect

2010-12-06 Thread Ragnar Hammarqvist
I did a IR scene by making my own cull visitor. In order to make this efficient 
I had to put a virtual in front off osgUtil::CullVisitor::pushStateSet().

My cull visitor look like this

class SpectrumCullVisitor : public osgUtil::CullVisitor
{
public:
SpectrumCullVisitor()
{};

SpectrumCullVisitor(MapCullSpectrumCallBack* spectrumCallBack)
{
_Callback = spectrumCallBack;
};
virtual ~SpectrumCullVisitor()
{};

//! Get Cull Map Callback
MapCullSpectrumCallBack* Callback() const { return _Callback.get(); }
//! Set Cull Map Callback
void Callback(MapCullSpectrumCallBack* val) { _Callback = val; }

protected:
//! Try to find alternative stat set if this fails push the stat set 
delivered from the graph
void pushStateSet(const osg::StateSet* ss)
{
const osg::StateSet* pushSS = NULL;
if (_Callback.get())
{
//Look if there is a alternative stat set
pushSS = _Callback->GetMapedStateSet(ss);
if (pushSS)
{
//Alternative found using it in base function
CullVisitor::pushStateSet(pushSS);
}
else
{
//No alternative found cal bas function without 
switching
CullVisitor::pushStateSet(ss);
}
}
else
{
//No Callback cal base without switching
CullVisitor::pushStateSet(ss);
}
};
private:
osg::ref_ptr _Callback;
};


And the callback like this:

class MapCullSpectrumCallBack : public osg::Referenced
{
public:
MapCullSpectrumCallBack(const std::string& spectrum):
_spectrum(spectrum)
{};
virtual ~MapCullSpectrumCallBack(){};

const osg::StateSet* GetMapedStateSet( const osg::StateSet* ss ) const;
bool InsertModifiedStatsetIfChanged(const osg::StateSet* ss);

int CleanUp();

protected:
osg::ref_ptr CreateStatsetAlternative(const 
osg::StateSet* ss);
std::string _spectrum;
bool SwitchToSpectrumTextures( osg::StateSet* ss );
bool SwitchToSpectrumShader( osg::StateSet* ss );

std::string getFileSpectrumName( std::string name );
typedef std::map,osg::ref_ptr> StateMap;
StateMap _StateMap;
};

You then have to populate the map in the callback with statset with alternative 
textures(IR).

Regars Ragnar
 

-Ursprungligt meddelande-
Från: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] För Steven Powers
Skickat: den 2 december 2010 21:12
Till: osg-users@lists.openscenegraph.org
Ämne: Re: [osg-users] Need help about Night Vision Effect

The easy/cheating way is to calculate the luminance of each pixel, amplify it, 
(color it green to fit the stereotype) then add electric noise.

This is easiest to do on a fragment shader.

Cheers,
Steven

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





___
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] Need help about Night Vision Effect

2010-12-02 Thread Steven Powers
The easy/cheating way is to calculate the luminance of each pixel, amplify it, 
(color it green to fit the stereotype) then add electric noise.

This is easiest to do on a fragment shader.

Cheers,
Steven

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





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


Re: [osg-users] Need help about Night Vision Effect

2010-11-28 Thread Chris 'Xenon' Hanson
On 11/26/2010 11:10 PM, Abdur Rahman wrote:
> Hi,
> I'm working in Delta3D and need to implement night vision effect for my T59 
> tank simulator.I've a little bit of knowledge over it and I think it can be 
> possible by implementing some post filters or shader effects on camera.But I 
> cant find any particular way to implement the effect. If anybody give me some 
> solution or suggestion to implement night vision effect using OSG it will be 
> a great help for me..  

  First question would be -- what exactly do you define "Night Vision Effect" 
as?
Infrared? Image intensifier?

  IR requires emissive properties on your models and a shader to utilize them. 
Image
intensifier just requires weak direct and ambient light sources, and a shader to
monochromize them and add a lot of noise.

http://upload.wikimedia.org/wikipedia/commons/c/c3/Gen1C-2-Comparison.jpg

-- 
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] Need help about Night Vision Effect

2010-11-28 Thread Gordon Tomlinson
Look at
http://www.geeks3d.com/20091009/shader-library-night-vision-post-processing-
filter-glsl/  for inspiration it shoes a possible solution that could be
adapted 

We did our NVG with post processing and Shaders in our 3d OSG based Pro
module http://www.overwatch.com/pdfs/remoteview/RV%203DPro1.pdf

Note this is faux ... as there is no radiometric/emissive etc  properties of
the pixels/surface materials  taken into account ( as there are none for us
as this time, at some point we will upgrade when we get this type of data )



__
Gordon Tomlinson 

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

__

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Abdur
Rahman
Sent: Saturday, November 27, 2010 1:10 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Need help about Night Vision Effect

Hi,
I'm working in Delta3D and need to implement night vision effect for my T59
tank simulator.I've a little bit of knowledge over it and I think it can be
possible by implementing some post filters or shader effects on camera.But I
cant find any particular way to implement the effect. If anybody give me
some solution or suggestion to implement night vision effect using OSG it
will be a great help for me..  
... 

Thanks in advance..

Cheers,
Abdur Rahman

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





___
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] Need help about key mapping (introspection)

2010-10-17 Thread Sukender
Many thanks Wang. I'll do that.. because having to carry the burden of wrappers 
(I mean compile+integrate) is too much for me :)

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

- Wang Rui  a écrit :
> Hi Sukender,
> 
> Serializers are only used for serialization IO of native formats
> (osgt/osgb/osgx) at present. If you mean to bind enum values to texts for
> reading/writing from files, the macros
> BEGIN_ENUM_SERIALIZER, END_ENUM_SERIALIZER and ADD_ENUM_VALUE can work and
> there are plenty of examples in the wrappers/serializers folder.
> 
> Cheers,
> 
> Wang Rui
> 
> 
> 2010/10/17 Sukender 
> 
> > Hi all,
> >
> > I used to make a keyboard mapping using introspection in previous versions
> > of OSG, but I'm a bit lost with new wrappers/serializers/whatever. Can
> > anyone tell me how to make a link between a key/mouse button textual
> > representation (ex: KEY_space, KEY_minus), and its value, so that users can
> > have an key mapping file?
> > 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


Re: [osg-users] Need help about key mapping (introspection)

2010-10-17 Thread Wang Rui
Hi Sukender,

Serializers are only used for serialization IO of native formats
(osgt/osgb/osgx) at present. If you mean to bind enum values to texts for
reading/writing from files, the macros
BEGIN_ENUM_SERIALIZER, END_ENUM_SERIALIZER and ADD_ENUM_VALUE can work and
there are plenty of examples in the wrappers/serializers folder.

Cheers,

Wang Rui


2010/10/17 Sukender 

> Hi all,
>
> I used to make a keyboard mapping using introspection in previous versions
> of OSG, but I'm a bit lost with new wrappers/serializers/whatever. Can
> anyone tell me how to make a link between a key/mouse button textual
> representation (ex: KEY_space, KEY_minus), and its value, so that users can
> have an key mapping file?
> 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


Re: [osg-users] Need help with OSG Image.

2010-07-03 Thread Jean-Sébastien Guay

Hi Farshid,


If your are on Windows, the excellent (and free) Paint.NET image editor
can open/save compressed dds files.


I personally like XnView (also free ($) but not free (libre) unfortunately).

Ulrich, it's really not hard these days to find something to open dds 
files with. The DirectX SDK includes a viewer of course, GIMP opens and 
saves them, osgviewer --image loads them, etc. Unfortunately OSG won't 
convert internal image formats between load and save, so you can't just 
load a dds and save a jpg/png/tga/bmp for example, but many tools can do 
it (GIMP, command line ImageMagick, etc.)


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] Need help with OSG Image.

2010-07-03 Thread Farshid Lashkari
On Fri, Jul 2, 2010 at 11:12 PM, Ulrich Hertlein wrote:
>
> Good point, but it will only save it in its compressed form, so one still
> needs to find a
> tool to uncompress the file.
>

If your are on Windows, the excellent (and free) Paint.NET image editor can
open/save compressed dds files.

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


Re: [osg-users] Need help with OSG Image.

2010-07-02 Thread Ulrich Hertlein
On 3/07/10 12:13 , Farshid Lashkari wrote:
> On Fri, Jul 2, 2010 at 5:42 PM, Ulrich Hertlein  > wrote:
> 
> They are not invalid, decimal 33776 is hex 0x83f0 is 
> GL_COMPRESSED_RGB_S3TC_DXT1_EXT.
> In the process of converting to .ive they have been compressed to speed 
> up texture upload.
> 
> As far as I know no image exporter supports writing these compressed 
> images.
> 
> 
> The dds plugin should be able to read/write compressed images

Good point, but it will only save it in its compressed form, so one still needs 
to find a
tool to uncompress the file.

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


Re: [osg-users] Need help with OSG Image.

2010-07-02 Thread Farshid Lashkari
On Fri, Jul 2, 2010 at 5:42 PM, Ulrich Hertlein wrote:
>
>
> They are not invalid, decimal 33776 is hex 0x83f0 is
> GL_COMPRESSED_RGB_S3TC_DXT1_EXT.
> In the process of converting to .ive they have been compressed to speed up
> texture upload.
>
> As far as I know no image exporter supports writing these compressed
> images.
>

The dds plugin should be able to read/write compressed images

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


Re: [osg-users] Need help with OSG Image.

2010-07-02 Thread Ulrich Hertlein
Hi Shamim,

On 30/06/10 20:51 , Akhtar Shamim wrote:
> I have a model exported in IVE format. This model is just a quad with a 
> texture mapped
> onto it. I want to retrieve the original image from osg::Image object and 
> convert it to
> JPG/PNG or any other format. Seems simple, but I am not sure what is causing 
> the problem.
> 
> The image when loaded using osgviewer looks perfectly fine. But when I debug 
> and look at
> the contents of the osg::Image object I find that both the 
> InternalTextureFormat and the
> PixelFormat are invalid.
> 
> _internalTextureFormat33776int
> _pixelFormat33776unsigned int

They are not invalid, decimal 33776 is hex 0x83f0 is 
GL_COMPRESSED_RGB_S3TC_DXT1_EXT.
In the process of converting to .ive they have been compressed to speed up 
texture upload.

As far as I know no image exporter supports writing these compressed images.

You could render the texture to a framebuffer and read that back... :-/

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


Re: [osg-users] Need help with osg::TextureRectangle

2010-06-15 Thread Robert Osfield
HI Saket,

You could do as Jason suggests and use a TexMat to do the tex coord
scaling or simply change to using an osg::Texture2D and set the resize
non power of two texture flag on the texture to false.  The later
approach will require support for non power of two textures from your
OpenGL driver & hardware, but as this has been support for quite a few
years now there is a good chance you can assume it's available.

Robert.

On Mon, Jun 14, 2010 at 7:27 PM, Saket Jalan  wrote:
> Hi,
>
> I need to continously display incoming images from a network location. Images 
> are in the form of raw data bits, whose resolution may change. Looking at osg 
> Movie example i used createTexturedQuadGeometry to create a geometry of size 
> of first frame. Then rest of incoming images are used as texture on this quad 
> using osg::TextureRectangle. But since resolution of these images change, 
> images are not displayed fully on the quad. I even tried to scale the image 
> and resize the texture, but they did not work.
> For example if my quad is of size 1280X1024, and next frame is of 800x600, 
> it's not displayed on the quad filling the whole quad and occupies only small 
> region, where rest of region remains empty
>
>
> Please help...
>
> I am posting my code here:
>
> to create geometry:
> geometry =
> Code:
> osg::createTexturedQuadGeometry(osg::Vec3(0.f,0.f,0.f),osg::Vec3(width,0.0f,0.0f),osg::Vec3(0.0f,0.0f,height),0.0f,height,width,1.0f);
>
>
>
> to update texture each time with new image (from frame object):
>
> Code:
> class textureCallback: public osg::NodeCallback
> {
>
>
> public:
>    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
>        {
>
>                osg::ref_ptr geode=dynamic_cast(node);
>
>        osg::ref_ptr image = new osg::Image();
>        
> image->setImage(frame->crop.width,abs(frame->crop.height),0,GL_RGB,GL_BGR,GL_UNSIGNED_BYTE,(unsigned
>  char*)frame->pixbuf,osg::Image::AllocationMode::USE_MALLOC_FREE);
>
>
>        osg::ref_ptr myTex= new 
> osg::TextureRectangle(image.get());
>        myTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
>        myTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
>        myTex->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);
>        osg::ref_ptr stateone=new osg::StateSet();
>                
> stateone->setTextureAttributeAndModes(0,myTex.get(),osg::StateAttribute::ON);
>                geode->setStateSet(stateone.get());
>                traverse(node,nv);
>        }
> };
>
>
>
> ...
>
> Thank you!
>
> Cheers,
> Saket
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=28897#28897
>
>
>
>
>
> ___
> 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] Need help with osg::TextureRectangle

2010-06-14 Thread Jason Daly

Saket Jalan wrote:

Hi,

I need to continously display incoming images from a network location. Images are in the form of raw data bits, whose resolution may change. Looking at osg Movie example i used createTexturedQuadGeometry to create a geometry of size of first frame. Then rest of incoming images are used as texture on this quad using osg::TextureRectangle. But since resolution of these images change, images are not displayed fully on the quad. I even tried to scale the image and resize the texture, but they did not work. 
For example if my quad is of size 1280X1024, and next frame is of 800x600, it's not displayed on the quad filling the whole quad and occupies only small region, where rest of region remains empty
  


I'd suggest using an osg::TexMat (texture matrix) to scale the texture 
coordinates on your quad to the appropriate size for each new image.


--"J"

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-06-08 Thread Stephan Maximilian Huber
Hi Eric,

Am 08.06.10 05:31, schrieb Eric Sokolowsky:
> Did these changes make it into the 2.8.3 stable release? If not I'd like
> to get them into the stable branch for the next release.

AFAIk they are only part of osg-trunk, I think this feature needs some
more testing before it is ready for 2.8

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-06-07 Thread Eric Sokolowsky
Did these changes make it into the 2.8.3 stable release? If not I'd like to
get them into the stable branch for the next release.


On Fri, Mar 26, 2010 at 7:15 AM, Stephan Maximilian Huber <
ratzf...@digitalmind.de> wrote:

> Hi,
>
> Am 26.03.10 14:22, schrieb Martins Innus:
> > This works for me as well.  Thanks!  I wasn't getting Openthreads
> > compiled as a framework and noticed the:
> >
> > INCLUDE(ModuleInstall OPTIONAL)
> >
> > line commented out in its CMakeLists.txt.
> >
> > Adding it back in and now everything seems to be ok.  Not sure why that
> > was.  Will do some tests on compiling our projects against this now.
>
> I forgot in my first mail to attach the cmake-file specific for
> OpenThreads, so this should be fixed now.
>
> There was another bad default-value for the install_name_dir which I fixed.
>
> The frameworks and plugins compiled via cmake work with my own code
> without problems.
>
> I packaged all modified files together and sent them to osg.submissions
> for inclusion.
>
> So hopefully, we can move the old xcode-project-files into the
> deprecated branch :)
>
> thanks to all who helped!
>
> cheers,
> Stephan
>
> ___
> 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] need help with cmake / osg / os x / frameworks

2010-03-26 Thread Stephan Maximilian Huber
Hi,

Am 26.03.10 14:22, schrieb Martins Innus:
> This works for me as well.  Thanks!  I wasn't getting Openthreads
> compiled as a framework and noticed the:
> 
> INCLUDE(ModuleInstall OPTIONAL)
> 
> line commented out in its CMakeLists.txt.
> 
> Adding it back in and now everything seems to be ok.  Not sure why that
> was.  Will do some tests on compiling our projects against this now.

I forgot in my first mail to attach the cmake-file specific for
OpenThreads, so this should be fixed now.

There was another bad default-value for the install_name_dir which I fixed.

The frameworks and plugins compiled via cmake work with my own code
without problems.

I packaged all modified files together and sent them to osg.submissions
for inclusion.

So hopefully, we can move the old xcode-project-files into the
deprecated branch :)

thanks to all who helped!

cheers,
Stephan

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-26 Thread Martins Innus
This works for me as well.  Thanks!  I wasn't getting Openthreads 
compiled as a framework and noticed the:


INCLUDE(ModuleInstall OPTIONAL)

line commented out in its CMakeLists.txt.

Adding it back in and now everything seems to be ok.  Not sure why that 
was.  Will do some tests on compiling our projects against this now.


Martins

On 3/25/10 1:48 PM, Jordi Torres wrote:

Hi Matheiu,

Your changes are working for me and now I am able to compile OSG 
frameworks installing the headers in the right place. Good job!


Cheers.

2010/3/25 Mathieu Marache >


Hi Martin, Stephan,

I've had a chance to finally look at your contribution and looking
at CMake's internals I found out that if one want's a file to be
placed into the MACOSX_FRAMEWORK_LOCATION it must neither be a
PUBLIC_HEADER, PRIVATE_HEADER nor a RESOURCE.

I modified osgViewer's CMakeLists.txt accordingly and it works for
me (I have CMake 2.8 btw).

See the changeset on my git clone :

http://github.com/mathieu/osg/commit/ed5aefc9ec062df70957c72e655cb1388b4a1557

And the attached file.

If you could test it on your side ?

Le 24 mars 10 à 18:01, Stephan Maximilian Huber a écrit :


Hi Martins,
Am 24.03.10 16:03, schrieb Martins Innus:

 Have you made any progress on this?  I tried your files
and got
similar behavior with respect to the osgViewer headers in the
framework.  Although I don't even get an api directory in

osgViewer.framework/headers/

Let me know if you have any news files to test.  I'll
continue to dig on
this end.


Unfortunately no progress made on my end. If I have some
spare-time this
or next week I'll subscribe to the cmake-mailing list and ask
for help.

cheers,
Stephan


HTH
Mathieu

___
osg-users mailing list
osg-users@lists.openscenegraph.org

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




--
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es


___
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] need help with cmake / osg / os x / frameworks

2010-03-25 Thread Stephan Maximilian Huber
Hi Mathieu,

thank you very very much for your work! Works as expected on my end.

I'll do some tests tomorrow...

cheers,
Stephan


Am 25.03.10 16:01, schrieb Mathieu Marache:
> Hi Martin, Stephan,
> 
> I've had a chance to finally look at your contribution and looking at
> CMake's internals I found out that if one want's a file to be placed
> into the MACOSX_FRAMEWORK_LOCATION it must neither be a PUBLIC_HEADER,
> PRIVATE_HEADER nor a RESOURCE.
> 
> I modified osgViewer's CMakeLists.txt accordingly and it works for me (I
> have CMake 2.8 btw).
> 
> See the changeset on my git clone :
> http://github.com/mathieu/osg/commit/ed5aefc9ec062df70957c72e655cb1388b4a1557
> 
> 
> And the attached file.
> 
> If you could test it on your side ?

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-25 Thread Jordi Torres
Hi Matheiu,

Your changes are working for me and now I am able to compile OSG frameworks
installing the headers in the right place. Good job!

Cheers.

2010/3/25 Mathieu Marache 

> Hi Martin, Stephan,
>
> I've had a chance to finally look at your contribution and looking at
> CMake's internals I found out that if one want's a file to be placed into
> the MACOSX_FRAMEWORK_LOCATION it must neither be a PUBLIC_HEADER,
> PRIVATE_HEADER nor a RESOURCE.
>
> I modified osgViewer's CMakeLists.txt accordingly and it works for me (I
> have CMake 2.8 btw).
>
> See the changeset on my git clone :
> http://github.com/mathieu/osg/commit/ed5aefc9ec062df70957c72e655cb1388b4a1557
>
> And the attached file.
>
> If you could test it on your side ?
>
> Le 24 mars 10 à 18:01, Stephan Maximilian Huber a écrit :
>
>
>  Hi Martins,
>> Am 24.03.10 16:03, schrieb Martins Innus:
>>
>>   Have you made any progress on this?  I tried your files and got
>>> similar behavior with respect to the osgViewer headers in the
>>> framework.  Although I don't even get an api directory in
>>>
>>> osgViewer.framework/headers/
>>>
>>> Let me know if you have any news files to test.  I'll continue to dig on
>>> this end.
>>>
>>
>> Unfortunately no progress made on my end. If I have some spare-time this
>> or next week I'll subscribe to the cmake-mailing list and ask for help.
>>
>> cheers,
>> Stephan
>>
>
> HTH
> Mathieu
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-25 Thread David Glenn
Hi,

Does anybody know if there is a GDE tool to make cMake, cPack scripts for 
people that don't want to deal with all the Alchemy of the whole thing?

It’s been awhile, but the last time I used Installshield on windows, it was 
easier than even building a simple cPack script. And I won’t even to bring up 
using RPMbuild that requires some Oxford graduate to explain to me it’s basic 
use.

I'm a Graphics hack and think that Building RPM files shouldn’t be Rocket 
Science or my preoccupation!
... 

Cheers,
D Glenn


D Glenn (a.k.a David Glenn) - Join the Navy and See the World ... from your 
Desk!

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





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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-25 Thread Mathieu Marache

Hi Martin, Stephan,

I've had a chance to finally look at your contribution and looking at  
CMake's internals I found out that if one want's a file to be placed  
into the MACOSX_FRAMEWORK_LOCATION it must neither be a PUBLIC_HEADER,  
PRIVATE_HEADER nor a RESOURCE.


I modified osgViewer's CMakeLists.txt accordingly and it works for me  
(I have CMake 2.8 btw).


See the changeset on my git clone : 
http://github.com/mathieu/osg/commit/ed5aefc9ec062df70957c72e655cb1388b4a1557

And the attached file.

If you could test it on your side ?

Le 24 mars 10 à 18:01, Stephan Maximilian Huber a écrit :


Hi Martins,
Am 24.03.10 16:03, schrieb Martins Innus:


  Have you made any progress on this?  I tried your files and got
similar behavior with respect to the osgViewer headers in the
framework.  Although I don't even get an api directory in

osgViewer.framework/headers/

Let me know if you have any news files to test.  I'll continue to  
dig on

this end.


Unfortunately no progress made on my end. If I have some spare-time  
this
or next week I'll subscribe to the cmake-mailing list and ask for  
help.


cheers,
Stephan


HTH
Mathieu

# FIXME: For OS X, need flag for Framework or dylib
IF(DYNAMIC_OPENSCENEGRAPH)
ADD_DEFINITIONS(-DOSGVIEWER_LIBRARY)
ELSE()
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF()

SET(LIB_NAME osgViewer)

SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
SET(LIB_PUBLIC_HEADERS
${HEADER_PATH}/CompositeViewer
${HEADER_PATH}/Export
${HEADER_PATH}/GraphicsWindow
${HEADER_PATH}/Renderer
${HEADER_PATH}/Scene
${HEADER_PATH}/Version
${HEADER_PATH}/View
${HEADER_PATH}/Viewer
${HEADER_PATH}/ViewerBase
${HEADER_PATH}/ViewerEventHandlers
)

SET(LIB_COMMON_FILES
CompositeViewer.cpp
HelpHandler.cpp
Renderer.cpp
Scene.cpp
ScreenCaptureHandler.cpp
StatsHandler.cpp
Version.cpp
View.cpp
Viewer.cpp
ViewerBase.cpp
ViewerEventHandlers.cpp
${OPENSCENEGRAPH_VERSIONINFO_RC}
)

SET(LIB_EXTRA_LIBS)

IF(WIN32)
#
# Enable workaround for OpenGL driver issues when used in 
multithreaded/multiscreen with NVidia drivers on Windows XP 
# For example: osgviewer dumptruck.osg was showing total garbage (screen 
looked like shattered, splashed hedgehog) 
# There were also serious issues with render to texture cameras.
# Workaround repeats makeCurrentContext call as it was found that this 
causes the problems to dissapear.
#
OPTION(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND "Set to ON if 
you have NVidia board and drivers earlier than 177.92 ver" OFF)
MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
ENDIF()

SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS}
${HEADER_PATH}/api/Win32/GraphicsHandleWin32
${HEADER_PATH}/api/Win32/GraphicsWindowWin32
${HEADER_PATH}/api/Win32/PixelBufferWin32
)

SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
GraphicsWindowWin32.cpp
PixelBufferWin32.cpp
)
ELSE()
IF(APPLE)
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type 
for graphics window creation, options Carbon, Cocoa or X11.")
ELSE()
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for 
graphics window creation. options only X11")
ENDIF()

IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)

IF(OSG_COMPILE_FRAMEWORKS)
   SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
 ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
 ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
 ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
 )
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa 
PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) 
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa 
PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa 
PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
ELSE()
SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} 
${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
)
ENDIF()  
  
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
GraphicsWindowCocoa.mm
DarwinUtils.h
DarwinUtils.mm
PixelBufferCocoa.mm
)
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION) 

IF(OSG_COMPILE_FRAMEWORKS)
   SET(LIB_COMMO

Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-24 Thread Stephan Maximilian Huber
Hi Martins,
Am 24.03.10 16:03, schrieb Martins Innus:

> Have you made any progress on this?  I tried your files and got
> similar behavior with respect to the osgViewer headers in the
> framework.  Although I don't even get an api directory in
> 
> osgViewer.framework/headers/
> 
> Let me know if you have any news files to test.  I'll continue to dig on
> this end.

Unfortunately no progress made on my end. If I have some spare-time this
or next week I'll subscribe to the cmake-mailing list and ask for help.

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-24 Thread Martins Innus

Stephan,

Have you made any progress on this?  I tried your files and got 
similar behavior with respect to the osgViewer headers in the 
framework.  Although I don't even get an api directory in


osgViewer.framework/headers/

Let me know if you have any news files to test.  I'll continue to dig on 
this end.


Thanks

Martins


On 3/10/10 10:21 AM, Stephan Maximilian Huber wrote:

Hi all,

I am trying to add framework-support to the cmake-files, and I am
hitting a wall. I am not a cmake-expert so I'll ask the community for help.

Attached you'll find my modified cmake-files (based on current trunk),
which adds compiling osg as frameworks, which can be embedded into
application bundles (this is the main reason for the existance of the
deprecated xcode-project)

To compile frameworks with cmake you'll have to:

set OSG_COMPILE_FRAMEWORKS to TRUE
modify OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR if needed
set the CMAKE_INSTALL_PREFIX to something reasonable, I use a folder on
my desktop as destination.

Click Configure, click generate, open the xcode project, click build,
select the "install"-target, click build again. So you'll find in
CMAKE_INSTALL_PREFIX a bunch of folders, in lib you'll find the
frameworks, ready to be embedded into your app.

You'll get valid frameworks ONLY if you run the install-target. Without
that, the install_name_dirs are bound to the local storage of the
frameworks, and will not work on other computers, or other destinations.

And here's the big BUT:

I have problems to move the api-headers of osgViewer into their right
places (osgViewer.framework/headers/api/(Carbon|Cocoa)/*)

They end all in osgViewer.framework/headers/

There is a special property for this called MACOSX_PACKAGE_LOCATION,
which should move the corresponding files to the special place in the
framework-bundle, but it doesn't work for the api-headerfiles. Perhaps
someone can look at the source in src/osgViewer/CMakeLists.txt and check
my approach. cmake copies two cpp-files into that place instead of the
header-files.

So please, please test the packaged cmake-files and perhaps there is
someone out there who can help with the issues with the
osgviewer-header-files!

thanks in advance,

Stephan


   



___
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] Need help with intersectvisitor

2010-03-23 Thread Robert Osfield
On Mon, Mar 22, 2010 at 10:52 PM, Brett Thomas Lee
 wrote:
>  so finally I get world intersection point. Since I am attaching visitor to 
> mTransform node I will get the world intersection point wrt the root or wrt
> the mTransform?? Also what does the getLocalIntersectPoint() return??

The coordinates in the local coordinate frame of the geometry being interected.

The world intersect point in the local coordinate point transformed by
all the transforms from the root of the intersect traversal to the
intersected geometry.

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


Re: [osg-users] Need help to understand this code snippet withaccept and operator

2010-03-12 Thread Fletcher, Craig A
Thanks alot for your help Robert I had become pretty confused but I think I 
understand it now.  The proof will be when I implement something :)
You must have been a pretty strong runner when you were a kid (or maybe still 
are) HW is good for stuff like that even though we are pretty much in Edinburgh 
you can be in the countryside if you go out of the other side of the campus.

All the best

Fred

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: 12 March 2010 10:57
To: OpenSceneGraph Users
Subject: Re: [osg-users] Need help to understand this code snippet withaccept 
and operator

Hi Fred,

The TriangleIndexFunctor is a template helper class for making it
easier to access the triangles held in osg::Drawable.  The actual
geometry primitives held within different osg::Drawable subclasses
could be of any type and any arrangement, so casting osg::Drawable to
osg::Geometry etc. and then accessing the primitives directly and then
working out how to interpret the triangles from this is rather
complex, tedious and prone to poor performance unless you are very
careful.

To address the tight coupling of accessors to implementations, the
osg::Drawable has an accept(osg::Drawable::PrimitiveFunctor&) method
exists to allow a subclass from osg::Drawable to pass details on the
geometry primitives that it has to the functor in a generic way - thus
hiding the local implementation details of that Drawable and enabling
your own custom PrimitiveFunctor to work with a wide range of Drawable
without needing to know the implementation details.  While this
achieves good decoupling the PrimitiveFunctor still has to handle all
the different types of primitives - polygons, tri strips, quads, qaud
strips, lines etc, which is still pretty complicated to implement.

To address the complexity of handling all the different types of
primitives the TriangleIndexFunctor template class exists to decompose
all the descriptions of generic primitives into the simple triangles
marked by their corner indices.  For you the app developer all you
then need to do is create you little functor that implements the void
operator()(const int v1, const int v2, const int v3) method as per the
example, and then pass the resulting templated class to the drawable
to get all the triangle information.  The use of templates also
ensures good performance.

If it wasn't for PrimtiiveFunctor and
TriangleFunctor/TriangleIndexFunctor accessing geometry would be very
tedious and error prone task - lots of casts, switch statements and
book keeping.  These helper classes might seem a bit convoluted at
first look, they really make life much easier.  Go have a search
through the OSG code base, there are plenty of examples of
TriangleFunctor/TriangleIndexFunctor in action - especially in
src/osgUtil.

Cheers,
Robert.

ps. I spotted your signature and it brings back memories - I ran in
the Scottish Cross Country Nationals at Herriot-Watt when I was kid
;-)

On Fri, Mar 12, 2010 at 10:01 AM, Fletcher, Craig A  wrote:
> Hi
>
> I was wondering if someone could help explain this piece of code or at least
> point me in the right direction.  It was posted by Yuen Helbig in 2008
>
>
>
> osg::TriangleIndexFunctor tif;
>
> tempGeode.geode->getDrawable(j)->accept(tif);
>
>
>
> With TriangleIndexVisitor defined as:
>
>
>
> class TriangleIndexVisitor
>
> {
>
> public:
>
>     CArray indices;
>
>
>
>     void operator()(const int v1, const int v2, const int v3)
>
>     {
>
>    // toss the computed indices into the indices array
>
>    indices.Add( v1 );
>
>    indices.Add( v2 );
>
>    indices.Add( v3 );
>
>     }
>
> };
>
>
>
> I think I am struggling with the concept of how accept and operator work.
>
>
>
> All the best
>
>
>
> Fred
>
> 
> Heriot-Watt University is a Scottish charity registered under charity number
> SC000278.
>
> ___
> 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


-- 
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

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


Re: [osg-users] Need help to understand this code snippet with accept and operator

2010-03-12 Thread Robert Osfield
Hi Fred,

The TriangleIndexFunctor is a template helper class for making it
easier to access the triangles held in osg::Drawable.  The actual
geometry primitives held within different osg::Drawable subclasses
could be of any type and any arrangement, so casting osg::Drawable to
osg::Geometry etc. and then accessing the primitives directly and then
working out how to interpret the triangles from this is rather
complex, tedious and prone to poor performance unless you are very
careful.

To address the tight coupling of accessors to implementations, the
osg::Drawable has an accept(osg::Drawable::PrimitiveFunctor&) method
exists to allow a subclass from osg::Drawable to pass details on the
geometry primitives that it has to the functor in a generic way - thus
hiding the local implementation details of that Drawable and enabling
your own custom PrimitiveFunctor to work with a wide range of Drawable
without needing to know the implementation details.  While this
achieves good decoupling the PrimitiveFunctor still has to handle all
the different types of primitives - polygons, tri strips, quads, qaud
strips, lines etc, which is still pretty complicated to implement.

To address the complexity of handling all the different types of
primitives the TriangleIndexFunctor template class exists to decompose
all the descriptions of generic primitives into the simple triangles
marked by their corner indices.  For you the app developer all you
then need to do is create you little functor that implements the void
operator()(const int v1, const int v2, const int v3) method as per the
example, and then pass the resulting templated class to the drawable
to get all the triangle information.  The use of templates also
ensures good performance.

If it wasn't for PrimtiiveFunctor and
TriangleFunctor/TriangleIndexFunctor accessing geometry would be very
tedious and error prone task - lots of casts, switch statements and
book keeping.  These helper classes might seem a bit convoluted at
first look, they really make life much easier.  Go have a search
through the OSG code base, there are plenty of examples of
TriangleFunctor/TriangleIndexFunctor in action - especially in
src/osgUtil.

Cheers,
Robert.

ps. I spotted your signature and it brings back memories - I ran in
the Scottish Cross Country Nationals at Herriot-Watt when I was kid
;-)

On Fri, Mar 12, 2010 at 10:01 AM, Fletcher, Craig A  wrote:
> Hi
>
> I was wondering if someone could help explain this piece of code or at least
> point me in the right direction.  It was posted by Yuen Helbig in 2008
>
>
>
> osg::TriangleIndexFunctor tif;
>
> tempGeode.geode->getDrawable(j)->accept(tif);
>
>
>
> With TriangleIndexVisitor defined as:
>
>
>
> class TriangleIndexVisitor
>
> {
>
> public:
>
>     CArray indices;
>
>
>
>     void operator()(const int v1, const int v2, const int v3)
>
>     {
>
>    // toss the computed indices into the indices array
>
>    indices.Add( v1 );
>
>    indices.Add( v2 );
>
>    indices.Add( v3 );
>
>     }
>
> };
>
>
>
> I think I am struggling with the concept of how accept and operator work.
>
>
>
> All the best
>
>
>
> Fred
>
> 
> Heriot-Watt University is a Scottish charity registered under charity number
> SC000278.
>
> ___
> 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] need help with cmake / osg / os x / frameworks

2010-03-12 Thread Jordi Torres
Hi Stephan,


Yes, the copying of the osgviewer-headers is currently broken for
> frameworks, this the last missing piece to get cmake-support complete
> (see my first mail)
>
>

I understood tour first mail when I readed it. :).


> > >  In the file ModuleInstall.cmake line 37:
> >
> > IF(!OSG_COMPILE_FRAMEWORKS) it doesn't work, so the frameworks are always
> > installed. The correct way to write this in CMake is :
> >
> > IF (NOT OSG_COMPILE_FRAMEWORKS).
>
> Ah, thanks for the fix!
>
> Thanks again,
> Stephan
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-12 Thread Stephan Maximilian Huber
Hi Jordi,
Am 12.03.10 10:59, schrieb Jordi Torres:
> I have seen a problem (a part of the
> headers installation in osgViewer).

Yes, the copying of the osgviewer-headers is currently broken for
frameworks, this the last missing piece to get cmake-support complete
(see my first mail)

> >  In the file ModuleInstall.cmake line 37:
> 
> IF(!OSG_COMPILE_FRAMEWORKS) it doesn't work, so the frameworks are always
> installed. The correct way to write this in CMake is :
> 
> IF (NOT OSG_COMPILE_FRAMEWORKS).

Ah, thanks for the fix!

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-12 Thread Jordi Torres
Hi Stephan, Robert,

I have compiled the frameworks with Unix makefiles,and with generated XCode
project. Despite compiling succesful,  I have seen a problem (a part of the
headers installation in osgViewer).

 In the file ModuleInstall.cmake line 37:

IF(!OSG_COMPILE_FRAMEWORKS) it doesn't work, so the frameworks are always
installed. The correct way to write this in CMake is :

IF (NOT OSG_COMPILE_FRAMEWORKS).

I am compiling now with this modification, I will write to you again in a
while.

Cheers.

2010/3/10 Stephan Maximilian Huber 

> Hi all,
>
> I am trying to add framework-support to the cmake-files, and I am
> hitting a wall. I am not a cmake-expert so I'll ask the community for help.
>
> Attached you'll find my modified cmake-files (based on current trunk),
> which adds compiling osg as frameworks, which can be embedded into
> application bundles (this is the main reason for the existance of the
> deprecated xcode-project)
>
> To compile frameworks with cmake you'll have to:
>
> set OSG_COMPILE_FRAMEWORKS to TRUE
> modify OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR if needed
> set the CMAKE_INSTALL_PREFIX to something reasonable, I use a folder on
> my desktop as destination.
>
> Click Configure, click generate, open the xcode project, click build,
> select the "install"-target, click build again. So you'll find in
> CMAKE_INSTALL_PREFIX a bunch of folders, in lib you'll find the
> frameworks, ready to be embedded into your app.
>
> You'll get valid frameworks ONLY if you run the install-target. Without
> that, the install_name_dirs are bound to the local storage of the
> frameworks, and will not work on other computers, or other destinations.
>
> And here's the big BUT:
>
> I have problems to move the api-headers of osgViewer into their right
> places (osgViewer.framework/headers/api/(Carbon|Cocoa)/*)
>
> They end all in osgViewer.framework/headers/
>
> There is a special property for this called MACOSX_PACKAGE_LOCATION,
> which should move the corresponding files to the special place in the
> framework-bundle, but it doesn't work for the api-headerfiles. Perhaps
> someone can look at the source in src/osgViewer/CMakeLists.txt and check
> my approach. cmake copies two cpp-files into that place instead of the
> header-files.
>
> So please, please test the packaged cmake-files and perhaps there is
> someone out there who can help with the issues with the
> osgviewer-header-files!
>
> thanks in advance,
>
> Stephan
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-11 Thread Robert Osfield
Hi Jordi,

On Wed, Mar 10, 2010 at 6:51 PM, Jordi Torres wrote:

> The XCode build fails for me in osgunittests when running
> "runFileNameUtilsTest(osg::ArgumentParser&)" because ld: symbol(s) not
> found. Let me investigate further...
>

The runFileNameUtilsTest(..) method is something I added yesterday, its
implementation can be found in examples/osgunittests/FileNameUtils.cpp, I've
just checked the CMakeLists.txt script for osgunittests and it all looks
correct.  The hand maintained XCode projects way well not have inclined this
yet, but in theory the CMake generated XCode projects should.

Does the Cmake generated makefiles work?

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-10 Thread Stephan Huber
Hi Jordi,

Am 10.03.10 19:27, schrieb Jordi Torres:
> Shouldn't it be SET(LIB_EXTRA_LIBS ${CARBON_LIBRARY} ${LIB_EXTRA_LIBS}) ??

No that's correct, as the carbon implementation uses also some
cocoa-code in DarwinUtils.mm.

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


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-10 Thread Jordi Torres
Hi Stephan,

The XCode build fails for me in osgunittests when running
"runFileNameUtilsTest(osg::ArgumentParser&)" because ld: symbol(s) not
found. Let me investigate further...

Cheers.







2010/3/10 Jordi Torres 

> Hi Stephan,
>
> I am trying your XCode/CMake mods. It is now compiling, and very
> slw but I have realize that in your osgViewer/CmakeLists.txt there
> is a weird thing.
> Line 107:
>
> SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
>
> Shouldn't it be SET(LIB_EXTRA_LIBS ${CARBON_LIBRARY} ${LIB_EXTRA_LIBS}) ??
>
> Cheers.
>
>
> 2010/3/10 Stephan Maximilian Huber 
>
>> Hi all,
>>
>> I am trying to add framework-support to the cmake-files, and I am
>> hitting a wall. I am not a cmake-expert so I'll ask the community for
>> help.
>>
>> Attached you'll find my modified cmake-files (based on current trunk),
>> which adds compiling osg as frameworks, which can be embedded into
>> application bundles (this is the main reason for the existance of the
>> deprecated xcode-project)
>>
>> To compile frameworks with cmake you'll have to:
>>
>> set OSG_COMPILE_FRAMEWORKS to TRUE
>> modify OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR if needed
>> set the CMAKE_INSTALL_PREFIX to something reasonable, I use a folder on
>> my desktop as destination.
>>
>> Click Configure, click generate, open the xcode project, click build,
>> select the "install"-target, click build again. So you'll find in
>> CMAKE_INSTALL_PREFIX a bunch of folders, in lib you'll find the
>> frameworks, ready to be embedded into your app.
>>
>> You'll get valid frameworks ONLY if you run the install-target. Without
>> that, the install_name_dirs are bound to the local storage of the
>> frameworks, and will not work on other computers, or other destinations.
>>
>> And here's the big BUT:
>>
>> I have problems to move the api-headers of osgViewer into their right
>> places (osgViewer.framework/headers/api/(Carbon|Cocoa)/*)
>>
>> They end all in osgViewer.framework/headers/
>>
>> There is a special property for this called MACOSX_PACKAGE_LOCATION,
>> which should move the corresponding files to the special place in the
>> framework-bundle, but it doesn't work for the api-headerfiles. Perhaps
>> someone can look at the source in src/osgViewer/CMakeLists.txt and check
>> my approach. cmake copies two cpp-files into that place instead of the
>> header-files.
>>
>> So please, please test the packaged cmake-files and perhaps there is
>> someone out there who can help with the issues with the
>> osgviewer-header-files!
>>
>> thanks in advance,
>>
>> Stephan
>>
>>
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> Jordi Torres Fabra
>
> gvSIG 3D blog
> http://gvsig3d.blogspot.com
> Instituto de Automática e Informática Industrial
> http://www.ai2.upv.es
>



-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] need help with cmake / osg / os x / frameworks

2010-03-10 Thread Jordi Torres
Hi Stephan,

I am trying your XCode/CMake mods. It is now compiling, and very slw
but I have realize that in your osgViewer/CmakeLists.txt there is a weird
thing.
Line 107:

SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})

Shouldn't it be SET(LIB_EXTRA_LIBS ${CARBON_LIBRARY} ${LIB_EXTRA_LIBS}) ??

Cheers.


2010/3/10 Stephan Maximilian Huber 

> Hi all,
>
> I am trying to add framework-support to the cmake-files, and I am
> hitting a wall. I am not a cmake-expert so I'll ask the community for help.
>
> Attached you'll find my modified cmake-files (based on current trunk),
> which adds compiling osg as frameworks, which can be embedded into
> application bundles (this is the main reason for the existance of the
> deprecated xcode-project)
>
> To compile frameworks with cmake you'll have to:
>
> set OSG_COMPILE_FRAMEWORKS to TRUE
> modify OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR if needed
> set the CMAKE_INSTALL_PREFIX to something reasonable, I use a folder on
> my desktop as destination.
>
> Click Configure, click generate, open the xcode project, click build,
> select the "install"-target, click build again. So you'll find in
> CMAKE_INSTALL_PREFIX a bunch of folders, in lib you'll find the
> frameworks, ready to be embedded into your app.
>
> You'll get valid frameworks ONLY if you run the install-target. Without
> that, the install_name_dirs are bound to the local storage of the
> frameworks, and will not work on other computers, or other destinations.
>
> And here's the big BUT:
>
> I have problems to move the api-headers of osgViewer into their right
> places (osgViewer.framework/headers/api/(Carbon|Cocoa)/*)
>
> They end all in osgViewer.framework/headers/
>
> There is a special property for this called MACOSX_PACKAGE_LOCATION,
> which should move the corresponding files to the special place in the
> framework-bundle, but it doesn't work for the api-headerfiles. Perhaps
> someone can look at the source in src/osgViewer/CMakeLists.txt and check
> my approach. cmake copies two cpp-files into that place instead of the
> header-files.
>
> So please, please test the packaged cmake-files and perhaps there is
> someone out there who can help with the issues with the
> osgviewer-header-files!
>
> thanks in advance,
>
> Stephan
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Need help finding examples with osgUtil::LineSegmentIntersector and osgUtil::IntersectionVisitor

2009-11-02 Thread Paul Melis
Nguyen Tien Dat wrote:
> Dear all,
> Which example in OpenSceneGraph 2.8.2 is using these classes?
>   
22:36|me...@juggle2:~/c/osg/svn/trunk> grep LineSegmentIntersector
examples/*/*.cpp
examples/osgcompositeviewer/osgcompositeviewer.cpp:   
osgUtil::LineSegmentIntersector::Intersections intersections;
examples/osgcompositeviewer/osgcompositeviewer.cpp:   
osgUtil::LineSegmentIntersector::Intersection intersection =
*intersections.begin();
examples/osgforest/osgforest.cpp:#include 
examples/osgforest/osgforest.cpp:   
osg::ref_ptr intersector =
examples/osgforest/osgforest.cpp:new
osgUtil::LineSegmentIntersector(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z()));
examples/osgforest/osgforest.cpp:   
osgUtil::LineSegmentIntersector::Intersections& intersections =
intersector->getIntersections();
examples/osgforest/osgforest.cpp:   
for(osgUtil::LineSegmentIntersector::Intersections::iterator itr =
intersections.begin();
examples/osgforest/osgforest.cpp:const
osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
examples/osgintersection/osgintersection.cpp:#include

examples/osgintersection/osgintersection.cpp:   
osg::ref_ptr intersector = new
osgUtil::LineSegmentIntersector(s, e);
examples/osgintersection/osgintersection.cpp:   
osgUtil::LineSegmentIntersector* lsi =
dynamic_cast(intersector_itr->get());
examples/osgintersection/osgintersection.cpp:   
osgUtil::LineSegmentIntersector::Intersections& intersections =
lsi->getIntersections();
examples/osgintersection/osgintersection.cpp:   
for(osgUtil::LineSegmentIntersector::Intersections::iterator itr =
intersections.begin();
examples/osgintersection/osgintersection.cpp:   
const osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
examples/osgintersection/osgintersection.cpp:   
osg::ref_ptr intersector = new
osgUtil::LineSegmentIntersector(start, end);
examples/osgintersection/osgintersection.cpp:   
osgUtil::LineSegmentIntersector::Intersections& intersections =
intersector->getIntersections();
examples/osgintersection/osgintersection.cpp:   
for(osgUtil::LineSegmentIntersector::Intersections::iterator itr =
intersections.begin();
examples/osgintersection/osgintersection.cpp:const
osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
examples/osgkdtree/osgkdtree.cpp:#include 
examples/osgkdtree/raytrace.cpp:#include 
examples/osgkdtree/raytrace.cpp:   
osg::ref_ptr   intersector;
examples/osgkdtree/raytrace.cpp:   
osgUtil::LineSegmentIntersector::Intersections  intersections;
examples/osgkdtree/raytrace.cpp:   
osgUtil::LineSegmentIntersector::Intersections::iteratorisec_itr;
examples/osgkdtree/raytrace.cpp:intersector = new
osgUtil::LineSegmentIntersector(p, L);
examples/osgkdtree/raytrace.cpp:   
osg::ref_ptr   intersector;
examples/osgkdtree/raytrace.cpp:   
osgUtil::LineSegmentIntersector::Intersections  intersections;
examples/osgkdtree/raytrace.cpp:   
osgUtil::LineSegmentIntersector::Intersections::iteratorisec_itr;
examples/osgkdtree/raytrace.cpp:intersector = new
osgUtil::LineSegmentIntersector(osg::Vec3f(), osg::Vec3f());
examples/osgkeyboardmouse/osgkeyboardmouse.cpp:#include

examples/osgkeyboardmouse/osgkeyboardmouse.cpp:   
osg::notify(osg::NOTICE)<<"Using LineSegmentIntersector"

Re: [osg-users] Need help regarding rendering to a texture

2009-08-23 Thread J.P. Delport

Hi,

just uncomment the line:
mPreRenderCamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);

jp

Brett Thomas Lee wrote:

Hi,

Here I attached another quad at some distance but Im unable to see the 
projection of one quad over the other.I am unable figure the reason why I dont 
see the projection of one quad over the other.Mr.delport can you please figure 
the reason why its happening like this.Thanks in advance.

Thanks & Regards,
brett.

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







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


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


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Need help regarding rendering to a texture

2009-08-23 Thread J.P. Delport

Hi,

Brett Thomas Lee wrote:

Hi again thank you Mr. delport for spending your time.I have a last
and final question.  setProjectionMatrixAsOrtho() is not working in
the code.can you please tell me the reason for that please.


It is working, OSG just by default automatically computes near and far 
planes. I'm not sure it is working correctly for ortho cameras, so I 
switch it off normally.



If i set
ortho or lookat in osg is it like opengl(with z coming out) or like
osg(with y coming out)??


Like OpenGL. OSG's camera manipulators use y out, but you can change 
this if you want.


jp




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






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





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


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Need help regarding rendering to a texture

2009-08-20 Thread J.P. Delport

Hi Brett,

problem seems to be that lighting was on in your RTT camera. See 
attached. I added


geode->getOrCreateStateSet()->setMode( GL_LIGHTING, 
osg::StateAttribute::OFF);


Also be aware of the way OSG blends your RTT texture with your final 
geometry. OSG defaults to GL_MODULATE. Search


http://news.gmane.org/gmane.comp.graphics.openscenegraph.user

for

"GL_MODULATE" or "GL_DECAL" and you'll find some things. Also look at

http://www.opengl.org/resources/faq/technical/texture.htm

rgds
jp

Brett Thomas Lee wrote:

Hi,

I have attached my expected and current output.Just remove the quotes for

osg::ref_ptr c = new osg::Vec4Array;
geom->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
c->push_back( osg::Vec4( 1.f, 0.f, 0.f, 1.f ) );
c->push_back( osg::Vec4( 0.f, 1.f, 0.f, 1.f ) );
c->push_back( osg::Vec4( 0.f, 0.f, 1.f, 1.f ) );
c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) );

and check once.Thanks again.


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


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include
#include 
#include 

#include 
#include 
#include 

using namespace std;
using namespace osg;

#define ImageWidth 64
#define ImageHeight 64
GLubyte checkImage[64*64][4];

osg::ref_ptr image;
osg::Texture2D *rendTexture;
osg::ref_ptr mPreRenderCamera;
void makeCheckImage(void);
osg::ref_ptr createSceneGraph(void);
void createTexture(const unsigned int,const unsigned int);
void textureCamera();	



int main()
{

	osgViewer::Viewer viewer;
//	renderTexture();
	//osg::ref_ptr scene=createSceneGraph();
	//createTexture(ImageWidth,ImageHeight);
	textureCamera();
	osg::ref_ptr root=new osg::Group;
	osg::ref_ptr mTransform=new osg::MatrixTransform ;
	osg::ref_ptr geode=new osg::Geode;
	osg::ref_ptr geom=new osg::Geometry;


	osg::ref_ptr ary=new osg::Vec3Array;
	ary->push_back(osg::Vec3(-100.0,0.0,-100.0));
	ary->push_back(osg::Vec3(100.0,0.0,-100.0));
	ary->push_back(osg::Vec3(100.0,0.0,100.0));
	ary->push_back(osg::Vec3(-100.0,0.0,100.0));
	geom->setVertexArray(ary.get());

	osg::ref_ptr col=new osg::Vec4Array;
	geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	geom->setColorArray(col.get());

	osg::ref_ptr n=new osg::Vec3Array;
	geom->setColorBinding(osg::Geometry::BIND_OVERALL);
	n->push_back(osg::Vec3(0.0,-1.0,0.0));
	geom->setNormalArray(n.get());

osg::ref_ptr ss1=geode->getOrCreateStateSet();

	osg::ref_ptr tex1=new osg::Vec2Array;
	tex1->push_back(osg::Vec2(0.0,0.0));
	tex1->push_back(osg::Vec2(1.0,0.0));
	tex1->push_back(osg::Vec2(1.0,1.0));
	tex1->push_back(osg::Vec2(0.0,1.0));
	geom->setTexCoordArray(0,tex1.get());


		/*int c;
		for (int i = 0; i < ImageHeight; i++) 
		for (int j = 0; j < ImageWidth; j++) 
		{	
			c = (((i&0x8)==0)^((j&0x8)==0))*255;
			checkImage[i][j][0] = (GLubyte) c;
			checkImage[i][j][1] = (GLubyte) c;
			checkImage[i][j][2] = (GLubyte) c;
			checkImage[i][j][3] = (GLubyte) 255;
			}
	


	//osg::ref_ptr image=new osg::Image;
	//image->setImage(64,64,1,4,GL_RGBA,GL_UNSIGNED_BYTE,(unsigned char*)checkImage,osg::Image::USE_NEW_DELETE);

*/
	//osg::ref_ptr image = osgDB::readImageFile( "texture.jpg" );
// Attach the image in a Texture2D object
	//osg::ref_ptr tex = new osg::Texture2D;
	//tex->setImage( image.get() );
	
	ss1->setTextureAttributeAndModes( 0,rendTexture,osg::StateAttribute::ON);
	cout<<"Texture width"push_back(1);
t1->push_back(2);
geom->addPrimitiveSet(t1);

osg::DrawElementsUInt* t2 = 
  new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
t2->push_back(2);
t2->push_back(3);
t2->push_back(1);
geom->addPrimitiveSet(t2);
	geode->addDrawable(geom.get());
*/
geom->addPrimitiveSet(new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, 4 ));
	geode->addDrawable(geom.get());

ss1->setMode( GL_BLEND, osg::StateAttribute::ON);
ss1->setMode( GL_LIGHTING, osg::StateAttribute::OFF);
ss1->setMode( GL_LIGHT1, osg::StateAttribute::OFF);
ss1->setMode( GL_NORMALIZE, osg::StateAttribute::ON );
osg::ref_ptr light1 = new osg::Light;
light1->setAmbient( osg::Vec4(0.8,0.8,0.0,1.0));
light1->setDiffuse( osg::Vec4( 1.0,1.0,0.0,1.0 ));
light1->setSpecular( osg::Vec4(1.0,1.0,0.0,1.0 ));
light1->setPosition( osg::Vec4( 0.0,120.0,0.0,1.0));
light1->setDirection( osg::Vec3( 0.f, -1.f, 0.f 

Re: [osg-users] Need help regarding rendering to a texture

2009-08-19 Thread J.P. Delport

Hi,

what do you get on screen with the code I attached? Should be a red 
square. What is your desired output?


jp

Brett Thomas Lee wrote:

Hi,

Thank you very much for the reply.Even though i changed those two things im 
unable get my desired output.

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





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



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


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Need help regarding rendering to a texture

2009-08-19 Thread J.P. Delport

Hi,

fix attached. There is no magic here, you should have been able to find 
out the problems by looking at the osg examples.


You forgot to attach the prerender camera to you main scene. Also, the 
prerender camera usually operates in the default OpenGL coord system, ie 
z coming out of the screen. So your geom should be in x-y plane, not x-z.


jp


Brett Thomas Lee wrote:

Hi Can someone please find the bug in my code.I been trying it for the past two 
days.What ive done is ,Ive set a prerender camera and render  a quad to the  
FBO and then to a texture with viewport to the size of the texture.And then 
apply it to a quad.Im attaching my source along with this post.Thanks in 
advance.

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







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


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


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include
#include 
#include 

#include 
#include 
#include 

using namespace std;
using namespace osg;

#define ImageWidth 64
#define ImageHeight 64
GLubyte checkImage[64*64][4];

osg::ref_ptr image;
osg::Texture2D *rendTexture;
osg::ref_ptr mPreRenderCamera;
void makeCheckImage(void);
osg::ref_ptr createSceneGraph(void);
void createTexture(const unsigned int,const unsigned int);
void textureCamera();	



int main()
{

	osgViewer::Viewer viewer;
//	renderTexture();
	//osg::ref_ptr scene=createSceneGraph();
	//createTexture(ImageWidth,ImageHeight);
	textureCamera();
	osg::ref_ptr root=new osg::Group;
	osg::ref_ptr mTransform=new osg::MatrixTransform ;
	osg::ref_ptr geode=new osg::Geode;
	osg::ref_ptr geom=new osg::Geometry;


	osg::ref_ptr ary=new osg::Vec3Array;
	geom->setVertexArray(ary.get());
	ary->push_back(osg::Vec3(-100.0,0.0,-100.0));
	ary->push_back(osg::Vec3(100.0,0.0,-100.0));
	ary->push_back(osg::Vec3(-100.0,0.0,100.0));
	ary->push_back(osg::Vec3(100.0,0.0,100.0));

	osg::ref_ptr col=new osg::Vec4Array;
	geom->setColorArray(col.get());
	geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
	col->push_back(osg::Vec4(1.0,1.0,1.0,1.0));

	osg::ref_ptr n=new osg::Vec3Array;
	geom->setNormalArray(n.get());
	geom->setColorBinding(osg::Geometry::BIND_OVERALL);
	n->push_back(osg::Vec3(0.0,-1.0,0.0));
osg::ref_ptr ss1=mTransform->getOrCreateStateSet();

	osg::ref_ptr tex1=new osg::Vec2Array;
	geom->setTexCoordArray(0,tex1.get());
	tex1->push_back(osg::Vec2(0.0,0.0));
	tex1->push_back(osg::Vec2(1.0,0.0));
	tex1->push_back(osg::Vec2(0.0,1.0));
	tex1->push_back(osg::Vec2(1.0,1.0));


		/*int c;
		for (int i = 0; i < ImageHeight; i++) 
		for (int j = 0; j < ImageWidth; j++) 
		{	
			c = (((i&0x8)==0)^((j&0x8)==0))*255;
			checkImage[i][j][0] = (GLubyte) c;
			checkImage[i][j][1] = (GLubyte) c;
			checkImage[i][j][2] = (GLubyte) c;
			checkImage[i][j][3] = (GLubyte) 255;
			}
	


	//osg::ref_ptr image=new osg::Image;
	//image->setImage(64,64,1,4,GL_RGBA,GL_UNSIGNED_BYTE,(unsigned char*)checkImage,osg::Image::USE_NEW_DELETE);

*/
	//osg::ref_ptr image = osgDB::readImageFile( "texture.jpg" );
// Attach the image in a Texture2D object
	//osg::ref_ptr tex = new osg::Texture2D;
	//tex->setImage( image.get() );
	
	ss1->setTextureAttributeAndModes( 0,rendTexture,osg::StateAttribute::ON);
	cout<<"Texture width"push_back(1);
t1->push_back(2);
geom->addPrimitiveSet(t1);

osg::DrawElementsUInt* t2 = 
  new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
t2->push_back(2);
t2->push_back(3);
t2->push_back(1);
geom->addPrimitiveSet(t2);
	geode->addDrawable(geom.get());

	

ss1->setMode( GL_LIGHTING, osg::StateAttribute::OFF);
ss1->setMode( GL_LIGHT1, osg::StateAttribute::ON);
ss1->setMode( GL_NORMALIZE, osg::StateAttribute::ON );
osg::ref_ptr light1 = new osg::Light;
light1->setAmbient( osg::Vec4(0.8,0.8,0.0,1.0));
light1->setDiffuse( osg::Vec4( 1.0,1.0,0.0,1.0 ));
light1->setSpecular( osg::Vec4(1.0,1.0,0.0,1.0 ));
light1->setPosition( osg::Vec4( 0.0,120.0,0.0,1.0));
light1->setDirection( osg::Vec3( 0.f, -1.f, 0.f ));
			//light->setSpotCutoff(25.f );

osg::ref_ptr ma1= new osg::Material;

Re: [osg-users] Need help regarding rendering to a texture

2009-08-18 Thread Robert Osfield
Hi Brett,

Perhaps others can devine what is going wrong in your code, I'm afraid
I have way too much of work backlog to go reviewing uncommented
application code.  If you want others to help you'll want to explain
what you are trying to achieve, and what artifacts you are getting.

Robert.

On Mon, Aug 17, 2009 at 6:25 PM, Brett Thomas Lee wrote:
> Hi robert,
>
>   Thank you! for the reply.I'm attaching my source file can you please tell 
> me where the problem is ??Im getting artifacts!!
>
> Cheers,
> Brett
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=16350#16350
>
>
>
>
> ___
> 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] Need help regarding rendering to a texture

2009-08-17 Thread Robert Osfield
Hi Brett,

Your email doesn't really provide enough details to help you.  For
pre-render examples have a look at osgprerender or
osgprerendercubemap.  Please note the viewer level Camera controls
what the overall scene looks at, the viewer doesn't need a
CameraManipulator though, you can set the viewer Camera's view matrix
directly on each new frame.

Robert.

On Sun, Aug 16, 2009 at 8:24 PM, Brett Thomas Lee wrote:
> Hi,
>
> I am using osg in my rendering engine.I have set the prerender camera using 
> osg and rendered to a texture.Do I need to set another camera for my system 
> to work(is setting camera some thing like a state)??I am asking this because 
> my engine sets its own camera transforms and I dont need osg transforms while 
> rendering to screen.
>
> Thank you!
>
> Cheers,
> Brett
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=16305#16305
>
>
>
>
>
> ___
> 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] Need help using glTexSubImage2D

2009-03-24 Thread Robert Osfield
Hi Luis,

Just call dirty on the Image and it'll get automatically uploaded.

For non power of two images simple use osg::TextureRectangle or a
osg::Texture2D's non power of two texture support.  Please see the osgmovie
example.

Robert.

On Tue, Mar 24, 2009 at 5:52 PM, Luis Rodriguez
wrote:

> Thanks Robert. A couple more questions. How do I guarantee that only the
> changed pixels are uploaded? The source image I'm using is 640x480. To
> maximize compatibility, I need to make texture sizes a power of 2 and square
> right?  That sets the next available size at 1024x1024. That's alot of extra
> data to copy.
>
> If I accessing the Image via the data()  method then there's no way to
> specify the dimensions of the dirty rectangle. I see that copySubImage takes
> a rectangle but the source for copy is an Image object so I'd have to copy
> the image data twice (camera -> tempImage ->texture). Is there something I'm
> missing? Perhapse I should call glTexSubImage2D directly? [/quote]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=9121#9121
>
>
>
>
>
> ___
> 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] Need help using glTexSubImage2D

2009-03-24 Thread Luis Rodriguez
Thanks Robert. A couple more questions. How do I guarantee that only the 
changed pixels are uploaded? The source image I'm using is 640x480. To maximize 
compatibility, I need to make texture sizes a power of 2 and square right?  
That sets the next available size at 1024x1024. That's alot of extra data to 
copy.

If I accessing the Image via the data()  method then there's no way to specify 
the dimensions of the dirty rectangle. I see that copySubImage takes a 
rectangle but the source for copy is an Image object so I'd have to copy the 
image data twice (camera -> tempImage ->texture). Is there something I'm 
missing? Perhapse I should call glTexSubImage2D directly? [/quote]

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





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


Re: [osg-users] Need help using glTexSubImage2D

2009-03-24 Thread Robert Osfield
Hi Luis,

The osg::Texture/osg::Image classes support both texture subloading and
using of PixelBufferObjects so it well equipped for doing live video work.
All you need to do at your end is use an osg::Image or osg::ImageStream that
is assigned to textures you want and each time you update the image data the
texture will automatically update using subloading.

The ImageStream is a subclass from osg::Image that adds extra movie related
methods, and by default the use of PBO to help speed the texture downloads.
You can subclass from osg::ImageStream yourself like the xine-lib, quicktime
and the new ffmpeg plugin do, or just use osg::Image and update the data
using Image::setData or just updated the local pixel image data assigned to
the Image and then call dirty() so that the texture knows about the change.

The other alternative is just to use either the ffmpeg or the quicktime
plugins as they already support reading from live video sources.  For
instance, under Linux,  with the latest OSG dev releases you can use the
ffmpeg plugin to read from a web cam:

  osgmovie -e ffmpeg /dev/video0

Robert.

On Tue, Mar 24, 2009 at 4:13 PM, Luis Rodriguez
wrote:

> Hi,
>
> I'm working on an application that copies video from a web cam to a
> texture. I've done this in the past using glTexSubImage2D when coding
> straight to OpenGL. What is the correct way to do this with OpenSceneGraph?
> I need the route with the least overhead.
>
> Thank you.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=9107#9107
>
>
>
>
>
> ___
> 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] Need Help.........

2009-03-22 Thread Guy
Amit,

 You should place AttitudeAndPosition transform above your geode, there
is also a transformation that deals with 6DOF under osgSimulation.

You should add a callback that updates the position ond direction of the
transform, and you have it.

 

Guy.

 

 

Hello All,

Does anyone have a program for Air combat simulation. I mean, I want a
program which can plot the trajectories of 2 aircrafts doing Combat. I
have the trajectory path (6DOF), but don't know how to make use of it
for animation in OSG. I have gone through 'osganimation' example but not
able to understand the program.

Can anyone please help me in this regard ...

Thank You...

Regards..

Amit.

 

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


Re: [osg-users] Need Help

2009-01-23 Thread Robert Osfield
HI Amit,

>From OSG-2.0 onwards we officially dropped support for Visual Studio
6.  This compiler is terribly broken w.r.t C++ and was becoming very
difficult to maintain support for even before 2.0 came out two years
ago.

MS provide free versions dev tools now so it should be possible grab
these in place of VS 6.0.

Robert.

On Fri, Jan 23, 2009 at 8:18 AM, Amit Kalhapure  wrote:
> Hello all,
>
> I have downloaded osg 2.40 for windows but have some problem in compiling.
> While executing an example file osganimate.cpp in Visual Studio 6, i am
> getting following errors .
>
> c:\program files\openscenegraph\include\osg\operationthread(35) : error
> C2437: 'Referenced' : already initialized
> c:\program files\openscenegraph\include\osgviewer\graphicswindow(45) : error
> C2143: syntax error : missing ',' before '*'
> c:\program files\openscenegraph\include\osgviewer\graphicswindow(45) : error
> C2059: syntax error : '*'
> c:\program files\openscenegraph\include\osgviewer\graphicswindow(156) :
> error C2061: syntax error : identifier 'GraphicsContext'
> c:\program files\openscenegraph\include\osgviewer\graphicswindow(211) :
> error C2143: syntax error : missing ',' before '*'
> c:\program files\openscenegraph\include\osgviewer\graphicswindow(211) :
> error C2059: syntax error : '*'
> Error executing cl.exe.
>
> I don't know how to fix these bugs. I tried alot but all wasted..
> Can anyone please help me in removing these errors
>
> Thank you...
>
>
>
>
> ___
> 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] Need help getting the osg::ColorMask I previously set

2008-06-12 Thread Paul Martz
osg::Texture2D* texture2D =
dynamic_cast(stateset->getTextureAttribute(unit,osg::StateA
ttribute::TEXTURE));
if (texture2D)
  ...

The above is from osgUtil::Optimizer and shows how the TextureAtlasBuilder
gets the Texture2D StateAttribute. You can use a similar method to get any
StateAttribute. For non-texture state, use getAttribute(), for example, and
of course you don't need a 'unit' parameter.
   -Paul
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Judie
> Sent: Thursday, June 12, 2008 2:50 PM
> To: osg-users@lists.openscenegraph.org
> Subject: [osg-users] Need help getting the osg::ColorMask I 
> previously set
> 
> CODE:
> 
> 
> osg::StateSet *stateSet = group->getOrCreateStateSet();
> 
> 
> osg::StateSet::AttributeList& attributes = stateSet-
> >getAttributeList();
> 
> 
> osg::StateSet::AttributeList::iterator aitr = NULL;
> 
> 
> for(aitr= attributes.begin(); aitr!=attributes.end(); ++aitr) {
> 
> 
> osg::StateAttribute::Type temp = (*aitr).first.first;
> 
> 
> if(temp == osg::StateAttribute::COLORMASK)
> {
> 
> 
> osg::ColorMask mask = (*aitr).second.second;
> 
> 
> This won't compile. How can I get the osg::ColorMask from the 
> osg::StateSet::AttributeList::iterator?
> 
> Thanks,
> 
> Judie
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce
negraph.org

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


Re: [osg-users] Need help getting the osg::ColorMask I previously set

2008-06-12 Thread Gordon Tomlinson
Hi

One things I noticed is you do  'osg::ColorMask mask'. This is wrong you
need this to be a pointer to an osg::ColorMask instance 


FYI If you post a question my code won't compile at least provide the
compilation errors...


 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Judie
Sent: Thursday, June 12, 2008 4:50 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Need help getting the osg::ColorMask I previously set

CODE:


osg::StateSet *stateSet = group->getOrCreateStateSet();


osg::StateSet::AttributeList& attributes = stateSet-
>getAttributeList();


osg::StateSet::AttributeList::iterator aitr = NULL;


for(aitr= attributes.begin(); aitr!=attributes.end(); ++aitr) {


osg::StateAttribute::Type temp = (*aitr).first.first;


if(temp == osg::StateAttribute::COLORMASK)
{


osg::ColorMask mask = (*aitr).second.second;


This won't compile. How can I get the osg::ColorMask from the
osg::StateSet::AttributeList::iterator?

Thanks,

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