Hi Robert,
I can't speak for Stefan in regards to the design choice of multiple Viewers
rather than a CompositeViewer, but we made the same choice in our system. The
reason is that our application provides functionality via a plugin system, and
ideally plugins can be agnostic about what other
Hi Chris,
Can you give a bit more info about what you've tried and why it isn't working?
I haven't worked with osgViewerQt before, but it looks like it inherits from
osgViewer::Viewer, runs in single threaded mode, and frame() is called by the
paintGL method, which is presumably triggered by th
We use multiple viewers created and run from multiple threads, since our
application is heavily modular and multiple modules can create and control
their own viewers without a central coordinator. We don't limit what threading
mode is used, and we haven't had problems with multiple viewers in
Hi Thomas,
If you don't actually need the functionality of the 3rd party's update
callbacks you could remove them using a custom visitor. Or you could do as
Robert suggests and write your own frame loop which ignores the call you're
having problems with as you see fit. This option really woul
Hi Paul,
Congratulations, this looks great! It looks like something we'll be very
interested in integrating with our system. I look forward to giving it a try -
unfortunately I'm consumed with other projects at the moment so I won't be able
to contribute to the testing any time soon. Hopeful
Hi ?,
How frequent of an occurrence is the need to add/remove portions of the scene
graph? And what kind of performance are you looking for as it happens? If it
is infrequent, could you simply stop threading on the viewer, modify your scene
graph structure however you need to, and start threa
Hi Joel,
I can't tell what's going on from your description - is your Scene class
derived from osg::Node and a child of root? If so, this may explain why a raw
Scene* pointer is a problem. I'm having trouble picturing the layout of your
application, if you can give more details that may help.
Hi Thomas,
I think a bit more information would be useful. Werner is correct about Qt
paint events in that all QWidgets must be created in the QApplication thread
and cannot be moved to any other threads. If you're trying to use osg to
render into a Qt-based window, this will be an issue. Ho
Hi Mark,
I don't know if this is optimal or not, but one thing you could do is use the
NodeVisitor::getNodePath() method. You can look through the path to find any
switch nodes, and use the Switch::getChildValue(const Node*) method to see if
the next node in the list is on or off. This is of
Classes derived from NodeCallback are attached to nodes in the scene graph and
operated during a scene graph traversal. Since the class you've posted is
named CameraUpdateCallback, I'm guessing it is added using the
setUpdateCallback method. During the update traversal of the scene, the update
Hi Dietmar,
Thanks for the reply. The variable aMutex is definitely valid - it is
initialized on the stack in the constructor of the object that uses it. The
call succeeds almost all the time, the program can go for minutes or hours
before the crash occurs. And as I mentioned, entering and e
Hi everyone,
Has anyone experienced issues with OpenThreads on Windows 7? I don't exactly
know how to describe the glitch we're seeing, but I'll give it a go and hope
that someone can shed more light on it.
Occasionally a crash occurs in an application, and a dialog pops up asking to
debug.
Hi Diana,
I find it pretty convenient to use
Code:
getCamera()->setViewMatrixAsLookAt (const osg::Vec3 &eye, const osg::Vec3
¢er, const osg::Vec3 &up)
for setting up the view matrix, it was one of Robert's suggestions but I
thought I'd re-emphasize it. Vec3 "eye" will be the position you're
Looking at the source code for computeLocalToWorldMatrix and
computeWorldToLocalMatrix, the node visitor argument is ignored, so it would
seem safe to use these functions and pass NULL as the second argument. I
haven't tried it though.
Cheers,
Tom
--
Read this topic online her
Martin, J-S,
Do you happen to know if this issue occurs only when the stats are enabled, or
if it also occurs in the viewer without the stats displayed? I ask because
I've never actually used the stats functionality, but sometimes when we launch
our application, the graphics appear lower quali
Hi Tim,
I've never used NodeTrackerManipulator personally, nor have I used oceanExample
(or even PositionAttitudeTransform, I always just use MatrixTransform). So
obviously I won't be much help. However, I think maybe it would make sense for
you to make a small test application (small scene,
Hi Sanat,
Code:
const osg::NodePath& nodePath = picker->getFirstIntersection().nodePath;
is only giving you the first intersection, which may not be either of your
models (it could be terrain, for example). I'm guessing you need to search the
entire set rather than just trying the first inte
osg::NodePath is:
typedef std::vector< Node* > osg::NodePath
Since you have two Node*s that you're looking for, you can iterate through the
NodePath just like any other vector and compare your pointer to the pointers in
the vector.
You could also apply your intersection visitor to the nodes you
Hi Richard,
You seem to have a lot of the pieces already sort of in place. I'm not sure
exactly what you're asking... but here goes.
To have something render, you want to create an object of class
osgViewer::Viewer. Then you need to add data (your scene graph) to the viewer
using setSceneDat
Hi Lucie,
What you're looking for is how to convert the quaternion representation of a
rotation into the Euler angle representation. Take a look at
http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
for more info and the equations.
Alternatively, you can get the rota
Hi Lucie,
I haven't tried it out but it looks like in the inner for loop, numSegments is
defining how many panels it takes to complete a circle. If you iterate only
until numSegments/2 it might give what you're looking for?
Code:
for(unsigned int topi=0; topi < numSegments/2;
++topi,angle+=a
Hi Axel,
In the step where you're calculating m, it looks like you're applying the
rotation to the original matrix, which includes a translation already.
Code:
osg::Matrix m = amtRod->getMatrix() * osg::Matrix::rotate(rotation,
osg::Vec3(0,1,0));
It sounds like what you want to do is rotate
Hi Andrew,
Using the OSG's animation features isn't something I've done personally, so I
can't say if this would work or not. However, what I'd do is subclass
osg::AnimationPathCallback to make it handle the matrix the way you want.
Whether that means saving the original matrix and restoring
If you want to reuse a lot of the code from SphericalManipulator but add some
new features, derive a new class from SphericalManipulator (instead of changing
the osg source at all). At the very least it's a good way to experiment with
the new features you're adding without having to start over
Hi Jesper,
Based on some suggestions I saw previously on the board, I'm using a method
with two Geodes sharing a child Drawable and a parent Transform.
Code:
transform_node->addChild(geode1);
transform_node->addChild(geode2);
geode1->addDrawable(drawable);
geode2->addDrawable(drawable);
//Ad
You have to use 'new' somewhere, like:
osg::ref_ptr viewer = new osgViewer::Viewer();
Cheers,
Tom
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33195#33195
___
osg-users mailing list
osg-users@list
Hi John,
Is there a reason you can't dynamically allocate the viewer and return a
ref_ptr to it, instead of returning by value?
Cheers,
Tom
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33188#33188
__
I haven't tried it, but wouldn't changing the order of multiplication in the
get(Inverse)Matrix methods do the trick:
return osg::Matrixd::translate(osg::Vec3d(0.0, 0.0, m_distance))*
osg::Matrixd::translate(m_center)*
osg::Matrixd::rotate(M_PI_2-m_elevation, 1.0, 0.0, 0.0
J-S,
I tend to agree with you - it feels like a CameraManipulator should be able to
change (manipulate!) the Camera in any way. Also, thanks for catching the
getMatrix vs getInverseMatrix... you're definitely correct, although I'd hope
that anyone writing a CameraManipulator would implement bo
Hi Matt,
What is being manipulated is the matrix that is returned from the manipulator.
The parameters that you've found all are used ultimately in computing the
matrix. Have a look at FirstPersonManipulator::getMatrix() for example -
matrices are made from _trans and _rotate parameters and m
You mistyped it - it's setAllowThrow, not setAllThrow.
Cheers,
Tom
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32242#32242
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lis
Hi Richard,
Here's what I would do to start:
0) Read the QuickStartGuide if you haven't already.
1) Make two Geodes, one with a Cylinder as the Drawable, and the other with a
Cone, (these are convenience classes which the osg provides) and add each Geode
as the child of a MatrixTransform or Po
Hi barral,
As David said, don't use osgProducer, use osgViewer::Viewer. It sounds like
you don't need multiple "View"s as the OSG calls them, you just need your
camera to move back and forth between a top view and a first-person view. You
don't need multiple cameras - and setCamera won't do w
Hi Robert,
I agree with your assessment of possible places to look. This occurs even with
creating a single new Material, and I always use ref_ptrs, so that isn't the
source of it. I'll look into drivers etc. and post anything I find here in
case others come across the same issue.
Anybody ou
Hi OSGers,
I'm using setAttribute(osg::Material* mat) on a matrix transform to control the
color of an object (just a simple sphere for now, nothing fancy). Just using
task manager in windows to watch process memory usage, I noticed that upon
adding an object to the scene, the memory usage wou
Hey everyone,
I'm having trouble using osgViewer::Viewer::setCamera(osg::Camera*) method
(inherited from osg::View). I'm sure the problem is me and not with the
function. :-*
Here's the scenario: I have an already-realized viewer window with an empty
scene, to which I am trying to add a new
Hi Sanat,
When you find geometry (triangles) with your node visitor, apply the
accumulated transform that you traversed to the triangles. NodeVisitors have a
NodeList, which you can use with osg::ComputeLocalToWorld (I think) to get the
accumulated matrix you need. Then each triangle will be
Erik,
I think if Andrew could avoid it he would, but
Code:
typedef std::vector ValueList;
is built into osg::Switch.
Cheers,
Tom
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31329#31329
___
o
Ooh, nice - thanks for pointing me that way. I'm going to implement a triple
buffer of some sort in my project - if I use some of the techniques in
osgBullet as a pattern but don't actually copy code, what's the best/proper way
to give credit? Right now the project is totally internal for an a
Hello all,
I'm working on project where a viewer is running in one thread, and user
input/physics simulations/external devices/etc. are happening in one or more
other threads, but need to modify the scene graph. Currently, we use mutexes
which the other threads modify, and update callbacks acc
Hi Otto,
I think your suspicion is correct - building your own manipulator would
probably be best. It really isn't hard to extend one of the camera
manipulators to do what you want, or to just start with the source code of an
existing manipulator and tweak the appropriate methods. This is wha
Hi Paul,
Thanks for the response. In regards to question 2, if I'm understanding you
right this will work if the node in question is the direct child of a switch.
However, if there are intervening nodes (such as a switch at the root of a
sub-graph, with a number of levels of nodes underneath
Hi everyone,
I have a quick question regarding switch nodes and update callbacks:
I'm working on a system where users control objects in an osg scene (ie move
around, etc). I'm using switch nodes to turn various objects in the scene on
and off. I'd like to test for collisions between objects
Something quick and easy would be to calculate a new position for your camera
on each frame and set the view matrix as part of a frame() loop.
while(!myViewer->done())
{
myViewer->getCamera()->setViewMatrix(whatever it should be this frame);
myViewer->frame();
}
Cheers,
Tom
--
R
Hi David,
I'm kind of intrigued... do you have some stripped-down example code which
reproduces the problem, so we can poke around with it? There are a number of
things which *could* be going on (in my imagination if not in reality or not if
I knew more about OSG - I'm learning every day thoug
Hi Frank,
I can't claim to have experienced what you're experiencing, nor any experience
with shadowing at all. Instead of setting the cull mask to exclude some
objects, can you make them (the shadow-casting but not displayed objects) fully
transparent? I don't know if that affects the shadow
Hi Emilie,
I don't have much experience with doing what you're trying to do, but do you
have the data variance on your geometry set to dynamic? When I've forgotten to
do this in the past various things I've tried to modify dynamically weren't
applied, I can't recall if position (for example) w
Hi Eric,
To answer the last question first: if your new local scenegraph isn't attached
to the scene that the viewer has, you can safely do whatever you want to it -
that memory isn't being accessed by the viewer, since the viewer doesn't even
know it exists.
As for the rest, it depends a bit
Hi Lucie,
When you make a line segment intersector with just two Vec3s as input
arguments, the line segment runs from one point to the other in model
coordinates. How are you finding wandp1 and wandp2? In your code it looks
like they are uninitialized in which case they are both (0, 0, 0). I
Looks right to me, Ricky. For understanding coordinate frames and rotation
directions, the "right hand rule" applies in both cases - actually they are two
distinct rules but both go by the same name. Check it out on wikipedia or
somewhere - it's a good mnemonic to know!
Cheers,
Tom
-
Do you know if you actually have found an intersection?
Try adding the statement if(backhoeLocationSegment->containsIntersections()).
If you don't have a valid intersection, how are you supposed to get coordinates
out of it?
Cheers,
Tom
--
Read this topic online here:
http://f
Hi Sanat,
There's so much there, including functions that I have no idea what they do,
that it'll be hard to figure out. There is definitely some unnecessary bits
that make it even harder for people who aren't you to figure out what is going
on - for example,
Code:
backhoeGroundPosition = ba
Hi Robert,
I think the solution of having a GUIEventHandler through Viewer to capture and
pass along all events will be the way I go.
I was trying to have various users on our end write their own event handlers
based on their needs, and be able to swap from one to the other on the fly
dependin
Thanks for the info, Robert. I tried what you suggested, but I don't seem to
be getting any events back at all: copyEvents(Events&) returns false, and
events.size() is zero. When I used getCurrentEventState() I could access the
mouse position from the GUIEventAdapter that was returned, but I w
Hi,
I'm looking to implement event handling in a handler not attached to a View.
The code snippet below is what I'm thinking of doing (the function would take
an eventadapter similar to the handle method of the camera manipulators). Is
this a valid way to go, or am I missing something? If mu
Hi JP, Tim,
Thanks for the replies.
Using the single threaded mode gets rid of the flicker, as does setting the
state set data variance to dynamic when I create the scene graph:
mt->getOrCreateStateSet()->setDataVariance(osg::Object::DYNAMIC);
I'm convinced that your explanation of collision be
Skylark wrote:
>
> That last one should probably have been:
>
> state->setMode( GL_BLEND, osg::StateAttribute::ON );
Aye, that's what I meant. I just copied/pasted the wrong line of code. Thanks
for pointing that out J-S. I always turn on GL_DEPTH_TEST anyway to be safe,
even though on is
Hi,
Let me preface this by saying that I know how to make my code do what I want it
to, so this question is of low importance and arises from doing something that
could(should?) be considered silly- dynamic allocation within a callback
operator method when the callback can have a class member
Hi,
It sounds like what you want to use is:
setViewMatrixAsLookAt(eye, center, up)
where eye is a Vec3 for where the camera is located, center is the point the
camera is looking at, and up is the camera's up unit vector.
viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3(x_camera, y_camera,
z
dglenn wrote:
>
> So, I have color, but is there anything I need to set to get the alpha chenal
> to work?
> In this example I have alpha set to 0.5f but I don't see what I drawing
> fading half away!
>
Are you enabling transparency? - for example by:
Code:
osg::StateSet* state = node->g
Hi,
> Error: [Screen #0] ChooseMatchingPixelFormat<> -Unable to choose the
> requested pixel format
I've had this error pop up while trying to run OSG applications on a remote
machine via Windows remote desktop - don't know if that's what you're doing,
but if so, it's probably where the is
Hi Bruce,
I'm doing something similar to you, where I want to be able to click in a scene
and add objects at that point. I do it as JS suggests, using an event adapter
to get the mouse coordinates, a line segment intersector using Window
coordinates, and an intersection visitor. If you want,
Hi Don,
If you put some smallish geodes into your (non-HUD) scene - not just a
background, but some test cubes or spheres or something - does your picker
class pick those objects as you expect?
Cheers,
Tom
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopi
Hi,
> q*f in OSG is shorthand for (qc * fq * q). It's the
> opposite of what one might expect. There are some inconsistencies...
My approach is always to try it the way I think it should work, and when it
doesn't, start playing with the multiplication order - eventually something
works. It
The various methods we're talking about for figuring out a forward vector are
rotating in different directions - here's a bit of test code to confirm.
Code:
FILE* fp = fopen("printout.txt", "w");
osg::Vec3 f(0., 1., 0.);
osg::Quat fq(0., 1., 0., 0.);
osg::Quat q(osg::Degr
When switching machines, did you make sure that you have the appropriate osg
libraries for the version of your compiler (are you using Vis studio?), and
that you've matched release/debug libraries with your project properties?
If that isn't the problem, you could try creating a fresh project fro
Hi Thomas,
One thing I would check:
In windowed mode, is the entire window on your screen, or are you clipping some
of the image that way?
I would try just running the program with a viewer loop (without taking
screenshots and exiting right away) to make sure this is alright. This would
also
Hi,
I've been doing it this way, works like a charm:
Say your "forward vector" is (0, 1, 0), pointing along the y axis, make an
with from this by adding a real coordinate (4th coordinate) of zero - (0, 1, 0,
0).
You also have a rotation quat "q", and take it's conjugate to get q_prime.
Then m
Hi Gordon,
Thanks for the suggestions. I am working in release, and I don't have any of
the debug libs on my machine. I re-extracted all osg files just in case
something got corrupted. I cleaned and rebuilt the application. Didn't help.
However, I started a new Visual Studio project, copied
Hello OSG users,
This afternoon, I had a program I've been working on start crashing on me and I
thought I'd see if anyone had insight into where I should be looking for the
problem. I've been making changes to the code and re-building the project to
test the changes, but I don't know that my
Ricky,
Based on the code you posted, you're taking a screenshot every frame - and from
the same position, no less. You're creating the same matrix each time, and
thus setting the view matrix to be identical each frame. Then you're doing
file I/O that is the exact same too.
When I ran your co
Theo,
There should be plenty of resources for learning how to create and manipulate
2D objects - it is fundamentally just like creating 3D objects, only the
polygon(s) are all in a plane. You can just create a set of vertices manually
to start with. If you've found the examples that deal with
Hi Robert,
Thanks for the quick reply. Upon further debugging and inspection, I think the
problem was fixed already in 2.8.3. I'm using Visual Studio 9, and haven't
gone to 2.8.3 since the downloads page still says binaries for VS9 are not yet
available.
Anyhow, in 2.8.2 GeometryTechnique::g
Hello community,
I've been playing around with manually creating terrain tiles (as opposed to
letting VPB do it) and noticed what to me seems like strange behavior, and I
was wondering if anyone else had noticed a similar issue - or could point
out what I'm doing wrong. I'm using osg2.8.2 on Wind
Hey everyone,
I'm new (in the past couple months) to OSG and to this list, and I was
hoping someone could point me in the right direction on this question:
How do I best go about getting two views into a scene to display
side-by-side in a window so a stereo monitor can display it properly?
I need
75 matches
Mail list logo