[osg-users] camera manpulator

2010-09-02 Thread Otto Cologne
Hi,

I'm kind of afraid the answer will be: reimplement a camera manipulator that 
does what you want, but maybe someone had a similar problem and there is a 
solution already.

Ok here goes. Right now I'm using a trackball manipulator, which is great. Now 
when you move the scene and thus the trackball out of center rotation gets 
weird. The object kind of seems to orbit around that center and is not really 
controllable by the user. Which is understandable knowing how the trackball 
principle works.

So what I need is a two-phase trackball. One that still lets you move the 
camera but does the rotation based on the center of the scene. So there will 
another transformation node needed between camera and scene, the trackball 
rotation works on.

I'm thankful for hints on if there something like this already or how to do it.
... 

Thank you!

Cheers,
Otto

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





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


Re: [osg-users] vertex arrays in a custom drawable

2010-03-15 Thread Otto Cologne
Hi,

ok this is definitely strange. This is what my draw implementation looks like 
now:

Code:

osg::State state = *renderInfo.getState();

state.setVertexPointer( 3, GL_FLOAT ,0, (*verts)[0] );
state.setColorPointer( 3 , GL_FLOAT ,0 , (*colors)[0] );

for ( size_t i = 0; i  active-size(); ++i )
{
if ( (*active)[i] )
{
state.glDrawArraysInstanced( GL_LINE_STRIP, (*startIndexes)[i], 
(*pointsPerLine)[i], 1);
}
}

state.disableVertexPointer();
state.disableColorPointer();




It works if I only render a few lines, like 2000 or sometimes even up to 35k.  
More than that it always crashes in the glDrawArrays call, the point at which 
the crash occurs is pretty random. Since i tripple checked all my arrays ten 
times, the only thing i can think of now is that something changes the OpenGL 
state, thus invalidating the vertex pointer. Now is there a way to check on 
that guess and if it's the case to prevent it somehow?


Thank you!

Cheers,
Otto

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





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


Re: [osg-users] vertex arrays in a custom drawable

2010-03-15 Thread Otto Cologne
Hi,

YES Finally that seems to fix it. A state.disableAllVertexArrays(); before 
my pointer inits did the trick.


Thank you!

Cheers,
Otto

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





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


Re: [osg-users] vertex arrays in a custom drawable

2010-03-13 Thread Otto Cologne
Hi,

ok no answers for a while so I guess i need to explain my problem a bit more. 
The task is to render a selected set of lines out of a bigger dataset 
(http://sites.google.com/site/schurade/pic14.png). The test data I'm usually 
working with is about 70k lines with approx. 5M points but can get bigger 
easily. The selection is interactive so the rendering needs to be fast so it 
doesn't get too sluggish. My previous implementation used VBO's or vertex 
arrays and worked really good even on the slow machine of my boss ( dual core, 
gforce8, 2 gig ram), so this is what he expects now from the new app which uses 
OSG. 

The data (vertex array and at least one color array)  is stored in 
stl::vectorfloat which allos pointer access. I'd prefer to render directly 
from these arrays and not have to copy it into any osg structures for time and 
memory consumption reasons. My approach was the above mentioned draw 
implementation but I can't get it to work.

Thank you!

Cheers,
Otto

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





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


Re: [osg-users] vertex arrays in a custom drawable

2010-03-13 Thread Otto Cologne
Well that's what I suspected. My problem is more the how than the if.

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





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


[osg-users] vertex arrays in a custom drawable

2010-03-09 Thread Otto Cologne
Hi,

i'm trying to use vertex arrays in my own drawable. For some reason it crashes 
in the glDrawArrays call. The draw implementation is some code that works in 
another program of mine which uses pure opengl.


Code:

glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );

glVertexPointer( 3, GL_FLOAT, 0, (*verts)[0] );
glColorPointer( 3, GL_FLOAT, 0, (*colors)[0] );

for ( size_t i = 0; i  active-size(); ++i )
{
if ( (*active)[i] )
{
glDrawArrays( GL_LINE_STRIP, (*startIndexes)[i] * 3, 
(*pointsPerLine)[i] );
}
}
glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );




In the constructor of the drawable there is a setSupportsDisplayList( false );

For the opengl part this looks correct, the only thing i could think of now is 
that it's not ok to do stuff like glEnableClientState directly but have to use 
some osg state object. Any hints on how to do it correctly will be greatly 
appreciated.



Thank you!

Cheers,
Otto

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





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


[osg-users] VBO's and masking/updating geometry

2010-01-06 Thread Otto Cologne
Hi,

I'm in the process of rewriting a program I did earlier but this time using 
OSG. One part contained rendering a large amount of lines which would be 
selected by various selection tools. For that I used VBO's and a bit mask. The 
rendering function (after all the initializations) then looked like this


Code:

for ( int i = 0; i  m_countLines; ++i )
{
if ( m_selected[i] )
glDrawArrays( GL_LINE_STRIP, getStartIndexForLine( i ), 
getPointsPerLine( i ) );
}




Now i'm reading through the osg doc and  the tutorials, but the coverage on 
VBO's is rather thin. I'd appreciate some hints on how to do it if the 
functionality exists or if I have to write my own osg node.
... 

Thank you!

Cheers,
Otto

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





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


[osg-users] crash with setTextureAttributeAndModes

2009-10-27 Thread Otto Cologne
Hi,

I'm having a crash with setTextureAttributeAndModes I don't know how to fix. 

To explain the issue. I have a list of data sets which hold a pointer to a 
osg::Texture3D. The texture mixing is done in a shader and my texture update 
function containing the following loop is called from an update  callback. 
Since the order of the textures can/must change i loop over the textures and do 
this


Code:

osg::StateSet* sliceState = m_sliceNode-getOrCreateStateSet();
for ( size_t i = 0; i  datasetList.size(); ++i)
{
  osg::Texture3D* texture3D = datasetList[i] )-getTexture3D();
  sliceState-setTextureAttributeAndModes( i, texture3D, 
osg::StateAttribute::ON );
}




This works just find when adding one texture after another. However when the 
order changes, thus overwriting a different order it crashes. So apparently I'm 
doing it wrong. 

Any help would be greatly appreciated.
... 

Thank you!

Cheers,
Otto

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





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


Re: [osg-users] crash with setTextureAttributeAndModes

2009-10-27 Thread Otto Cologne
Yes you are right :) I was just about to post that i followed that hint and 
used it. It works now. Thanks.


Ulrich Hertlein wrote:
 Hi Otto,
 
 On 27/10/09 10:12 AM, Otto Cologne wrote:
 
  I'm having a crash with setTextureAttributeAndModes I don't know how to fix.
  
  To explain the issue. I have a list of data sets which hold a pointer to a
  osg::Texture3D. The texture mixing is done in a shader and my texture 
  update function
  containing the following loop is called from an update  callback. Since the 
  order of
  the textures can/must change i loop over the textures and do this
  ...
  
  osg::StateSet* sliceState = m_sliceNode-getOrCreateStateSet(); for ( 
  size_t i = 0; i
  datasetList.size(); ++i) { osg::Texture3D* texture3D = datasetList[i]
  )-getTexture3D(); sliceState-setTextureAttributeAndModes( i, texture3D,
  osg::StateAttribute::ON ); }
  
  This works just find when adding one texture after another. However when 
  the order
  changes, thus overwriting a different order it crashes. So apparently I'm 
  doing it
  wrong.
  
 
 David already hinted at the answer: you need to use ref_ptrTexture3D for 
 your 
 datasetList, not Texture3D*.
 
 Or manually do a 'ref' on each object.
 
 Cheers,
 /ulrich
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


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





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


Re: [osg-users] noob question about texture3d

2009-09-28 Thread Otto Cologne
Thanks that helped a bit.

Any idea why 

Code:

osg::ref_ptrosg::Image ima = new osg::Image;
ima-allocateImage(160, 200, 160, GL_LUMINANCE, GL_UNSIGNED_BYTE);
std::cout  ima-getImageSizeInBytes()  std::endl;



returns 32000 instead of the expected 512?

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





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