[osg-users] Problems resizing the screen

2008-07-19 Thread Hugo Gomes
Hello,

im having problems resizing the screen.

I start up a osgViewer::Viewer, with a menu scene for the user to select a
proper resolution before simulation starts.
When the user presses start in the menu, i set the done flag to true (to
escape the main loop), resize the screen (if necessary), set scene data with
a loader, setup the viewport with the resolution, and adjust the modelview
for the given aspect ratio, and set the done flag to false and enterin again
in the loop (viewer-frame()).

To resize im using the osg::GraphicsContext::WindowingSystemInterface. Which
works fine. The problem is the output i get whenever i choose a different
resolution than the one im using:

http://img180.imageshack.us/my.php?image=artifactsafterresizepm1.png



What is happening ? Am i forgeting something ?

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


[osg-users] BumpMapping osgFX problem

2008-07-02 Thread Hugo Gomes
Hello,

im having problems with the BumpMapping osgFX, somehow it just seems it
doesn't light the model. Model is only responding to ambient light. Is there
any quirck im forgetting of doing ?

The osgfxbrowser example works fine, so its not a hardware problem...

Here is the code for the light setup:

osg::ref_ptrosg::Light light = new osg::Light;
light-setLightNum( 0 );
light-setDiffuse( osg::Vec4( 1, 1, 1, 1 ) );
light-setSpecular( osg::Vec4( 1, 1, 0.8f, 1 ) );
light-setAmbient( osg::Vec4( 0.2f, 0.2f, 0.2f, 0.2f ) );
light-setPosition( osg::Vec4( 10, -1, 0, 0 ) );

root = new osg::LightSource;
root-setLight( light.get() );
root-setLocalStateSetModes();


Here is the code for the bump mapping FX node:

void ScenePlanet::generatePlanet()
{
PlanetRotateCallback* rotate_cb;
osg::Geode* planet_geode = new osg::Geode();

osg::StateSet* planet_stateset = planet_geode-getOrCreateStateSet();

// get the textures according to the position that they were inserted at
osg::Texture2D* texture = textures-at(0);
osg::Texture2D* normal_map = textures-at(1);
// set them up
planet_stateset-setMode(GL_LIGHTING, osg::StateAttribute::ON);
planet_stateset-setTextureAttributeAndModes( 0, texture,
osg::StateAttribute::ON );
planet_stateset-setTextureAttributeAndModes( 1, normal_map,
osg::StateAttribute::ON );

osg::TessellationHints* hints = new osg::TessellationHints;

hints-setDetailRatio(0.5f);
planet_geode-addDrawable(
new osg::ShapeDrawable(
new osg::Sphere( osg::Vec3( 0.0f,0.0f,0.0f ), 5.0f ) )
);

// set up the effects of the model
osgFX::BumpMapping* bump_fx = new osgFX::BumpMapping();
bump_fx-setEnabled( true );
bump_fx-addChild( planet_geode );
bump_fx-setNormalMapTextureUnit(1);
bump_fx-setDiffuseTextureUnit(0);
bump_fx-setLightNumber(0);

bump_fx-prepareChildren();
//bump_fx-setUpDemo();

// set up a transform to rotate the model
osg::ref_ptrosg::PositionAttitudeTransform xform =
new
osg::PositionAttitudeTransform();
xform-setPosition( osg::Vec3( 1.5, 0, 1 ) );
xform-setPivotPoint( osg::Vec3( 0, 0, 0 ) );

rotate_cb = new PlanetRotateCallback;
xform-setUpdateCallback( rotate_cb );
xform-addChild( bump_fx );

root-addChild( xform.get() );
}

Here is the code for the texture generation:

Diffuse Texture:


osg_img-setImage( size, size, 1,
   4, GL_RGBA, GL_UNSIGNED_BYTE,
   writer.GetImageData(),
   osg::Image::USE_NEW_DELETE );
texture-setImage(osg_img);
texture-setFilter(osg::Texture::MIN_FILTER,
osg::Texture::LINEAR_MIPMAP_LINEAR);
texture-setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
texture-setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
texture-setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
texture-setMaxAnisotropy( 8 );

textures-push_back( texture );



Normal Texture:


osg_normalmap_img-setImage( size, size, 1,
 4, GL_RGBA, GL_UNSIGNED_BYTE,
 writer.GetImageData(),
 osg::Image::USE_NEW_DELETE );
normalmap_texture-setImage(osg_normalmap_img);
normalmap_texture-setFilter(osg::Texture::MIN_FILTER,
osg::Texture::LINEAR_MIPMAP_LINEAR);
normalmap_texture-setFilter(osg::Texture::MAG_FILTER,
osg::Texture::LINEAR);
normalmap_texture-setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
normalmap_texture-setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
normalmap_texture-setMaxAnisotropy(8);

textures-push_back( normalmap_texture );
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] GL_LINE and GL_POINT question

2008-07-01 Thread Hugo Gomes
Hello,

how do i set the GL_POINT_SIZE and equivalent GL_LINE_SIZE ?


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] GL_LINE and GL_POINT question

2008-07-01 Thread Hugo Gomes
Aren't they wrapped by osg ? ...
Can't i specify that info in a stateset ?

On Wed, Jul 2, 2008 at 1:36 AM, Willy P [EMAIL PROTECTED] wrote:

 http://www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml


 On Tue, Jul 1, 2008 at 4:51 PM, Hugo Gomes [EMAIL PROTECTED]
 wrote:
  Hello,
 
  how do i set the GL_POINT_SIZE and equivalent GL_LINE_SIZE ?
 
 
  Thanks in advance
 
  ___
  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] Changing fullscreen resolution with osg::Viewer

2008-06-15 Thread Hugo Gomes
Hello, i'm new to osg, and i've been building some basic scenes to learn
about it. Yet i haven't been able to change the screen resolution when in
fullscreen mode. I'm using a CompositeViewer in a main class, and a Viewer
in each scene, is there a simple way to change it without changing to SDL or
some other lib ? What about screen refresh rate, is it also possible to
change it using the CompositeViewer ?


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