Re: [osg-users] Switch call to viewer::frame() between threads

2018-09-11 Thread Steven Powers
Thanks for the replies. This is mostly experimental and I have already been 
calling frame() from a child thread for a while now without any problems as 
long as I call createGraphicsContext() and realize() from the same child thread.

This effort is to streamline the initialization of the application on the 
mainthread which would require me to call realize/cGC() on a different thread.

This seems to break all of the windows event control when I start calling 
frame() on a thread other than the one that created the graphics context and 
called realize().

My question is if I can re-initialize this or do I have to create a fresh 
window to get this to work.

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





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


[osg-users] Switch call to viewer::frame() between threads

2018-09-11 Thread Steven Powers
I am attempting to switch which thread I call viewer::frame in. 

I realize my viewer in thread A, call viewer::frame() several times, do some 
loading, then switch the call to viewer::frame() to thread B. When I do so the 
items within the window still update but I am unable to move/resize/select the 
window.

It seems to be dependent on which thread I call viewer::realize from. If I call 
it from thread B then the opposite is true. Or perhaps it is dependent on what 
thread I call createGraphicsContext on???

What is the elegant or appropriate way to accomplish such a feat. Is the 
realize operation thread specific or is it the keyboard handlers?

Thanks in advance for any advice/ help that can be provided.

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





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


Re: [osg-users] Hardware skinning computeBound() calculation

2018-01-30 Thread Steven Powers
So I've concluded that there is extra scaling occurring via the skeleton that 
we have within our model. 

It seems that our skeleton and our geometry are on two different scales and the 
geometry is getting scaled up on the shader to match the skeleton's dimensions.

I think the fix is to match this geometry with a different skeleton that is of 
appropriate scale. In the meantime I will set the initial bound to take this 
extra scaling into account. 

In previous instances a skeleton that is too small/large usually would be 
obvious when an animation started but in this case the vertex/bone weights must 
have been scaled alongside and it was not an obvious error.

Thank you Julien.

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





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


Re: [osg-users] Hardware skinning computeBound() calculation

2018-01-30 Thread Steven Powers
Thanks for the attention Julien.

I'm setting my initial bound for the drawable equal to the computeBound() 
returned by the initial geometry, which gives me radius = 20. This calculation 
does not have the scale applied to it.

The character (a whale in this example) renders with dimensions around 20m 
which should be wrong since there is a scale value of 0.1 applied within it's 
node path. I would expect to see the whale render with dimensions around 2m

Something somewhere is not getting scaled properly. It's either the hardware 
skinning (my guess) or something else. Let me try some things and get back with 
further information.

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





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


Re: [osg-users] Hardware skinning computeBound() calculation

2018-01-30 Thread Steven Powers
I understand this completely and realize that compute bound will return 
something incorrect since the vertices are manipulated on the vertex shader.

I might have misrepresented my issue. 

Even if I set the initial bound to be something I believe is correct... lets 
say radius=20. The problem is that there are scale transforms in the parental 
scene graph somewhere that then shrink this radius down to radius=2.

Currently I traverse the node path and apply the inverse of the scale to the 
initial bound so that initially it is radius=200 and will then pass return it's 
way back up to result in radius=20.

My question is... is this the correct way of doing this? Is there a better way 
to compute the bound of the hardware skinned bounding box or am I doing this 
correctly??

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





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


[osg-users] Hardware skinning computeBound() calculation

2018-01-18 Thread Steven Powers
I've recently run in to what I believe is a bug.

I'm currently using hardware skinning to animate a character and I'm having 
some issues with the bounding box calculation of the character. 

It seems that applying a scale transform in a parent MatrixTransform is giving 
me the wrong bounding box size. 

For example...

compute bound on the drawables gives me the correct bounding box dimensions, in 
this case ~14.0.
As computeBound() returns back through the node path during it's calculation 
the scale gets applied to it and the final radius of the bounding sphere is 
~.14.


I am not sure why this is occurring as this functionality seems to work 
correctly on objects that are not skinned on the hardware.


-Steve

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





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


Re: [osg-users] Write osgText to an FLT file

2016-08-30 Thread Steven Powers
Thanks for the reply Robert.

I'm attempting to get this done in the next 2 weeks so I don't think I can wait 
for a rewrite of osgText.

I don't need to support many of the features. I just need to grab the mesh of 
3D text that will be adhered to other 3D objects. I'll need to grab the vertex 
array, or duplicate it, and the color array but I believe that is it. 

I'll also have to set the polygon offset to match so that there is no 
z-fighting.

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





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


[osg-users] Write osgText to an FLT file

2016-08-28 Thread Steven Powers
Hi everyone.

I need to be able to write and osgText node to an flt file. I realize that this 
is currently not supported but I am interested in adding this capability to the 
openFlight plugin.


>From my initial investigation into this I believe I will have to implement the 
>asGeometry() function to return a geometry object with the vertex list of the 
>osgText node. I'm not sure how to handle the fact that a single osgText node 
>actually contains several geometry objects (one for each character) and 
>asGeometry() can only output a single Geometry.

Is there any advise or guidance that can be offered?

Once I get this working I should be able to submit this for addition into the 
OSG baseline.

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





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


Re: [osg-users] Side by side viewers with different field of view

2016-06-21 Thread Steven Powers
Hi Robert,

Both views have the same eye point (view matrix) and vertical FOV. The only 
thing that differs is the horizontal FOV. I would expect the edges to match but 
I'm not sure why they are not.

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Side by side viewers with different field of view

2016-06-16 Thread Steven Powers
Here are the two cfg files I'm using for the two applications:

Camera "Left Camera"
{
RenderSurface "Default"
{
Visual { SetSimple }
Screen 1;
WindowRect 0 20 640 400;
Border off;
}

ProjectionRectangle 0 1 0 1;

Lens
{
Frustum -0.249328 0.249328 -0.153915 0.153915 1 4;
}
Offset
{
Rotate 28.0 0 1 0;
}
}

Camera "Right Camera"
{
RenderSurface "Default"
{
Visual { SetSimple }
Screen 1;
WindowRect 640 20 1280 400;
Border off;
}

ProjectionRectangle 0 1 0 1;

Lens
{
Frustum -0.531709 0.531709 -0.153915 0.153915 1 4;
}
Offset
{
Rotate -14 0 1 0;
}
}

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





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


[osg-users] Side by side viewers with different field of view

2016-06-16 Thread Steven Powers
I have need a bit of a sanity check as I've been fighting with this all day.

I have two different applications that are rendering the same scene in 
parallel. The only difference is the projection matrix and viewports. I would 
expect both of these windows, when put end to end to match completely. The 
problem is that items in the scene are misaligned vertically but are aligned 
horizontally

Left camera has the following set:
Viewport 0 20 640 400 
Near 1
Far 44000
#frustum angles in degrees
Frustum -14 14 -8.75 8.75
#View Offset (these are offsets from the observer's position in 
degrees) 
ViewOffset1 Rotate -28 0 1 0 

The right camera has the following set:
Viewport 640 20 1280 400 
Near 1
Far 44000
Frustum -28 28 -8.75 8.75   
#View Offset (these are offsets from the observer's position) 
ViewOffset1 Rotate 14 0 1 0 


I've attached a screenshot of the result. (I've cropped it a bit on the sides 
but you can clearly see the seam in the middle. This works completely fine when 
both left and right applications have the same FOV and viewport.

Does anyone know if settings like this should line up? Should they only work if 
the frustum angles match? I'd like to think that they would since they seem to 
line up perfectly on the horizontal but are flawed on the vertical.

What should I do to get them to line up?

Cheers,
Steven

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




Attachments: 
http://forum.openscenegraph.org//files/fovdifference_161.jpg


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


[osg-users] getFrameBufferObject from a child camera

2016-04-21 Thread Steven Powers
I've added a camera as a child to the main view camera. This camera renders to 
a texture using a FBO.

I'm trying to get the FBO of this child camera so I can redirect it to 
different textures during runtime.

I'm attempting to get the FBO using this technique but its not working when the 
camera is added as a child camera. It seems to work fine if it is added as a 
slave camera.


Code:
static osg::FrameBufferObject* getFrameBufferObject(osg::RenderInfo& renderInfo)
{
osg::Camera* camera = renderInfo.getCurrentCamera();
osgViewer::Renderer* camRenderer = 
(dynamic_cast(camera->getRenderer()));
if (camRenderer != nullptr)
{
osgUtil::SceneView* sceneView = camRenderer->getSceneView(0);

if (sceneView != nullptr)
{
osgUtil::RenderStage* renderStage = 
sceneView->getRenderStage();

if (renderStage != nullptr)
{
return renderStage->getFrameBufferObject();
}
}
}

return nullptr;
}




The problem is that the renderer returned from getRenderer() does not cast to 
the osgViewer::Renderer and it returns without finding the FBO.

Any idea what I'm doing wrong?

Thank you!

Cheers,
Steven
Code:




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





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


[osg-users] osganimationhardware does not seem to work with nathan.osg

2015-05-05 Thread Steven Powers
I tried out osganimationhardware with nathan.osg but it does not seem to skin 
the object correctly.

When compared to running the same application with the  --software flag turned 
on the results are VERY different.

With --software turned on it looks like the arms and head move correctly but 
without this flag turned on the animation seems to be somewhat random and not 
following the skeleton at all.

I cant seem to find much that has changed within the RigTransformHardware.cpp 
class since I've seen this work correctly last. (OSG v 2.7). But it seems that 
the boneweight variables withinin skinning.vert are the main culprit. Any 
ideas of what could be going wrong?


I'm trying out the SVN/Trunk now to see if anything has been fixed since 3.2.1

Is anyone else having trouble with this? Can someone confirm that this is 
indeed broken for them as well?


Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Compute shaders halt

2015-03-29 Thread Steven Powers

Markus Hein wrote:
 
 
 I will have this in mind, it seems that this wasn't needed for my tests 
 right now. Why did you need the custom drawable ? Could you explain 
 this? Thanks.
 
 


I had to do this so that the Compute code was always run. Sometimes, 
specifically with multiple compute nodes, only one of the nodes would execute. 
I'm not really sure why. It was not compute program specific, it did the same 
thing if it was a frag/vertex program as well. If I attached the program to the 
drawable node I could assure that it ran every time.


Markus Hein wrote:
 
 btw.: if you are sitting on some nice higher level ParticleSystem 
 implementation, using osg::SSBO and osg::SSBB, maybe this could be a 
 good starting point for a new GPU-based ParticleSystem Library for the OSG ?
 
 Over more than a decade..  we have used the osg::Particle library a lot 
 for our needs , but now it seems that some GPU-based approach must take 
 over.. osg:Particle library was sometimes complicated to work with.
 
 


Unfortunately I don't have this working yet. There are some problems that you 
run into, specifically the number of SSBOs that you can create is finite, and 
you run out fairly quickly. I got around this by creating one big buffer for 
all systems of a particular time. I had to create a memory buffer manager to 
pass open blocks of memory from particle system to particle system. Very 
complex and unfortunately very specific to my implementation. 

I plan on abstracting this out soon but it will take some time to do so. I will 
say that in terms of speed, this approach is light years faster than using 
osg::Particle. I'm using roughly 100 times the number of particles I was using 
before and its about 10 times faster.

Not too shabby.

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





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


[osg-users] Shortcut the cull traversal

2015-03-29 Thread Steven Powers
I have a piece of geometry that has a lot of interior articulated parts / light 
points etc. They are all within the main groups bounding box and will never 
cause the bounding box to be extended. 


These extra nodes cause my cull traversal to be extended due to the increased 
scene graph complexity. Is there a way that I can shortcut the traversal so 
that it does not visit all of the child nodes and simply uses a staticly sized 
bounding box that I set manually. Then it will draw everything in the scene 
graph if the main node is not culled out?

Thank you!

Cheers,
Steven

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





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


[osg-users] Create texture from texture handle

2015-03-16 Thread Steven Powers
HI!

Currently I have this texture getting generated by a plugin that I'm using:

glGenTextures(1, textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, N, M, 0, GL_RGB, GL_FLOAT, 
NULL);

Is there an easy way to create an osg::Texture2D to use the same texture 
handle? So far it looks like textures generate their own handles. I can't do 
away with the OpenGL code.

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Compute shaders halt

2015-03-16 Thread Steven Powers
I've found a solution for this issue.

First, the compute node and result geometry must be assured to be in the same 
render bin.

2nd, attach the compute node program to a custom drawable node and turn off 
display lists so that is guaranteed to be executed every frame. 




Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Compute shaders halt

2015-03-12 Thread Steven Powers
Hi,

I don't think there is anything special about the geometry. I also had the 
issue that the compute shader would only work if it had the axis.osgt appended 
to it's scene graph.

Is it necessary that the compute shader always appear previous to the 
resultsRenderTree in the scene graph? It might be a draw order issue as some 
times changing the renderbin of both the compute node and the results tree 
fixes my problem.


Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Compute shaders halt

2015-03-12 Thread Steven Powers
Markus, more specifically... when is the appropriate time to call the 
glDispatchCompute() function?

Thank you!

Cheers,
Steven

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





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


[osg-users] Compute shaders halt

2015-03-02 Thread Steven Powers
Hi, I'm using the compute SSBO technique to handle a particle system.

I have everything working but in some cases the compute shader stops 
functioning and the particle system freezes. This seems to happen when a 
particular geometry in the scene is drawn. If the geometry is culled the 
particle system works just fine. 

The scene graph looks like this:

-Group
+computeNode (with the SSBO and compute shader attached)
  - Group
  + rendering particle system with geom/vert/frag shaders 
attached
+ test geometry (readNodeFile(test.osg))


If the test geometry is off screen the computeNode functions fine. If it is on 
screen the computeNode no longer runs the compute shader. 

Also, if I attach a static geometry (read from a file) to the computeNode this 
problem no longer occurs. Even if that geometry is loaded from the same file as 
the test geometry.

When it works the scene graph looks like this:

-Group
+computeNode (with the SSBO and compute shader attached)
  - Group
  + rendering particle system with geom/vert/frag shaders 
attached
  - test geometry (readNodeFile(test.osg))
+ test geometry (readNodeFile(test.osg))


Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Shader storage buffer object

2014-12-02 Thread Steven Powers
I'm actively working on this as well. Could you send me the zip file so that I 
can try it out?

Cheers,
Steven

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





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


[osg-users] Angular magnification

2014-05-22 Thread Steven Powers
Currently I am simulating magnification by manipulating the projection matrix 
like this:



Code:
left   = nearClip * tan(atan(_left  /_nearClip)/_magnification);
right  = nearClip * tan(atan(_right /_nearClip)/_magnification);
top= nearClip * tan(atan(_top   /_nearClip)/_magnification);
bottom = nearClip * tan(atan(_bottom/_nearClip)/_magnification);


_camera-setProjectionMatrixAsFrustum(left,right,bottom,top,nearClip,farClip);





I've been posed a question as to whether this method of magnification is 
angular or linear. Does anyone know the answer to this question?

Cheers,
Steven

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





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


[osg-users] Issues with alpha blended texture overlay

2014-04-17 Thread Steven Powers
Hi,

I tried to add a texture overlay that gets rendered through an orthographic 
projection at the top of the scene graph. When I do so all objects in the 
background of the scene that have transparency are no longer visible.

What am I doing wrong?

The texture is a png with transparency applied to a quad and GL_BLEND is turned 
on. Objects without transparency can still be seen.

stateset-setMode(GL_BLEND,osg::StateAttribute::ON);

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Issues with alpha blended texture overlay

2014-04-17 Thread Steven Powers
That was it! I thought I had already tried that but I think I might have put it 
on the wrong node.

Thank you!

Cheers,
Steven

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





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


[osg-users] Modify Alpha Test Value

2014-02-13 Thread Steven Powers
Hi,

How can I modify the alpha test value used in GL_ALPHA_TEST??

Thank you!

Cheers,
Steven

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





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


[osg-users] FBX piecemeal animations

2012-04-05 Thread Steven Powers
Is it possible to load animations separately from the mesh/bone fbx file 
structure?

I dont see an osg plugin for loading *.bip files but could they be compiled 
into a fbx file and loaded that way?


Cheers,
Steven

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





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


[osg-users] GraphicsWindowingSystem ::DestroyWindow() crash

2012-03-28 Thread Steven Powers
I'm having an issue with window initialization. The crash occurs on the 
GraphicsWindowWin32::setPixelFormat() return. 

Specifically within the ~OpenGLContext() destructor on this line:

Line 558-   ::DestroyWindow(_hwnd);

The crash seems to be caused by some sort of a race condition but I can't seem 
to identify what the cause could be. The _hwnd value always seems to be valid 
and matches the value assigned during the CreateWindowEx() call. Commenting 
DestroyWindow() out works perfectly.

I'm running OSG 3.0.1 and the crash occurs within the osgviewer application as 
well.

My machine is a laptop with both Intel HD Integrated graphics and an Nvidia 
Quadro 4000M. The hard drive has full disk encryption if that makes a 
difference.

Any advice?

Cheers,
Steven

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





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


[osg-users] Skeletal Animation Advise

2011-12-22 Thread Steven Powers
Hi,

I am currently running with OSG v2.8.2 and I am required to add in skeletal 
animation support.

I'm wondering what the best file formats will be best suited to do this and if 
it would be a good idea to upgrade OSG to a version that includes the FBX 
plugin.

From reading the forums it seems FBX is the best approach, assuming I upgrade 
my OSG version, but is there a solution that would work well with OSG 2.8.2??


Thank you!

Cheers,
Steven

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





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


Re: [osg-users] osgShadow texture problem

2011-02-09 Thread Steven Powers
I'll add that (at least in version 2.8.3) changing the texture unit for the 
shadows does not update the shadow technique's shader code. You'll have to 
override the default shader code to align with whatever texture unit you choose 
to use for the shadows.

Cheers,
Steven

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





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


[osg-users] Mixing GLSL shaders and ARBv1.0 shaders

2011-01-27 Thread Steven Powers
I'm working with some legacy code that uses ARBv1.0 shader code for some of the 
leaf nodes.

The ARB shaders work just fine but they are never envoked when I place a GLSL 
shader (simple shadowing shader) on the root node.

I've tried setting the mask of the ARB shader to ON | OVERRIDE | PROTECTED and 
I made sure the mask of the GLSL shader is ON | OVERRIDE.

If I swap the ARB shader on the leaf node with a stand-in GLSL shader it works 
fine.

Some differences:

ARB shaders are loaded as osg::VertexProgram and osg::FragmentProgram

GLSL shaders are loaded as osg::Program with osg::Shader attached.

Both implementations share the same Node with identical state sets.

Any clues are appreciated.

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Mixing GLSL shaders and ARBv1.0 shaders

2011-01-27 Thread Steven Powers
Brilliant!

That did the trick. Luckily the code to apply an ARB shader is consolidated to 
a single function. Otherwise I'd have to add these lines everywhere and ARB 
shader was added.



Thank you!

Cheers,
Steven

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





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


Re: [osg-users] PERSPECTIVE --FIELD OF VIEW

2011-01-13 Thread Steven Powers
I'll clarify this a little more...

fovX = fovY * Aspect

Normally you want the Aspect (or aspect ratio) field of view to equal the 
aspect ratio of the viewport.

Hope that helps

Cheers,
Steven

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





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


Re: [osg-users] [osgPlugins] Troubles building osg_Freetype plugin

2011-01-06 Thread Steven Powers
Does anyone still have these binaries? I'm running into the same problem and 
need the new build of freetype

Thank you!

Cheers,
Steven

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





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


[osg-users] [build] freetype plugin wont build

2011-01-05 Thread Steven Powers
I know this has been asked before but everything I've tried off this forum has 
not worked.

I'm attempting to build the freetype plugin using VS 2003 .Net SP1 and OSG 
v2.8.3 but I'm not having any luck.

What I've done so far:
1. Dowloaded 3rdParty binaries from 
http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/3rdParty/branches/3rdParty_win32binaries_vs71/
2. Installed 3rdParty files to 3rdParty
3. set FREETYPE_INCLUDE_DIR_freetype2 to 3rdParty/include/freetype
4. set FREETYPE_INCLUDE_DIR_ft2build to 3rdParty/include/
5. set FREETYPE_LIBRARY_DEBUG to 3rdParty/lib/freetype219_D.lib

I don't get any errors when I run Configure or Generate but the freetype plugin 
project file is never created.

What gives? Do I need a newer version of freetype?

The OSG site seems to be down still so I can't leverage that as a resource 
until it is back up.

I'm somewhat out of ideas.

Thank you!

Cheers,
Steven

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





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


Re: [osg-users] [build] freetype plugin wont build

2011-01-05 Thread Steven Powers
Bingo!

Thanks for the quick response! I wasted hours scratching my head on this one.


Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Question about camera autoComputeHomePosition

2010-12-10 Thread Steven Powers
I think you misunderstand how the projection matrix works

setProjectionMatrixAsPerspective is defined with the parameters (vFov, aspect, 
near, far)

vFov sets the vertical field of view of the perspective meaning you will have a 
wider viewing angle the larger the value gets.

aspectRatio is used to determine the horizontal FOV

near defines the near clipping plane

far defines the far clipping plane

Increasing the vFOV will make items in the scene appear shorter away but their 
distance from the camera will remain unchanged. 

Cheers,
Steven

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





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


Re: [osg-users] rain/snow accumulation on the screen

2010-12-10 Thread Steven Powers
I'm going to preface my comment by saying I've never done an effect like this 
before. I am, however, interested in how this could be accomplished.

Adding in the wiper effect adds a particularly difficult layer of complexity to 
an effect like this. 

I would still suggest using a shader to do this effect. You would have to 
update the wiper's position as a uniform value per frame. You can then choose 
to apply the raindrop texture to pixels on one side of the wiper and then dont 
apply the texture to pixels on the other side of the wiper.

You can also do this if your procedurally creating the raindrops on the fly.

Cheers,
Steven

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





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


Re: [osg-users] rain/snow accumulation on the screen

2010-12-02 Thread Steven Powers
I'd use a pixel shader for the effects. Pass in the texture that represents the 
snow overlay and have the shader scale the alpha up and down as it accumulates.

Rain would be handled the same way but you'd have to come up with a way to make 
the water droplets move around on the screen. That should be possible in the 
shader as well.


Thank you!

Cheers,
Steven

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





___
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


[osg-users] Texture unit ID's conflicting

2010-08-23 Thread Steven Powers
I'm using OSG v2.4.

I'm having some problems with conflicting texture unit ID's.

In practice, I'm creating 2 textures and storing shader relevant data in them.
I'm assigning them to the state set using setTextureAttributeAndModes(1,...) 
and setTextureAttributeAndModes(2,...) but some objects in the scene must also 
have textures defined for these texture units. 

This causes an override of the data I've assigned to texture unit 1 and 2. 

Is there a way to keep this from happening?





Cheers,
Steven

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





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


Re: [osg-users] GraphicsContext resizedCallback/resizedImplementation bug

2009-09-04 Thread Steven Powers
Hi,

I suspected that as well ... but I browsed the source code for 2.8.2 and it 
looked like it would exhibit the same problem.

It might be a couple months before I am able to upgrade to 2.8.2.

Thank you!

Cheers,
Steven

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





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


[osg-users] GraphicsContext resizedCallback/resizedImplementation bug

2009-09-03 Thread Steven Powers
Hi,
OSG 2.2
The original issue:
I have a graphics context with multiple cameras. Some of which are rendering to 
an attached image. When I resize the graphics context ALL of the camera's 
viewports are resized. I did not want this to happen so I defined my own 
ResizedCallback which will only resize Cameras that I tell it to.

Issue with ResizedCallback:
I can resize the camera's I want to and leave the others the way they are just 
fine. But since I defined my own ResizedCallback GraphicsContext no longer 
updates the following values as it would normally do in 
GraphicsContext::resizedImplementation().


Code:

_traits-x = x;
_traits-y = y;
_traits-width = width;
_traits-height = height;




Now when I query these values from GraphicsContext they no longer equate to the 
values I set by resizing the context. 

This is because GraphicsContext::resizedImplementation() is not called when a 
ResizedCallback is set. It is impossible to set the traits values in the 
ResizedCallback since the values are private.

To repair this I would change:


Code:

void resized(int x, int y, int width, int height)
{
if (_resizedCallback.valid()) 
_resizedCallback-resizedImplementation(this, x, y, width, height);
else resizedImplementation(x, y, width, height);
}





to 


Code:

void resized(int x, int y, int width, int height)
{
if (_resizedCallback.valid()) 
_resizedCallback-resizedImplementation(this, x, y, width, height);
else resizedImplementation(x, y, width, height);
_traits-x = x;
_traits-y = y;
_traits-width = width;
_traits-height = height;  


  }





Or something similar.


Thank you!

Cheers,
Steven[/code]

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





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


Re: [osg-users] RTT with FBO then copy Texture to image using PBO results in blank image.

2009-08-10 Thread Steven Powers

art wrote:
 Hi Steven,
 
 
  
  I've tried assigning the attached texture (without running the callback) to 
  a quad in the scene and it is still blank.
  
 
 
 If your RTT texture is black without any post processing, so maybe you forgot 
 to add any scene below your RTT camera in the scene graph? For example your 
 scene graph can look like this:
 
 root
 |
 +--- rtt camera -- (scene)
 |
 +--- main camera -- (scene)
 
 
 Also check if your transformations of the rtt camera are correct. It happens 
 sometimes, that one just don't see anything in the RTT cameras, because rtt 
 camera is just looking in wrong direction.
 
 Oh, also to copy your processed data into an image, there exists already 
 classes in osg, which can do this. See osg::PixelBufferObject or 
 osg::PixelBufferDataObject. Also for any processing of your textures, it is 
 easier to use osgPPU for that task ;)
 
 cheers,
 art



unfortunately this is not the case. If I attach an osg::Image , rather than an 
osg::Texture, to the camera I will get the correct frame buffer output. Of 
course the work done by the third party software is done after the osg::Image 
is populated by OSG.

Any other ideas?

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





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


[osg-users] RTT with FBO then copy Texture to image using PBO results in blank image.

2009-08-07 Thread Steven Powers
Hi,
using OSG 2.2

I'm currently rendering to a texture using a FBO with an attached texture:

Code:

_texture = new osg::Texture2D();
_texture-setTextureSize((int)_camera-getViewport()-width(),(int)_camera-getViewport()-height());
_texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
_texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
_camera-attach(osg::Camera::COLOR_BUFFER, _texture.get(), 0,0,false);
_camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
_camera-setRenderOrder(osg::Camera::PRE_RENDER);




A 3rd party lib processes the texture in a postCallBack call:


Code:

virtual void operator()(const osg::Camera cam) const
{
if (cam.isRenderToTextureCamera())
{
osg::Camera::BufferAttachmentMap bam = cam.getBufferAttachmentMap();
osg::Camera::BufferAttachmentMap::iterator iter = 
bam.find(osg::Camera::COLOR_BUFFER);
if (iter != bam.end())
{
osg::Texture *tex = iter-second._texture.get();
if (tex)
{
osg::Texture::TextureObject *texObj = ((osg::Texture2D 
*)tex)-getTextureObject(0);
int id = ((osg::Texture2D *)tex)-getTextureObject(0)-_id;

//do some processing here

copyToImage(cam, tex);
} 
}




My copyToImage() method creates a PBO to the texture and attempt to dump the 
memory into an associated osg::Image (really just a block of memory). This code 
was used to pull from the frame buffer using ReadPixels() which worked fine.


Code:


void copyToImage(const osg::Camera camera, osg::Texture* tex = 
NULL) const
{

if (image.valid()  image-data())
{
int pixel_depth_bytes;
OpenThreads::ScopedLockOpenThreads::Mutex 
lock(_mutex);

const osg::GraphicsContext *gc = 
camera.getGraphicsContext();
osg::BufferObject::Extensions* ext = 
osg::BufferObject::getExtensions(gc-getState()-getContextID(), true);
if (ext-isPBOSupported())
{
if (gc-getTraits())
{
int width = 
(int)camera.getViewport()-width();//gc-getTraits()-width;
int height = 
(int)camera.getViewport()-height();//gc-getTraits()-height;
int x = 
(int)camera.getViewport()-x();
int y = 
(int)camera.getViewport()-y();
pixel_depth_bytes = 
gc-getTraits()-depth / 8;

if (width != _width || height 
!= _height || x != _x || y != _y)
{
_width = width;
_height = height;
_x = x;
_y = y;
if (_pbo)
{

ext-glDeleteBuffers(1,_pbo);
_pbo = 0;
}
}
}

//disable clamping
osg::ClampColor::Extensions *clamp_ext 
= osg::ClampColor::getExtensions(gc-getState()-getContextID(), true);
if (clamp_ext-isClampColorSupported())
{
clamp_ext-glClampColor( 
GL_CLAMP_READ_COLOR, GL_FALSE );
clamp_ext-glClampColor( 
GL_CLAMP_VERTEX_COLOR, GL_FALSE );
clamp_ext-glClampColor( 
GL_CLAMP_FRAGMENT_COLOR, GL_FALSE );
}

glReadBuffer(GL_BACK);

//configure pbo
unsigned int data_size = _width * 
_height * sizeof(float) * 4;
if (_pbo)
{
//bind for writing (pack)

ext-glBindBuffer(GL_PIXEL_PACK_BUFFER, _pbo);
} else
{
//create and bind for writing 
(pack)

Re: [osg-users] RTT with FBO then copy Texture to image using PBO results in blank image.

2009-08-07 Thread Steven Powers
Hi,

I should add that the RTT Texture is attached to one of two osg::Cameras in the 
scene.



Thank you!

Cheers,
Steven

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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-19 Thread Steven Powers
Guy, Good Catch. Unfortunately that is just a typo in the post. My actual 
shader only writes out 4 values.

I do need to pass values along the alpha channel outside of 0-1. But even if I 
restrict myself to values from 0-1 I still get the incorrect data passed down 
to the image.

Any other ideas?

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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-19 Thread Steven Powers
I noticed something else that is interesting... 

When I use the following shader code:

gl_FragColor = vec4(vVertPos.xyz , 1);
(where vVertPos.xyz is the calculated 3D position) 

I get an accurate point cloud of the 3D points that matches up with the 
geometry of the scene perfectly.

When I use this shader code:

float depth = gl_FragCoord.z / gl_FragCoord.w;
gl_FragColor = vec4(vVertPos.xyz , depth);

I get what looks like the same point cloud but it is scaled up in every 
direction. Does this ring any bells for anyone?

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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-19 Thread Steven Powers
So far the alpha channel is completely ignored beyond the shader. I set each 
vertex of the point cloud based off the r,g,b channels of the image buffer.

Before I add the vertex to the point cloud the r,g,b channels of the image 
already seem to be scaled. I check this by logging the image values.

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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-19 Thread Steven Powers
Here is my shader code in its entirety.

Code:

//Shaders
const char VertexShaderSrc[]  = 
varying vec4 vVertPos;
attribute vec4 gl_MultiTexCoord0;
uniform mat4 osg_ViewMatrixInverse;
uniform vec3 worldOffset; //offset from world origin
void main(void)
{
   gl_Position = ftransform();
   vec4 eyeVector = gl_ModelViewMatrix * gl_Vertex;
   vVertPos = osg_ViewMatrixInverse * eyeVector;
   vVertPos.xyz = vVertPos.xyz - worldOffset;  //apply offset so it is 
in ansRel coordinates
   gl_TexCoord[0] = gl_MultiTexCoord0;
};

const char  FragShaderSrc[] = 
varying vec4 vVertPos;
uniform float minimumDistance;
uniform float maximumDistance;
uniform bool sendDepth;
void main(void)
{
   float depth = gl_FragCoord.z / gl_FragCoord.w;
   gl_FragDepth  = depth / maximumDistance;
   if(abs(depth)  minimumDistance || abs(depth)  maximumDistance)
   {
   gl_FragColor = vec4(0,0,0, 1);
   }
   else
   {
   if(sendDepth)
   {
   gl_FragColor = vec4(depth, depth, depth, depth);
   }
   else
   {
   gl_FragColor = vec4(vVertPos.xyz , 1);
   }
   }
} ;




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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-18 Thread Steven Powers

danielh wrote:
 Try attaching a texture to the COLOR_BUFFER0 instead of an image directly.
 That's what worked for me.



Thats what this code is doing. I've written to COLOR_BUFFER0 and whenever I 
change the shader alpha value to something other than 1 all color values come 
back incorrect.

This will be read correctly:
 
Code:
gl_FragColor = vec4(1,2,3,4, 1);



But this will be read incorrectly:

Code:
gl_FragColor = vec4(1,2,3,4, .5);



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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-18 Thread Steven Powers
Thanks JP but I dont see any attached code.

Also I'm running OSG 2.2 which doesnt have the multiplerendertargets example.

Could this be a bug with OSG2.2 ??

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





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


Re: [osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-13 Thread Steven Powers
I read that post... but his fix did not work for me. I'm running OSG 2.2, 
perhaps that makes a difference.

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





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


[osg-users] Setting alpha channel in Frag Shader does not work.

2009-03-12 Thread Steven Powers
Camera Set up:
   
Code:

_image = new osg::Image();

_image-allocateImage(_camera-getViewport()-width(),_camera-getViewport()-height(),
 1, GL_RGBA, GL_FLOAT);
}
_image-setInternalTextureFormat(GL_RGBA32F_ARB);
_image-setPixelFormat(GL_RGBA);
_image-setDataType(GL_FLOAT);

//redirect rendering to frame buffer object

_camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

_camera-attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),_image.get());
_camera-setRenderOrder(osg::Camera::PRE_RENDER);




In the shader I set: 

Code:
 gl_FragData[0] =vec4(0.12, 5, 0.000705882, 1); 



I can retrieve the RGB values. 
However, if I set the alpha channel to anything but 1 ie:

Code:
gl_FragData[0] =vec4(0.12, 5, 0.000705882, .5);



I seem to get random values. 

Any idea why this is happening?

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





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


Re: [osg-users] GL_RGBA32F_ARB Pixel Buffer

2009-03-11 Thread Steven Powers
That looks like it did it! Thanks!

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





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


[osg-users] GL_RGBA32F_ARB Pixel Buffer

2009-03-10 Thread Steven Powers
I'm getting all 0s for my pixel buffer when I use GL_RGBA32F_ARB as the pixel 
format.
It works fine with GL_RGBA.

This is how I set it up:

i = new osg::Image();
i-setPixelFormat(GL_RGBA32F_ARB);
i-setDataType(GL_FLOAT);
  
camera-attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),i.get());
   camera-setRenderOrder(osg::Camera::PRE_RENDER);
   camera-setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER);

Then when I try to retrieve the pixel values:

if (_image.valid()  _image.get()  _image.get()-data())
{

float *tempData = (float*)_image.get()-data();
for (int i = 0; i  sliceVPX * sliceVPY; i+=4)
{

debugDebug::infoPix [i] = tempData[i], 
tempData[i+1], tempData[i+2], tempData[i+3]\n;

}
}


I get all zeros. 

Can anyone help me out. again using GL_RGBA and GL_UNSIGNED_BYTE works fine.

I'm using OSG 2.2

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





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


Re: [osg-users] GL_RGBA32F_ARB Pixel Buffer

2009-03-10 Thread Steven Powers
sliceVPX and sliceVPY are the viewport dimensions.

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





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


[osg-users] dynamic_cast from scene graph

2008-05-20 Thread Steven Powers
This might be more of a general C++ question but I'm having the
following problem:

I have a MatrixTransform derived class called Entity 

Ie. sgm::Entity : public MatrixTransform.

I use it to define a couple extra data values that I would like to store
and overload some of the inherited functions. I added a node with
geometry to the Entity via Entity::AddChild(node);

It works fine and behaves like I would expect when I add it to the scene
graph but when I use picking to pull the node out of the scene graph and
follow the path to its parental Entity I am unable to call dynamic_cast
on it and get a non-NULL result.

If I use the same procedure and instead try a dynamic cast to an
osg::MatrixTransform it works just fine.

I've also tried getParentalNodePaths() and followed them all the way up
to the root to be sure that I would come across an osg::Node that
actually is an Entity.


Any Idea why I wouldn't be able to dynamically cast the Node to an
Entity?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] wxWidgets onKeyDown Event not called

2008-05-14 Thread Steven Powers

Still having the problem...

I've looked at Mario's example and he's added the following to the
onKeyDown Code:

int GraphicsWindowWX::adaptKey(wxKeyEvent event)
{
#if wxUSE_UNICODE
int key = event.GetUnicodeKey();
#else
int key = event.GetKeyCode();
#endif
bool caps_lock = ::wxGetKeyState(WXK_CAPITAL);

int em = event.GetModifiers();
if( ((em  wxMOD_SHIFT) == wxMOD_SHIFT) ^ caps_lock)
{
key = toupper(key);
}
else
{
key = tolower(key);
}
if( em  wxMOD_CONTROL)
{
key = 0x1F;
}

return key;
}

void GraphicsWindowWX::OnKeyDown(wxKeyEvent event)
{
int key = adaptKey(event);
getEventQueue()-keyPress(key);

// propagate event
event.Skip();
}

void GraphicsWindowWX::OnKeyUp(wxKeyEvent event)
{
int key = adaptKey(event);
getEventQueue()-keyRelease(key);

// propagate event
event.Skip();
}
 
 The problem I am having is that OnKeyDown and OnKeyUp methods are never
called when I press a key. The mouse handler functions work fine so I
can control the camera with the mouse. They key press events are not
detected within wxWidgets or OSG EventHandlers.

Anyone else have some Ideas???
Thanks- 
Steve




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Powers
Sent: Tuesday, May 13, 2008 10:24 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Yes Please do. I remember reading from the archives that it was sending
'S' rather than 's'. But I think my problem might be different. I cant
get the OnKeyDown Method to be called at all. When I place breakpoints
inside of the function they are never hit.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mario
Valle
Sent: Tuesday, May 13, 2008 10:14 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Yes.
The example included in OSG need a little fix to make the 's'
(statistics) handler work.
If you want I can send you an example.
Ciao!
mario


Steven Powers wrote:
 Has anyone been able to get the keyboard handlers to work within the
 osgViewerWx example?
  
  
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
Steven
 Powers
 Sent: Monday, May 12, 2008 11:53 AM
 To: OpenSceneGraph Users
 Subject: [osg-users] wxWidgets onKeyDown Event not called
 
 
 I cant seem to get the onKeyDown/onKeyUp events to get called within
the
 osgViewerWx example. The mouse/resize/draw event handlers work just
 fine.
 
 I'm using the unchanged source from OSG 2.2 and wxWidgets 2.8.7.
 
 Thanks in advance,
 
 Steve
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

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

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

-- 
Ing. Mario Valle
Data Analysis and Visualization Services |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91)
610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91)
610.82.82
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] wxWidgets onKeyDown Event not called

2008-05-14 Thread Steven Powers


I added SetFocus() to the onMouse handler and it worked like a charm!

Thanks everyone for your help!

-Steve
 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Thibault Genessay
Sent: Wednesday, May 14, 2008 10:05 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Hi Steven

On Wed, May 14, 2008 at 3:42 PM, Steven Powers [EMAIL PROTECTED] wrote:

 Still having the problem...

  The problem I am having is that OnKeyDown and OnKeyUp methods are
never
 called when I press a key. The mouse handler functions work fine so I
 can control the camera with the mouse. They key press events are not
 detected within wxWidgets or OSG EventHandlers.

 Anyone else have some Ideas???


Have you checked that the proper event binding mechanism is set on the
wxWidgets side ? You might have bound mouse events to your window but
not keyboard events.

You might also investigate focus issues as normally wxWidgets sends
keyboard events to the window that has the focus (OTOH mouse events
are sent to the window under the cursor, hence their correct
behavior). You can try to call SetFocus() from within your mouse event
handler when you detect a left down event so that your window is ready
to capture subsequent key presses.

Hope this helps

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


Re: [osg-users] wxWidgets onKeyDown Event not called

2008-05-13 Thread Steven Powers

Has anyone been able to get the keyboard handlers to work within the
osgViewerWx example?
 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Powers
Sent: Monday, May 12, 2008 11:53 AM
To: OpenSceneGraph Users
Subject: [osg-users] wxWidgets onKeyDown Event not called


I cant seem to get the onKeyDown/onKeyUp events to get called within the
osgViewerWx example. The mouse/resize/draw event handlers work just
fine.

I'm using the unchanged source from OSG 2.2 and wxWidgets 2.8.7.

Thanks in advance,

Steve




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


Re: [osg-users] wxWidgets onKeyDown Event not called

2008-05-13 Thread Steven Powers
Yes Please do. I remember reading from the archives that it was sending
'S' rather than 's'. But I think my problem might be different. I cant
get the OnKeyDown Method to be called at all. When I place breakpoints
inside of the function they are never hit.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mario
Valle
Sent: Tuesday, May 13, 2008 10:14 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] wxWidgets onKeyDown Event not called

Yes.
The example included in OSG need a little fix to make the 's'
(statistics) handler work.
If you want I can send you an example.
Ciao!
mario


Steven Powers wrote:
 Has anyone been able to get the keyboard handlers to work within the
 osgViewerWx example?
  
  
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
Steven
 Powers
 Sent: Monday, May 12, 2008 11:53 AM
 To: OpenSceneGraph Users
 Subject: [osg-users] wxWidgets onKeyDown Event not called
 
 
 I cant seem to get the onKeyDown/onKeyUp events to get called within
the
 osgViewerWx example. The mouse/resize/draw event handlers work just
 fine.
 
 I'm using the unchanged source from OSG 2.2 and wxWidgets 2.8.7.
 
 Thanks in advance,
 
 Steve
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

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

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

-- 
Ing. Mario Valle
Data Analysis and Visualization Services |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91)
610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91)
610.82.82
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] wxWidgets onKeyDown Event not called

2008-05-12 Thread Steven Powers

I cant seem to get the onKeyDown/onKeyUp events to get called within the
osgViewerWx example. The mouse/resize/draw event handlers work just
fine.

I'm using the unchanged source from OSG 2.2 and wxWidgets 2.8.7.

Thanks in advance,

Steve




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


Re: [osg-users] Point cloud culling/paging

2008-04-30 Thread Steven Powers
I messed around a little and I believe I found the fix.

Adding:

osg::Depth *newDepth = new osg::Depth(osg::Depth::ALWAYS);
set-setAttribute(newDepth);

to the state set seemed to do the trick. Instead of culling the points
the terrain was simply getting placed on top of it.

Thanks for the help everyone!
 
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Guy
Sent: Wednesday, April 30, 2008 2:58 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

Hi,
 Maybe you should try to replace the terrain with some other object. At
the start a small object near the points could, then make it farther and
farther from the points cloud, then try bigger and bigger objects. This
might tell you if there is something bad specifically in the terrain.

Guy.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Powers
Sent: Thursday, April 24, 2008 7:33 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging


I've added a _geometry-dirtyBound() to be called each visit but that
didn't help.

I printed out the bounding sphere data and as it does change slightly it
looks correct even when the square sections of the point cloud disappear
and reappear.

Any other ideas? Could this have something to do with the terrain being
visible? This only seems to happen if the terrain is visible to the
camera via its NodeMask. 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian R
Hill
Sent: Thursday, April 24, 2008 1:02 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

Steve,

Verify that your bounding sphere is what you think it should be. Print
out
the point cloud's bounding sphere every frame and check that it's
correct.

osg::BoundingSphere bs = pointcloud-getBound():
std::cout  Ctr   bs.center()   rad   bs.radius()  \n;

Brian

[EMAIL PROTECTED] wrote: -


To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
From: Steven Powers [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
Date: 04/24/2008 11:11AM
Subject: [osg-users] Point cloud culling/paging


I'm experiencing some weird problems with my point cloud.

I have a fairly large terrain and a point cloud that expands the whole
terrain. When I build the point cloud and look around the environment
whole
sections of the point cloud disappear when they aren't centered within
the
camera's view. They will then reappear when the center of the missing
section is within view.

The point cloud is a POINTS primitive set and I have turned culling off
(
setCullingActive (false)) as well as display lists.

I've noticed that if I do not add the terrain model to the scene it
works
ok.

What culling/paging option do I need to set to make sure this doesn't
happen?

-Steve



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

-

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit
written
agreement or government initiative expressly permitting the use of
e-mail
for such purpose.



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


Re: [osg-users] Shader Program on Slave Computer

2008-04-24 Thread Steven Powers
Thanks for the input.
 
I realized this before and made the correction but it still seems to
ignore the shader when it is applied to a slave camera's state set.
 
Do slave cameras ignore their state sets?
 
I'm running OSG 2.2
 
-Steve
 
 
Hi Steven,
 
You're using the logical or operator || rather than bitwise or |. If

any parents of the camera are using the OVERRIDE flag on a shader, this 
can cause the problem you describe.
 
Mark
 
Steven Powers wrote:
 Let me know if you need more code than this. I can throw together a
full 
 executable if it is needed.
 
 So far I've added a camera as a slave camera to the viewer. I have no 
 problems doing that.
 
 viewer-addSlave(_camera);
 
 Then when I add a shader to the slave camera:
 
osg::ref_ptrosg::StateSet ss =
_camera-getOrCreateStateSet();
  //shaders
 osg::ref_ptrosg::PolygonMode mode = new osg::PolygonMode;
 mode-setMode(osg::PolygonMode::FRONT_AND_BACK, 
 osg::PolygonMode::FILL);
 osg::ref_ptrosg::Program program = new osg::Program;
 program-setName( SimpleShader);
 program-addShader( new osg::Shader( osg::Shader::VERTEX, 
 simpleVertexShaderSrc ) );
 program-addShader( new osg::Shader( osg::Shader::FRAGMENT, 
 simpleFragShaderSrc ) );
 
 ss-addUniform(0);
 ss-setAttributeAndModes( program.get(),
osg::StateAttribute::ON || 
 osg::StateAttribute::OVERRIDE || osg::StateAttribute::PROTECTED);
 ss-setAttributeAndModes( mode.get(), osg::StateAttribute::ON
|| 
 osg::StateAttribute::OVERRIDE || osg::StateAttribute::PROTECTED);

 
 The shader does not seem to be invoked. If I use this same code and
but add 
 the shader to the root node:
 
 //osg::ref_ptrosg::StateSet ss =
_camera-getOrCreateStateSet();
 osg::ref_ptrosg::StateSet ss =
_renderRoot-getOrCreateStateSet();
 
 the shader works appropriately but is used on all cameras. I can throw

 together a quick example program that will illustrate the problem if
you need 
 more code than this.
 
 I have also tried removing the slave camera then re-adding it after I
attach 
 the shader to it.
 This same code works if I add the camera to the scene rather than
adding it 
 as a slave camera.
 
 
 
 Thanks,
 
   
 
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Point cloud culling/paging

2008-04-24 Thread Steven Powers
I'm experiencing some weird problems with my point cloud.
 
I have a fairly large terrain and a point cloud that expands the whole
terrain. When I build the point cloud and look around the environment
whole sections of the point cloud disappear when they aren't centered
within the camera's view. They will then reappear when the center of the
missing section is within view.
 
The point cloud is a POINTS primitive set and I have turned culling off
(setCullingActive(false)) as well as display lists.
 
I've noticed that if I do not add the terrain model to the scene it
works ok.
 
What culling/paging option do I need to set to make sure this doesn't
happen?
 
-Steve 
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Point cloud culling/paging

2008-04-24 Thread Steven Powers
Thanks for the reply.

I thought the near clippling plane might have been the problem but its
not clipping the terrain adjacent to the points.

It also makes me wonder why this would only happen if the terrain is
visible.

I've set my near clipping plane to .1 and the far to 1000.
The camera I'm using is the default one created by the viewer. 

double fovY, aspectRatio, near, far;
mcam-getProjectionMatrixAsPerspective(fovY, aspectRatio, near, far);
mcam-setProjectionMatrixAsPerspective(fovY, aspectRatio, .1, 1000);

mcam
-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
mcam -setCullingMode(osg::CullSettings::NO_CULLING);

Even with these settings the problem still occurs.

Any other Ideas?
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Thursday, April 24, 2008 11:25 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

On Thu, Apr 24, 2008 at 4:22 PM, Robert Osfield
[EMAIL PROTECTED] wrote:
 HI Steve,

  It's much more likely that near plane clipping is at fault than
  culling, unless your bounding volume for the point clouds is not
  correct.

I should clarify, when I said near plane clipping is at fault I
didn't mean to imply that it might be a bug lurking, but that even
normal near plane clipping by can result in parts of the scene looking
like they are being culled.  The near and far planes are totally under
your control so if you want you can set them explictly to what you
want.  So rather than a bug is just an aspect of OpenGL/OSG rendering
that one has to be aware of and mange accoridingly.

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


Re: [osg-users] Point cloud culling/paging

2008-04-24 Thread Steven Powers
I should mention that perfect square sections of the point cloud will be
missing.   

 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Powers
Sent: Thursday, April 24, 2008 11:39 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

Thanks for the reply.

I thought the near clippling plane might have been the problem but its
not clipping the terrain adjacent to the points.

It also makes me wonder why this would only happen if the terrain is
visible.

I've set my near clipping plane to .1 and the far to 1000.
The camera I'm using is the default one created by the viewer. 

double fovY, aspectRatio, near, far;
mcam-getProjectionMatrixAsPerspective(fovY, aspectRatio, near, far);
mcam-setProjectionMatrixAsPerspective(fovY, aspectRatio, .1, 1000);

mcam
-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
mcam -setCullingMode(osg::CullSettings::NO_CULLING);

Even with these settings the problem still occurs.

Any other Ideas?
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Thursday, April 24, 2008 11:25 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

On Thu, Apr 24, 2008 at 4:22 PM, Robert Osfield
[EMAIL PROTECTED] wrote:
 HI Steve,

  It's much more likely that near plane clipping is at fault than
  culling, unless your bounding volume for the point clouds is not
  correct.

I should clarify, when I said near plane clipping is at fault I
didn't mean to imply that it might be a bug lurking, but that even
normal near plane clipping by can result in parts of the scene looking
like they are being culled.  The near and far planes are totally under
your control so if you want you can set them explictly to what you
want.  So rather than a bug is just an aspect of OpenGL/OSG rendering
that one has to be aware of and mange accoridingly.

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


Re: [osg-users] Point cloud culling/paging

2008-04-24 Thread Steven Powers


Currently I'm entering all points as 0,0,0 and update them with values
within the render loop.

Except for these:
addPoint(PCPoint(9, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(-9, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 9, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, -9, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, 9), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, -9), PCColor(0,0,0,0)); 

Which I wont ever update with new values. I never force an update of the
bounding box.

The farthest extent of a point that I modify should be +/- 1000.

Here is my code for creating the pointCloud:

void PointCloud::factory()
{
_lastEntered = -1;
_geometry = new osg::Geometry();

_geometry-setSupportsDisplayList(false);
_geometry-setUseDisplayList(false);

_cloud3DRep = new osg::Geode();
_points = new osg::Vec3Array();
_colors = new osg::Vec4Array();

PCPoint p(0,0,0);
PCColor c(0,0,0,0);

double px, py, pz, cr, cb, cg, ca(1.0);
for (int i = 0; i  _maxSize; i++)
{
_points-push_back(p);
_colors-push_back(c);
}

_geometry-setVertexArray(_points.get());

_geometry-setColorArray(_colors.get());

_geometry-setColorBinding(osg::Geometry::BIND_PER_VERTEX);
_geometry-addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, _maxSize));

_cloud3DRep-setCullingActive(false);
_cloud3DRep-addDrawable(_geometry.get());
addChild(_cloud3DRep.get());

osg::StateSet *set = new osg::StateSet();

/// Give some size to the points to be able to see the
sprite
osg::Point *point = new osg::Point();
point-setSize(2.0f);
set-setAttribute(point);

/// Disable depth test to avoid sort problems and
Lighting
set-setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
set-setMode(GL_LIGHTING, osg::StateAttribute::OFF);

_cloud3DRep-setStateSet(set);

addPoint(PCPoint(9, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(-9, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 9, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, -9, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, 9), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, -9), PCColor(0,0,0,0));
}
 

And my code for editing each point:

void PointCloud::addPoint(PCPoint p, PCColor c)
{
//if we hit the end of the array start at the beginning
_lastEntered++;
if (_lastEntered = _maxSize  _maxSize = 0)
_lastEntered = 0;
(*_points.get())[_lastEntered] = p;
(*_colors.get())[_lastEntered] = c;
}


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gordon
Tomlinson
Sent: Thursday, April 24, 2008 12:15 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] Point cloud culling/paging

Hi

Sounds like it could be a bounding sphere/box issue 

How are you loading and creating the point cloud ?

You might possibly have one or more errant points that are out side the
range/volume of all the other points of a geode

Depending on how your loading/creating the geodes,  you should check the
bounding box/spheres against the expected
Extents of the point cloud for the geode etc...

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


Re: [osg-users] Point cloud culling/paging

2008-04-24 Thread Steven Powers

I've added a _geometry-dirtyBound() to be called each visit but that
didn't help.

I printed out the bounding sphere data and as it does change slightly it
looks correct even when the square sections of the point cloud disappear
and reappear.

Any other ideas? Could this have something to do with the terrain being
visible? This only seems to happen if the terrain is visible to the
camera via its NodeMask. 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian R
Hill
Sent: Thursday, April 24, 2008 1:02 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Point cloud culling/paging

Steve,

Verify that your bounding sphere is what you think it should be. Print
out
the point cloud's bounding sphere every frame and check that it's
correct.

osg::BoundingSphere bs = pointcloud-getBound():
std::cout  Ctr   bs.center()   rad   bs.radius()  \n;

Brian

[EMAIL PROTECTED] wrote: -


To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
From: Steven Powers [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
Date: 04/24/2008 11:11AM
Subject: [osg-users] Point cloud culling/paging


I'm experiencing some weird problems with my point cloud.

I have a fairly large terrain and a point cloud that expands the whole
terrain. When I build the point cloud and look around the environment
whole
sections of the point cloud disappear when they aren't centered within
the
camera's view. They will then reappear when the center of the missing
section is within view.

The point cloud is a POINTS primitive set and I have turned culling off
(
setCullingActive (false)) as well as display lists.

I've noticed that if I do not add the terrain model to the scene it
works
ok.

What culling/paging option do I need to set to make sure this doesn't
happen?

-Steve



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

-

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit
written
agreement or government initiative expressly permitting the use of
e-mail
for such purpose.



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


[osg-users] Shader Program on Slave Camera

2008-04-22 Thread Steven Powers
When I try to set a shader program on a slave camera through a state set
it doesn't seem to work.
 
I've tried removing the camera as a slave, adding the state set, then
adding the camera as a slave to the viewer again.
 
Is there a fix for this or should I try a different technique to apply a
shader to a single camera???
 
Thanks,
 
Steven Powers
 
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shader Program on Slave Camera

2008-04-22 Thread Steven Powers

Let me know if you need more code than this. I can throw together a full 
executable if it is needed.

So far I've added a camera as a slave camera to the viewer. I have no problems 
doing that.

viewer-addSlave(_camera);

Then when I add a shader to the slave camera:

   osg::ref_ptrosg::StateSet ss = _camera-getOrCreateStateSet();
 //shaders
osg::ref_ptrosg::PolygonMode mode = new osg::PolygonMode;
mode-setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL);
osg::ref_ptrosg::Program program = new osg::Program;
program-setName( SimpleShader);
program-addShader( new osg::Shader( osg::Shader::VERTEX, 
simpleVertexShaderSrc ) );
program-addShader( new osg::Shader( osg::Shader::FRAGMENT, 
simpleFragShaderSrc ) );

ss-addUniform(0);
ss-setAttributeAndModes( program.get(), osg::StateAttribute::ON || 
osg::StateAttribute::OVERRIDE || osg::StateAttribute::PROTECTED);
ss-setAttributeAndModes( mode.get(), osg::StateAttribute::ON || 
osg::StateAttribute::OVERRIDE || osg::StateAttribute::PROTECTED);
   

The shader does not seem to be invoked. If I use this same code and but add the 
shader to the root node:

//osg::ref_ptrosg::StateSet ss = _camera-getOrCreateStateSet();
osg::ref_ptrosg::StateSet ss = _renderRoot-getOrCreateStateSet();

the shader works appropriately but is used on all cameras. I can throw together 
a quick example program that will illustrate the problem if you need more code 
than this.

I have also tried removing the slave camera then re-adding it after I attach 
the shader to it.
This same code works if I add the camera to the scene rather than adding it as 
a slave camera.



Thanks,

-- 
Steven Powers

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


[osg-users] Shader on a slave Camera

2008-04-21 Thread Steven Powers
Some Background: 1 viewer multiple slave cameras (viwer-addSlave(..))

I'd like to add a shader that would get visited by only one of the
cameras. To do this I tried to add a state set to that camera with the
program loaded, turned on and protected.

This, however doesn't seem to work. Is there a way to add a state set to
a slave camera and have it be visited?

I figure I could set a nodemask on the stateset further down the
scenegraph but I'd rather come up with a better approach.

Thanks in advance.

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


Re: [osg-users] NodeMask CullMask problem

2008-01-15 Thread Steven Powers
 
I am using the second CameraNode to render to a texture that the main
camera in the viewer will display.
 
The second cameraNode uses a frame buffer object and shaders to generate
a texture. It works fine other than the cameranode renders objects that
only the main viewer should render.
 
Should I be adding the camera node as a slave camera to the viewer
rather than adding it to the scene graph?
 
Steven Powers
 
 
 
Hi Steven,
 
The CullSetting::setCullMask settings the traversal mask for the
osgUtil::CullVisitor, but only once the Camera has been entered so
only affects the traversal of the Camera's children.  The check of
Camera's NodeMask is done against the CullVisitors traversal mask on
entering the Camera::accept() method, at this point the traversal mask
has the value set by the parental chain of the Camera in question,
which in your case will be the viewer's Camera.
 
Perhaps what you need to do is back up a little and work out what you
are actually trying to achieve.  Having the viewer have a Camera with
another Camera directly below it makes one of the cameras a bit
redundent, why not not ditch the one in the scene graph and use the
viewer one.
 
Don't forget with osgViewer you have a few choices in how you manage
your views of the scene - you can have one View managed by
osgViewer::Viewer, or multiple View's managed by
osgViewer::CompositeViewer, and in both cases you have build the View
up from a single master Camera or multiple slave Cameras that are
controlled relative to the master Camera.  So there is lots of
flexibility in how you can put viewers together.  Since the osgViewer
library uses exactly the same Camera class as the type you're used to
put in the scene the code set up will easily map across.   The upshot
of all this is range of problems that were really awkward in the 1.x
series of the OSG, and now quite straightforward in the 2.x series.
 
Robert.
 
 
On Jan 14, 2008 9:27 PM, Steven Powers [EMAIL PROTECTED] wrote:
 
 
 
 
 I am having problems with CullMasks using OSG 2.X.
 
 
 
 I have a CameraNode that I set the CullMask as setCallMask(0x10) and a
node
 that I set as setNodeMask(0x1).
 
 
 
 My understanding is that a node is evaluated like:
 
 
 
 CullMask  NodeMask
 
 
 
  If the result is true it will traverse the node. This is not
happening for
 me. Unless I set the Node with setNodeMask(0) the node is traversed
and
 rendered.
 
 
 
 I am using osg::Viewer with the camera Node added to the scene graph
below
 the root node and before the scene.
 
 
 
 Is there something in my technique that is wrong or am I missing a
function
 call somewhere.
 
 
 
 Thanks in advance.
 
 
 
 Steven Powers
 
 
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

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


[osg-users] NodeMask CullMask problem

2008-01-14 Thread Steven Powers
I am having problems with CullMasks using OSG 2.X.
 
I have a CameraNode that I set the CullMask as setCallMask(0x10) and a
node that I set as setNodeMask(0x1). 
 
My understanding is that a node is evaluated like:
 
CullMask  NodeMask
 
 If the result is true it will traverse the node. This is not happening
for me. Unless I set the Node with setNodeMask(0) the node is traversed
and rendered.
 
I am using osg::Viewer with the camera Node added to the scene graph
below the root node and before the scene.
 
Is there something in my technique that is wrong or am I missing a
function call somewhere.
 
Thanks in advance.
 
Steven Powers
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] GraphicsContext cannot open display.

2007-12-18 Thread Steven Powers
I'm running OSG 2.2 ssh'd into a remote linux system.
 
When I run a program using viewer it opens windows fine.
 
ie osgViewer(); viewer-realize(); works just fine.
 
 
When I use a graphics context I get the message: 
 
'Error: Unable to open display :0.0' 
 
and
 
osg::GraphicsContext::createGraphicsContext(traits.get());
 
returns NULL.
 
I have the DISPLAY variable set and I'm using X11 forwarding actively
for other tasks.
 
 
Why does this work when I use viewer to build a window and not work when
I try to manually create a graphicsContext???
 
Thanks,
 
Steven Powers 
 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problems with FRAME_BUFFER_OBJECT

2007-07-31 Thread Steven Powers
Do you want to integrate with windowing toolkit like QT
 
Not necessarily, But I am using MFC for one of my applications that uses
this library. In that case I set the window directly to the render
surface.
 
Do you just want a full screen window up?
 
For now its windowed. If I set the viewport to the same size (or larger
than) as the FBO I'm rendering to it works fine.
 
Upgrading to 2.0 is not an option for me at this time.. I'm too far in
to coding my application and the risk would be too great.
 
Maybe your driver does not support FBOS...And OSG fallback to
imagecopy from 
framebuffer
 
It cant be a driver issue because I used my FBO library in an
application using osgProducer::Viewer and it worked fine. (I'm running
Geforce 7xxx graphics cards)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org