Re: [osg-users] projective texturing

2009-07-02 Thread Großer Martin
Hello,

I have the answer of my question. My mistake was that the lines...

gl_TexCoord[1].s = gl_TexCoord[1].s / gl_TexCoord[1].q / 2 + 0.5;
gl_TexCoord[1].t = gl_TexCoord[1].t / gl_TexCoord[1].q / 2 + 0.5;

...musst into the fragment shader.

Cheers,

Martin

Am Donnerstag, den 02.07.2009, 15:19 +0200 schrieb Großer Martin:
> Hello,
> 
> I try "projective texturing" and I didn't use the TexGen. Also I use a
> shader. And in the vertex shader I do this:
> 
> gl_TexCoord[1] = ( projMat * viewMat * gl_Vertex );
> gl_TexCoord[1].s = gl_TexCoord[1].s / gl_TexCoord[1].q / 2 + 0.5;
> gl_TexCoord[1].t = gl_TexCoord[1].t / gl_TexCoord[1].q / 2 + 0.5;
> 
> The projMat is the projection matrix of my "projector" and the viewMat
> is the transformation in the coordinate system of the projector.
> 
> In my test scene I have a plane with a width and height of 10 and the
> center is in (0,0,0). And I have the projector in (0,0,2) with the up
> vector (0,1,0) and the target point (0,0,0). It looks fine, but when I
> rotate the projector, the result is irreproducible.
> 
> I think the problem is the s/q and t/q. Have everyone a idea? What is my
> mistake?
> 
> Cheers,
> 
> Martin
> 
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-- 
--

Dipl.-Inf. (FH) Martin Großer

Technische Universität Dresden
Institut für Verarbeitungsmaschinen und Mobile Arbeitsmaschinen
D-01062 Dresden

Tel: 0351 463-32540
--

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


[osg-users] projective texturing

2009-07-02 Thread Großer Martin
Hello,

I try "projective texturing" and I didn't use the TexGen. Also I use a
shader. And in the vertex shader I do this:

gl_TexCoord[1] = ( projMat * viewMat * gl_Vertex );
gl_TexCoord[1].s = gl_TexCoord[1].s / gl_TexCoord[1].q / 2 + 0.5;
gl_TexCoord[1].t = gl_TexCoord[1].t / gl_TexCoord[1].q / 2 + 0.5;

The projMat is the projection matrix of my "projector" and the viewMat
is the transformation in the coordinate system of the projector.

In my test scene I have a plane with a width and height of 10 and the
center is in (0,0,0). And I have the projector in (0,0,2) with the up
vector (0,1,0) and the target point (0,0,0). It looks fine, but when I
rotate the projector, the result is irreproducible.

I think the problem is the s/q and t/q. Have everyone a idea? What is my
mistake?

Cheers,

Martin

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


Re: [osg-users] Painting in Textures

2009-07-01 Thread Großer Martin
Hi JP,

I want to "baked into" the texture to create a "new" painted texture
with the same texture coordinates like the original texture of the
object. The exact use case is the creation of a heigh map. That is to
say first I would like paint into the texture and after this I want to
change the position of the vertices in the direction of the normal. So I
can spread material on my object.

Cheers,

Martin

Am Mittwoch, den 01.07.2009, 08:59 +0200 schrieb J.P. Delport:
> Hi Martin,
> 
> you have already hinted at a search term you can use. Google for 
> "projective texturing". Also try "automatic texture coordinate 
> generation". An example in OSG of this is the OverlayNode of osgSim 
> (this is used to project a texture onto terrain e.g.).
> 
> Using this technique you can project your painted texture onto an 
> object, but the texture would not become part (be "baked into") of the 
> object (I suspect you actaully want to do this).
> 
> You can also maybe have a look at MeshLab, I know they recently added 
> projective painting, but I'm also not sure how the data is stored in the 
> end.
> 
> jp
> 
> Großer Martin wrote:
> > Hey Maxim,
> > 
> > first, thanks for your help. Now I know the way to manipulate values in
> > my image. But now I have the problem to find out the right pixel in the
> > texture. A little example: I have a complex object with a texture. All
> > triangles of the object are randomly distributed on the texture. And I
> > would like project a texture on my object (planar mapping?!). This
> > texture is my paint brush. Now I want to copy the image data of the
> > paint brush texture in the texture of the object.
> > Can you see my problem?
> > 
> > Cheers,
> > 
> > Martin
> > 
> > PS: However, your code example are very helpful.
> > 
> > 
> > Am Mittwoch, den 01.07.2009, 00:50 +0600 schrieb Maxim Gammer:
> >> FindTextureVisitor .. in files)
> >>
> >> 2009/7/1 Maxim Gammer :
> >>> //Находим объект
> >>>osg::ref_ptr fnnv = new 
> >>> FindNamedNodeVisitor(ObjectName);
> >>>root->accept(*fnnv.get());
> >>>//Если такой объект есть, ищем текстуру
> >>>if (!fnnv->_foundNodes.empty())
> >>>{
> >>>if (fnnv->_foundNodes.size()>1) std::cout << "Warning: 
> >>> Duplicate
> >>> names - " << ObjectName << std::endl;
> >>>osg::ref_ptr zzz = new 
> >>> FindTextureVisitor(UnitNumber);
> >>>fnnv->_foundNodes.front().get()->accept (*zzz.get());
> >>>//Если текстура есть
> >>>if (zzz->image.get())
> >>>{
> >>>/*
> >>>std::cout << "texture find";
> >>>std::cout << zzz->image->s() << std::endl; //ширина
> >>>std::cout << zzz->image->t() << std::endl; //высота
> >>>std::cout << zzz->image->r() << std::endl; 
> >>> //глубина
> >>>*/
> >>>int format = zzz->image->getPixelSizeInBits();
> >>>//std::cout <<"getPixelSizeInBits : "<< format 
> >>> < >>>int width = zzz->image->s();
> >>>int heught = zzz->image->t();
> >>>//
> >>>GLubyte *ptr;
> >>>int inc=0;
> >>>ptr = zzz->image->data();
> >>>if (x>=width) x= 0;
> >>>if (y>=heught) y= 0;
> >>>if (x<0) x= 0;
> >>>if (y<0) y= 0;
> >>>inc=(y*width + x)*format/8; //смещение по 
> >>> RGBARGBARGBA... или 4
> >>>*(ptr+inc+0) = (GLubyte)(r*255.0f);
> >>>*(ptr+inc+1) = (GLubyte)(g*255.0f);
> >>>*(ptr+inc+2) = (GLubyte)(b*255.0f);
> >>>//если RGBA
> >>>if ((format/8)>24)
> >>>{
> >>>   

Re: [osg-users] Painting in Textures

2009-06-30 Thread Großer Martin
Hey Maxim,

first, thanks for your help. Now I know the way to manipulate values in
my image. But now I have the problem to find out the right pixel in the
texture. A little example: I have a complex object with a texture. All
triangles of the object are randomly distributed on the texture. And I
would like project a texture on my object (planar mapping?!). This
texture is my paint brush. Now I want to copy the image data of the
paint brush texture in the texture of the object.
Can you see my problem?

Cheers,

Martin

PS: However, your code example are very helpful.


Am Mittwoch, den 01.07.2009, 00:50 +0600 schrieb Maxim Gammer:
> FindTextureVisitor .. in files)
> 
> 2009/7/1 Maxim Gammer :
> > //Находим объект
> >osg::ref_ptr fnnv = new 
> > FindNamedNodeVisitor(ObjectName);
> >root->accept(*fnnv.get());
> >//Если такой объект есть, ищем текстуру
> >if (!fnnv->_foundNodes.empty())
> >{
> >if (fnnv->_foundNodes.size()>1) std::cout << "Warning: 
> > Duplicate
> > names - " << ObjectName << std::endl;
> >osg::ref_ptr zzz = new 
> > FindTextureVisitor(UnitNumber);
> >fnnv->_foundNodes.front().get()->accept (*zzz.get());
> >//Если текстура есть
> >if (zzz->image.get())
> >{
> >/*
> >std::cout << "texture find";
> >std::cout << zzz->image->s() << std::endl; //ширина
> >std::cout << zzz->image->t() << std::endl; //высота
> >std::cout << zzz->image->r() << std::endl; //глубина
> >*/
> >int format = zzz->image->getPixelSizeInBits();
> >//std::cout <<"getPixelSizeInBits : "<< format 
> > < >int width = zzz->image->s();
> >int heught = zzz->image->t();
> >//
> >GLubyte *ptr;
> >int inc=0;
> >ptr = zzz->image->data();
> >if (x>=width) x= 0;
> >if (y>=heught) y= 0;
> >if (x<0) x= 0;
> >if (y<0) y= 0;
> >inc=(y*width + x)*format/8; //смещение по 
> > RGBARGBARGBA... или 4
> >*(ptr+inc+0) = (GLubyte)(r*255.0f);
> >*(ptr+inc+1) = (GLubyte)(g*255.0f);
> >*(ptr+inc+2) = (GLubyte)(b*255.0f);
> >//если RGBA
> >if ((format/8)>24)
> >{
> >*(ptr+inc+3) = (GLubyte)(a*255.0f);
> >}
> >//Отправляем текстуру в видеопамять)
> >if (flush)
> >{
> >//osg::Image* dest =dynamic_cast
> > (zzz->image->clone(osg::CopyOp::DEEP_COPY_ALL));
> >//zzz->texture->setImage(dest);//zzz->image
> >
> >// dirty the image (increments the modified 
> > count) so that any textures
> >// using the image can be informed that they 
> > need to update.
> >zzz->image->dirty();
> >
> >
> > //zzz->texture->setDataVariance(osg::Object::DYNAMIC);
> >
> > //zzz->stateset->setTextureAttributeAndModes(UnitNumber,
> > zzz->texture, osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
> >//zzz->drawable->setStateSet(zzz->stateset);
> >}
> >}
> >    else
> >{
> >std::cout << "texture NOT find";
> >//delete zzz;
> >//delete fnnv;
> >return false;
> >}
> >//Чистим мусор
> >//delete zzz;
> >}
> >else
> >{
> >std::cout << "Find objects in Root - FALSE! " << ObjectName 
> > << std::endl;

[osg-users] Painting in Textures

2009-06-30 Thread Großer Martin
Hello,

i would like paint on a 3d object in my scene. This object has a texture
and i want to paint into this texture. My paint brush should be another
texture. There are a nice solution in OSG? This problem is not trivial
for me.

I hope everyone can give me a example, a tip or a suitable keyword for
my research.


Cheers,


Martin

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


Re: [osg-users] intersection point and the right triangle

2009-06-22 Thread Großer Martin
Hello Robert,

i find out something. I try to print out the adress of the geometry
object and the vertices like the following lines:

std::cout << "Adresse Geometry: " << &(*geometry) << std::endl;
std::cout << "Adresse Vertices: " << &(*vertices) << std::endl;

The result was...

In LineSegmentIntersector:
---
Adresse Geometry: 0x90de2f8
Adresse Vertices: 0

In my application:
---
Adresse Geometry: 0x90de2f8
Adresse Vertices: 0x90df848

Also my idea was, the cast is faild. Now, I change the dynamic_cast to
the reinterpret_cast and now it works fine!

I use Fedora10 and the gcc compiler version 4.3.1.

Cheers,

Martin


Am Montag, den 22.06.2009, 13:33 +0100 schrieb Robert Osfield:
> Hi Martin,
> 
> A perplexing result for which I have no answer.
> 
> Robert.
> 
> 2009/6/22 Großer Martin :
> > Hello Robert,
> >
> > I dig into the LineSegmentIntersector code and I found the lines 391 - 399:
> >
> > if (geometry) // it is true
> > {
> >   osg::Vec3Array* vertices = dynamic_cast
> > (geometry->getVertexArray());
> >
> >   if (vertices) // it is always false
> >   {
> >  osg::Vec3* first = &(vertices->front());
> >  if (triHit._v1)
> >  {
> >  hit.indexList.push_back(triHit._v1-first);
> >  hit.ratioList.push_back(triHit._r1);
> >  }
> >
> > [...]
> >
> > "if (vertices)" is always false, but the geometry has a vertices. In my
> > application I wrote the following code:
> >
> > const osgUtil::LineSegmentIntersector::Intersection hit =
> > _ray->getFirstIntersection();
> > ::osg::Drawable* drawable = hit.drawable.get();
> > ::osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0;
> > ::osg::Vec3Array* vertices = geometry ? dynamic_cast<
> > ::osg::Vec3Array*>(geometry->getVertexArray()) : 0;
> >
> > Here is the test "if (vertices)" true. It is for me irreproducible. There
> > are not the same geometries with the same vertices in the
> > LineSegementIntersector and in my
> >
> > Cheers,
> >
> >
> > Martin
> >
> >
> >
> > Am Montag, den 22.06.2009, 08:53 +0100 schrieb Robert Osfield:
> >
> > Hi Martin,
> >
> > You'll need to dig into the LineSegmentIntersector code to answer this
> > question.
> >
> > Robert.
> >
> > 2009/6/22 Großer Martin :
> >> Hello Robert,
> >>
> >> now, I use the osgUtil::IntersectionVisitor. The example was very
> >> helpfully.
> >> But I have a new little problem. I get the first intersection:
> >>
> >> const osgUtil::LineSegmentIntersector::Intersection hit =
> >> _ray->getFirstIntersection();
> >>
> >> After this, I get the intersection point in world coordinates:
> >>
> >> osg::Vec3 intersectionPoint = hit.getWorldIntersectPoint();
> >>
> >> This vector is right. But the index list and the ratio list are empty.
> >>
> >> // get the vertex indices.
> >> const osgUtil::LineSegmentIntersector::Intersection::IndexList& indices =
> >> hit.indexList;
> >> // bary coords
> >> const osgUtil::LineSegmentIntersector::Intersection::RatioList& ratios =
> >> hit.ratioList;
> >> if (indices.size()==3 && ratios.size()==3) // is always false
> >> {
> >> // TO DO
> >> }
> >>
> >> What is my mistake? Have you an idea?
> >>
> >> Cheers,
> >>
> >> Martin
> >>
> >>
> >>
> >> Am Freitag, den 19.06.2009, 15:18 +0100 schrieb Robert Osfield:
> >>
> >> Hi Martin,
> >>
> >> I would recommend using the osgUtil::IntersectionVisitor rather than
> >> the osgUtil::IntersectVisitor as the later is deprecated and only kept
> >> around for backwards compatibility.
> >>
> >> As for examples of getting the texture coords of a ray intersections
> >> have a look at the osgViewer::InteractiveImageHandler implementation
> >> in src/osgViewer/ViewerEventHandlers.cpp as it does just this.
> >>
> >> Robert.
> >>
> >> 2009/6/19 Großer Martin :
> >>> Hello all,
> >>>
> >>> i use the intersectVisitor to get the intersection between a ray and a
> >>> geode. It works fine and I'm very happy, because it is very comfortable.
> >>> Now I have the point (vector) of 

Re: [osg-users] intersection point and the right triangle

2009-06-22 Thread Großer Martin
Hello Robert,

I dig into the LineSegmentIntersector code and I found the lines 391 -
399:

if (geometry) // it is true
{
  osg::Vec3Array* vertices = dynamic_cast
(geometry->getVertexArray());

  if (vertices) // it is always false
  {
 osg::Vec3* first = &(vertices->front());
 if (triHit._v1)
 {
 hit.indexList.push_back(triHit._v1-first);
 hit.ratioList.push_back(triHit._r1);
 }

[...]

"if (vertices)" is always false, but the geometry has a vertices. In my
application I wrote the following code:

const osgUtil::LineSegmentIntersector::Intersection hit =
_ray->getFirstIntersection();
::osg::Drawable* drawable = hit.drawable.get();
::osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0;
::osg::Vec3Array* vertices = geometry ?
dynamic_cast< ::osg::Vec3Array*>(geometry->getVertexArray()) : 0;

Here is the test "if (vertices)" true. It is for me irreproducible.
There are not the same geometries with the same vertices in the
LineSegementIntersector and in my 

Cheers,


Martin



Am Montag, den 22.06.2009, 08:53 +0100 schrieb Robert Osfield:

> Hi Martin,
> 
> You'll need to dig into the LineSegmentIntersector code to answer this 
> question.
> 
> Robert.
> 
> 2009/6/22 Großer Martin :
> > Hello Robert,
> >
> > now, I use the osgUtil::IntersectionVisitor. The example was very helpfully.
> > But I have a new little problem. I get the first intersection:
> >
> > const osgUtil::LineSegmentIntersector::Intersection hit =
> > _ray->getFirstIntersection();
> >
> > After this, I get the intersection point in world coordinates:
> >
> > osg::Vec3 intersectionPoint = hit.getWorldIntersectPoint();
> >
> > This vector is right. But the index list and the ratio list are empty.
> >
> > // get the vertex indices.
> > const osgUtil::LineSegmentIntersector::Intersection::IndexList& indices =
> > hit.indexList;
> > // bary coords
> > const osgUtil::LineSegmentIntersector::Intersection::RatioList& ratios =
> > hit.ratioList;
> > if (indices.size()==3 && ratios.size()==3) // is always false
> > {
> > // TO DO
> > }
> >
> > What is my mistake? Have you an idea?
> >
> > Cheers,
> >
> > Martin
> >
> >
> >
> > Am Freitag, den 19.06.2009, 15:18 +0100 schrieb Robert Osfield:
> >
> > Hi Martin,
> >
> > I would recommend using the osgUtil::IntersectionVisitor rather than
> > the osgUtil::IntersectVisitor as the later is deprecated and only kept
> > around for backwards compatibility.
> >
> > As for examples of getting the texture coords of a ray intersections
> > have a look at the osgViewer::InteractiveImageHandler implementation
> > in src/osgViewer/ViewerEventHandlers.cpp as it does just this.
> >
> > Robert.
> >
> > 2009/6/19 Großer Martin :
> >> Hello all,
> >>
> >> i use the intersectVisitor to get the intersection between a ray and a
> >> geode. It works fine and I'm very happy, because it is very comfortable.
> >> Now I have the point (vector) of intersection, but I need the triangle
> >> of the drawable what I hit. I would like calculate the barycentric
> >> coordinates of the point. With this coordinates I want to calculate the
> >> texture coordinates of my intersection point.
> >>
> >> There are a comfortable way in osg? Or have anyone a idea for a nice
> >> solution? I think the intersectVisitor find the triangle, but i can't
> >> get this information.
> >>
> >>
> >> Cheers
> >>
> >> Martin
> >>
> >> ___
> >> osg-users mailing list
> >> osg-users@lists.openscenegraph.org
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >>
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] intersection point and the right triangle

2009-06-22 Thread Großer Martin
Hello Robert,

now, I use the osgUtil::IntersectionVisitor. The example was very
helpfully. But I have a new little problem. I get the first
intersection:

const osgUtil::LineSegmentIntersector::Intersection hit =
_ray->getFirstIntersection();

After this, I get the intersection point in world coordinates:

osg::Vec3 intersectionPoint = hit.getWorldIntersectPoint();

This vector is right. But the index list and the ratio list are empty.

// get the vertex indices.
const osgUtil::LineSegmentIntersector::Intersection::IndexList& indices
= hit.indexList;
// bary coords
const osgUtil::LineSegmentIntersector::Intersection::RatioList& ratios =
hit.ratioList;
if (indices.size()==3 && ratios.size()==3) // is always false
{
// TO DO
}

What is my mistake? Have you an idea?

Cheers,

Martin



Am Freitag, den 19.06.2009, 15:18 +0100 schrieb Robert Osfield:

> Hi Martin,
> 
> I would recommend using the osgUtil::IntersectionVisitor rather than
> the osgUtil::IntersectVisitor as the later is deprecated and only kept
> around for backwards compatibility.
> 
> As for examples of getting the texture coords of a ray intersections
> have a look at the osgViewer::InteractiveImageHandler implementation
> in src/osgViewer/ViewerEventHandlers.cpp as it does just this.
> 
> Robert.
> 
> 2009/6/19 Großer Martin :
> > Hello all,
> >
> > i use the intersectVisitor to get the intersection between a ray and a
> > geode. It works fine and I'm very happy, because it is very comfortable.
> > Now I have the point (vector) of intersection, but I need the triangle
> > of the drawable what I hit. I would like calculate the barycentric
> > coordinates of the point. With this coordinates I want to calculate the
> > texture coordinates of my intersection point.
> >
> > There are a comfortable way in osg? Or have anyone a idea for a nice
> > solution? I think the intersectVisitor find the triangle, but i can't
> > get this information.
> >
> >
> > Cheers
> >
> > Martin
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] intersection point and the right triangle

2009-06-19 Thread Großer Martin
Hello all,

i use the intersectVisitor to get the intersection between a ray and a
geode. It works fine and I'm very happy, because it is very comfortable.
Now I have the point (vector) of intersection, but I need the triangle
of the drawable what I hit. I would like calculate the barycentric
coordinates of the point. With this coordinates I want to calculate the
texture coordinates of my intersection point.

There are a comfortable way in osg? Or have anyone a idea for a nice
solution? I think the intersectVisitor find the triangle, but i can't
get this information.


Cheers

Martin

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


Re: [osg-users] parameter of method home() from MatrixManipulator

2009-06-05 Thread Großer Martin
Hi Robert,

i found this code line, too. But it is a virtal method with empty method
body. Now I use the TrackballManipulator and it does't override the
method home(double). But it works fine. But I don't know why.

Here a part of my code:

// set new home position
_da->getCameraManipulator()->setHomePosition(eye,point, up,false);

// change to new home position
_da->getCameraManipulator()->home(0.0);

Without the last line, it doesn't work.

Make this sense? Or is my programm code bad? There are another way to
set a new home position?

Cheers, Martin

Am Freitag, den 05.06.2009, 15:35 +0100 schrieb Robert Osfield:
> Hi Martin,
> 
> I could recall the answer off the top of my head so I had to look at
> the source code and it said...
> 
> virtual void home(double /*currentTime*/) {}
> 
> So the double is the current frame time.
> 
> Robert.
> 
> 
> 
> 2009/6/5 Großer Martin :
> > hello,
> >
> > I'am so sorry, the mail subject was totally wrong.
> >
> >
> > The matrix manipulator from osg::GA has the method "home(double)". I use
> > this method to change the position of the camera to the new home
> > position. But I don't know what the double parameter represent?
> >
> > Cheers,
> >
> > Martin
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] parameter of method home() from MatrixManipulator

2009-06-05 Thread Großer Martin
hello,

I'am so sorry, the mail subject was totally wrong.


The matrix manipulator from osg::GA has the method "home(double)". I use
this method to change the position of the camera to the new home
position. But I don't know what the double parameter represent?

Cheers,

Martin

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


Re: [osg-users] Xcode project issues

2009-06-05 Thread Großer Martin
hello,

the matrix manipulator from osg::GA has the method "home(double)". I use
this method to change the position of the camera to the new home
position. But I don't know what the double parameter represent?

Cheers,

Martin

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


[osg-users] StandardShadowMap problem

2009-04-30 Thread Großer Martin
Hello,

I use the StandardShadowMap to create a shadow in my scene and I use the
TrackballManipulator to change my camera. But the shadow changes when I
rotate the camera. I don't know why.

Cheers, Martin

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


Re: [osg-users] Skybox example problem

2009-04-15 Thread Großer Martin
Hello Robert,

I'm sorry, thats right. I mean the osgvertexprogram. This example use a
Skybox. When I zoom out or when I use a bigger scene then I get
artefacts in the Skybox. When I change the following line from ...

clearNode->setRequiresClear(false);

... in ...

clearNode->setRequiresClear(true);

... then the environment sphere go missing and I see the clear color.

Now again my questions. Is the problem the distance of the far clipping
plane? And I think the environment sphere is translate with the eye
position?

Cheers, Martin



Am Dienstag, den 07.04.2009, 09:08 +0100 schrieb Robert Osfield:
> 2009/4/7 Großer Martin 
> Hello,
> 
> ok, it seems that nobody has an idea. Maybe is the problem the
> range of
> values?
> 
> Perhaps the problem is that no-one knows what skybox example you are
> talking about...
> 
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] Skybox example problem

2009-04-06 Thread Großer Martin
Hello,

ok, it seems that nobody has an idea. Maybe is the problem the range of
values?

Cheers, Martin

Am Montag, den 06.04.2009, 10:30 +0200 schrieb "Martin Großer":
> Hello all,
> 
> I compiled the skybox example. And I try to load a big scene. Now I have 
> artefacts in the skybox. I can see the environment sphere. I try a smaller 
> scene and zoom out. I get the same result. When I change the following line 
> from ...
> 
> clearNode->setRequiresClear(false);
> 
> ... in ...
> 
> clearNode->setRequiresClear(true);
> 
> ... then the environment sphere go missing and I see the clear color.
> 
> Is the problem the distance of the far clipping plane? And I think the 
> environment sphere is translate with the eye position?
> 
> 
> Cheers, Martin

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


[osg-users] OpenGL and OSG inconsistent in State::reset ??

2009-03-13 Thread Großer Martin
Hello,

a little question about the State. I look at the code and find the
function reset. In this function is set the _currentActiveTextureUnit
with 0. But OpenGL isn't calling. See the following comment from the
source code:

// reset active texture unit values without calling OpenGL

But I think the problem is the consistence between OpenGL and OSG after
calling reset. OSG has the active texture 0 and in the OpenGL state
there is GL_TEXTUER2_ARB?

What is behind all this?

Cheers, Martin

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


Re: [osg-users] glActiveTextureARB in OSG

2009-03-12 Thread Großer Martin
Hello Robert,

first ist works fine with setActiveTextureUnit(0)! Now I would like to
specify my request. I create my Scene and build on my scenegraph and
render my scene with frame(). I use a gtk embedded viewer like the
osgviewerGTK-Example. After the rendering I use a own "render to texture
class". This class based on OpenGL only. I use glCopyTexImage2D to
translate the renderdata in the texture and project the texture on a
plane. But if the active texture unit > 0 it doesn't work. That is the
reason to change the active texture after the rendering.

Thats my new line after frame():

_graphicWindow->getState()->setActiveTextureUnit(0);


Cheers, Martin

Am Donnerstag, den 12.03.2009, 10:45 + schrieb Robert Osfield:
> Hi Martin,
> 
> On Thu, Mar 12, 2009 at 10:36 AM, Großer Martin  wrote:
> > I'd like to use a OSG class. But I don't know which class I can use.
> > There are no way to change the active texture in osg or can I reset the
> > opengl state machine? After the rendering ( frame() ) the active texture
> > is not TEXTURE0_ARB, but that is what I need.
> 
> Use osg::State::setClientActiveTextureUnit(unsigned int unit);
> 
> It's implementation as:
> 
> bool State::setClientActiveTextureUnit( unsigned int unit )
> {
> if (unit!=_currentClientActiveTextureUnit)
> {
> if (_glClientActiveTexture && unit < (unsigned 
> int)_glMaxTextureCoords)
> {
> _glClientActiveTexture(GL_TEXTURE0+unit);
> _currentClientActiveTextureUnit = unit;
> }
> else
> {
> return unit==0;
> }
> }
> return true;
> }
> 
> 
> I would however recommend using OSG objects to do rendering, as well
> as my previously stated reasons it also will mean that you won't have
> clunky high level code trying to manage drawing of the OSG and OpenGL
> code.  For instance you meantion rendering after viewer.frame() which
> suggests you're making the assumption that you are working on a single
> graphics context single thread and that the viewer hasn't released the
> graphics context.  You can do all of these things but you have to know
> what you are doing.
> 
> If you do things in the scene graph, all the management of multiple
> graphics contexts and threading will just fall out for free.
> 
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] glActiveTextureARB in OSG

2009-03-12 Thread Großer Martin
Hello Robert,

I'd like to use a OSG class. But I don't know which class I can use.
There are no way to change the active texture in osg or can I reset the
opengl state machine? After the rendering ( frame() ) the active texture
is not TEXTURE0_ARB, but that is what I need.

Cheers, Martin

Am Mittwoch, den 11.03.2009, 09:08 + schrieb Robert Osfield:
> Hi Martin,
> 
> The OSG queries OpenGL extensions at runtime, so even if the header
> doesn't contain the function then it'll be able to pick it up from the
> driver.
> 
> As a general note, I'd recommend avoiding calling OpenGL yourself, and
> port your code across to using the OSG classes to do the OpenGL work,
> this will avoid issues with clashes of state managment and allow the
> OSG to do state sorting + lazy state updating, and it'll do the
> extension setup for you.
> 
> Robert.
> 
> On Wed, Mar 11, 2009 at 7:44 AM, Großer Martin  wrote:
> > Hello all,
> >
> > I want to use the glActiveTextureARB in my Programm, but it doesn't
> > work. I get the message that the glActiveTextureARB is not declared in
> > this scope. I think the problem is the nvidia driver. It replace the
> > OpenGL headers. But in OSG it works fine, but why?
> > I would like change the active texture to GL_TEXTURE0_ARB. Maybe there
> > are a function in osg?
> >
> > Cheers, Martin
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] glActiveTextureARB in OSG

2009-03-11 Thread Großer Martin
Hello all,

I want to use the glActiveTextureARB in my Programm, but it doesn't
work. I get the message that the glActiveTextureARB is not declared in
this scope. I think the problem is the nvidia driver. It replace the
OpenGL headers. But in OSG it works fine, but why?
I would like change the active texture to GL_TEXTURE0_ARB. Maybe there
are a function in osg?

Cheers, Martin

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