[osg-users] How can I rotate a image

2010-09-07 Thread Martin Großer
Hello,

I would like rotate a image. Because I want to rotate the separate images from 
my sky box. I think it is difficult to change the texture coordinates of my 
sphere. I my idea is to rotate the images at the beginning.

Example

::osg::Image* image = osgDB::readImageFile(c_posX.Filename);

// rotate image

_cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image);

I hope someone can help me.

Cheers

Martin
-- 
GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How can I rotate a image

2010-09-07 Thread Trajce (Nick) Nikolov
what do you mean by rotating an image? Could you tell what you are
actually trying to do? More info you provide more chances to get some advice

-Nick


2010/9/7 Martin Großer grosser.mar...@gmx.de

 Hello,

 I would like rotate a image. Because I want to rotate the separate images
 from my sky box. I think it is difficult to change the texture coordinates
 of my sphere. I my idea is to rotate the images at the beginning.

 Example

 ::osg::Image* image = osgDB::readImageFile(c_posX.Filename);

 // rotate image

 _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image);

 I hope someone can help me.

 Cheers

 Martin
 --
 GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
 http://portal.gmx.net/de/go/dsl
 ___
 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] How can I rotate a image

2010-09-07 Thread Martin Großer
Ok, also I have create a sky box like the sky box in the vertexprogramm example 
of osg. But in my scene the up vector is in the z direction and not in the y 
direction. Now I have rotate my sky box 90 degrees around the x axis.

Is it understandable?

But now, the images on the sky box are in the wrong orientation. For example 
the image in the positiv x direction is 90 degrees rotated. And I want to 
correct this rotation.

Is it understandable? I am not sure.

Cheers

Martin

 Original-Nachricht 
 Datum: Tue, 7 Sep 2010 14:57:24 +0400
 Von: Trajce (Nick) Nikolov nikolov.tra...@gmail.com
 An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Betreff: Re: [osg-users] How can I rotate a image

 what do you mean by rotating an image? Could you tell what you are
 actually trying to do? More info you provide more chances to get some
 advice
 
 -Nick
 
 
 2010/9/7 Martin Großer grosser.mar...@gmx.de
 
  Hello,
 
  I would like rotate a image. Because I want to rotate the separate
 images
  from my sky box. I think it is difficult to change the texture
 coordinates
  of my sphere. I my idea is to rotate the images at the beginning.
 
  Example
 
  ::osg::Image* image = osgDB::readImageFile(c_posX.Filename);
 
  // rotate image
 
  _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image);
 
  I hope someone can help me.
 
  Cheers
 
  Martin
  --
  GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99
 Euro/mtl.!*
  http://portal.gmx.net/de/go/dsl
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 

-- 
GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How can I rotate a image

2010-09-07 Thread Wojciech Lewandowski

Hi Martin,

If you follow the vertexexample closely then then rotation can be simply 
added (or removed because its already there) to TexMat in TexMatCallback. 
Look at R matrix in TexMatCallback::operator(). Multiply this R matrix by 
neccessary rotation. If you don't know what rotation exactly, try 90 or -90 
degrees around X, Y, Z axes. After up to 6 tries you will find the one that 
best suits your need. And you will learn a lot ;-)


Wojtek

--
From: Martin Großer grosser.mar...@gmx.de
Sent: Tuesday, September 07, 2010 1:16 PM
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] How can I rotate a image

Ok, also I have create a sky box like the sky box in the vertexprogramm 
example of osg. But in my scene the up vector is in the z direction and 
not in the y direction. Now I have rotate my sky box 90 degrees around the 
x axis.


Is it understandable?

But now, the images on the sky box are in the wrong orientation. For 
example the image in the positiv x direction is 90 degrees rotated. And I 
want to correct this rotation.


Is it understandable? I am not sure.

Cheers

Martin

 Original-Nachricht 

Datum: Tue, 7 Sep 2010 14:57:24 +0400
Von: Trajce (Nick) Nikolov nikolov.tra...@gmail.com
An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Betreff: Re: [osg-users] How can I rotate a image



what do you mean by rotating an image? Could you tell what you are
actually trying to do? More info you provide more chances to get some
advice

-Nick


2010/9/7 Martin Großer grosser.mar...@gmx.de

 Hello,

 I would like rotate a image. Because I want to rotate the separate
images
 from my sky box. I think it is difficult to change the texture
coordinates
 of my sphere. I my idea is to rotate the images at the beginning.

 Example

 ::osg::Image* image = osgDB::readImageFile(c_posX.Filename);

 // rotate image

 _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image);

 I hope someone can help me.

 Cheers

 Martin
 --
 GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99
Euro/mtl.!*
 http://portal.gmx.net/de/go/dsl
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

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



--
GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl
___
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] How can I rotate a image

2010-09-07 Thread Trajce (Nick) Nikolov
so yo have a skybox model (probably a dome). and you want to render
something in cube map and apply that to the skybox, correct?
-Nick


2010/9/7 Martin Großer grosser.mar...@gmx.de

 Ok, also I have create a sky box like the sky box in the vertexprogramm
 example of osg. But in my scene the up vector is in the z direction and not
 in the y direction. Now I have rotate my sky box 90 degrees around the x
 axis.

 Is it understandable?

 But now, the images on the sky box are in the wrong orientation. For
 example the image in the positiv x direction is 90 degrees rotated. And I
 want to correct this rotation.

 Is it understandable? I am not sure.

 Cheers

 Martin

  Original-Nachricht 
  Datum: Tue, 7 Sep 2010 14:57:24 +0400
  Von: Trajce (Nick) Nikolov nikolov.tra...@gmail.com
  An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
  Betreff: Re: [osg-users] How can I rotate a image

  what do you mean by rotating an image? Could you tell what you are
  actually trying to do? More info you provide more chances to get some
  advice
 
  -Nick
 
 
  2010/9/7 Martin Großer grosser.mar...@gmx.de
 
   Hello,
  
   I would like rotate a image. Because I want to rotate the separate
  images
   from my sky box. I think it is difficult to change the texture
  coordinates
   of my sphere. I my idea is to rotate the images at the beginning.
  
   Example
  
   ::osg::Image* image = osgDB::readImageFile(c_posX.Filename);
  
   // rotate image
  
   _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image);
  
   I hope someone can help me.
  
   Cheers
  
   Martin
   --
   GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99
  Euro/mtl.!*
   http://portal.gmx.net/de/go/dsl
   ___
   osg-users mailing list
   osg-users@lists.openscenegraph.org
  
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  

 --
 GMX DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
 http://portal.gmx.net/de/go/dsl
 ___
 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] How can I rotate a image

2010-09-07 Thread Trajce (Nick) Nikolov
::ABSOLUTE_RF);
 camera-setName(ENVIRONMENT_CAMERA);
camera-setUpdateCallback( new UpdateEnvironmentCameraNodeCallback(
 id[osg::TextureCubeMap::POSITIVE_Y].first,
id[osg::TextureCubeMap::POSITIVE_Y].second,
 mViewer-getView(0)-getCamera()) );

mEnvironmentGroup-addChild(camera);

}

// back face
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setViewport(new osg::Viewport(0, 0, tex_width, tex_height));
camera-addChild(mSilverLiningGroup.get());
camera-setAllowEventFocus(false);
 camera-setProjectionMatrixAsPerspective(90.0f, 1.0, 1, range);
camera-setViewMatrixAsLookAt(osg::Vec3(0,0,0),id[osg::TextureCubeMap::NEGATIVE_Y].first,id[osg::TextureCubeMap::NEGATIVE_Y].second);
 camera-setRenderTargetImplementation(renderTargetImplementation);
camera-attach(osg::Camera::COLOR_BUFFER, mEnvironmentCubeMap.get(),
0, osg::TextureCubeMap::NEGATIVE_Y);
 camera-setUserData(mViewer-getView(0)-getCamera()-getUserData());
camera-setRenderOrder(osg::Camera::PRE_RENDER);
 camera-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
camera-setCullingActive(false);
 camera-setClearMask(0);
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 camera-setName(ENVIRONMENT_CAMERA);
camera-setUpdateCallback( new UpdateEnvironmentCameraNodeCallback(
 id[osg::TextureCubeMap::NEGATIVE_Y].first,
id[osg::TextureCubeMap::NEGATIVE_Y].second,
 mViewer-getView(0)-getCamera()) );

mEnvironmentGroup-addChild(camera);

}

// top face
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setViewport(new osg::Viewport(0, 0, tex_width, tex_height));
 camera-addChild(mSilverLiningGroup.get());
camera-setAllowEventFocus(false);
 camera-setProjectionMatrixAsFrustum(-1.0,1.0,-1.0,1.0,1.0,range);
camera-setViewMatrixAsLookAt(osg::Vec3(0,0,0),id[osg::TextureCubeMap::POSITIVE_Z].first,id[osg::TextureCubeMap::POSITIVE_Z].second);
 camera-setRenderTargetImplementation(renderTargetImplementation);
camera-attach(osg::Camera::COLOR_BUFFER, mEnvironmentCubeMap.get(),
0, osg::TextureCubeMap::POSITIVE_Z);
 camera-setUserData(mViewer-getView(0)-getCamera()-getUserData());
camera-setRenderOrder(osg::Camera::PRE_RENDER);
 camera-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
camera-setCullingActive(false);
 camera-setClearMask(0);
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 camera-setName(ENVIRONMENT_CAMERA);
camera-setUpdateCallback( new UpdateEnvironmentCameraNodeCallback(
 id[osg::TextureCubeMap::POSITIVE_Z].first,
id[osg::TextureCubeMap::POSITIVE_Z].second,
 mViewer-getView(0)-getCamera()) );

mEnvironmentGroup-addChild(camera);


}



// bottom face
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setViewport(new osg::Viewport(0, 0, tex_width, tex_height));
 camera-addChild(mSilverLiningGroup.get());
camera-setAllowEventFocus(false);
 camera-setProjectionMatrixAsFrustum(-1.0,1.0,-1.0,1.0,1.0,range);
camera-setViewMatrixAsLookAt(osg::Vec3(0,0,0),id[osg::TextureCubeMap::NEGATIVE_Z].first,id[osg::TextureCubeMap::NEGATIVE_Z].second);
 camera-setRenderTargetImplementation(renderTargetImplementation);
camera-attach(osg::Camera::COLOR_BUFFER, mEnvironmentCubeMap.get(),
0, osg::TextureCubeMap::NEGATIVE_Z);
 camera-setUserData(mViewer-getView(0)-getCamera()-getUserData());
camera-setRenderOrder(osg::Camera::PRE_RENDER);
 camera-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
camera-setCullingActive(false);
 camera-setClearMask(0);
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 camera-setName(ENVIRONMENT_CAMERA);
camera-setUpdateCallback( new UpdateEnvironmentCameraNodeCallback(
 id[osg::TextureCubeMap::NEGATIVE_Z].first,
id[osg::TextureCubeMap::NEGATIVE_Z].second,
 mViewer-getView(0)-getCamera()) );

mEnvironmentGroup-addChild(camera);

}


mScene-addChild( mEnvironmentGroup.get() );

-Nick


On Tue, Sep 7, 2010 at 3:41 PM, Wojciech Lewandowski
lewandow...@ai.com.plwrote:

 Hi Martin,

 If you follow the vertexexample closely then then rotation can be simply
 added (or removed because its already there) to TexMat in TexMatCallback.
 Look at R matrix in TexMatCallback::operator(). Multiply this R matrix by
 neccessary rotation. If you don't know what rotation exactly, try 90 or -90
 degrees around X, Y, Z axes. After up to 6 tries you will find the one that
 best suits your need. And you will learn a lot ;-)

 Wojtek

 --
 From: Martin Großer grosser.mar...@gmx.de
 Sent: Tuesday, September 07, 2010 1:16 PM
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Subject: Re: [osg-users] How can I rotate a image


  Ok, also I have create a sky box like the sky box in the vertexprogramm
 example of osg. But in my scene the up vector is in the z direction and not
 in the y direction. Now I have rotate my sky box 90 degrees around the x
 axis.

 Is it understandable?

 But now, the images on the sky box