[osg-users] openthreads compile error for wince

2010-01-16 Thread yang zhiyuan
 Hi:
I have tried to compile osg2.96 for wince.It fails at the first key
projects:OpenThreads. I find that Atomic in osg2.96 needs intrin.h,but under
wince,there is no such file.I compare the Atomic.cpp between osg2.6 and
osg2.96 and find that the osg2.6 version does not need intrin.h.So later I
will try replacing Atomic and Atomic.cpp of osg2.96 with osg2.6.

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


[osg-users] how to compile osg2.96 under WINCE

2010-01-15 Thread yang zhiyuan
Hi:
   I see that osg2.96 can support OpenGL ES now,I would like to try compile
osg2.96 for WINCE6.0,but I do not konw how to compile under wince6.0.
   Should all 3party dependecy be recompiled with deployment device:wince
device 5.0 under visual studio 2005.

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


[osg-users] osgMovie example problem

2009-07-25 Thread yang zhiyuan
Hi:
   I find that there is only sound when I set useTextureRectangle to
false.Does quicktime plugin only support TextrueRectangle.


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


[osg-users] MatrixTransform accumulation

2009-07-09 Thread yang zhiyuan
Hi:
   I find something strange like this:
   osg::Matrix _matrix;
   osg::ref_prt PAT1 = new osg::MatrixTransform();
   _matrix.setTrans(osg::Vec3(10.0f,10.0f,0.0f));
   PAT1 ->setMatrix(_matrix);
   osg::ref_prt PAT2 = new osg::MatrixTransform();
PAT2 ->setMatrix(_matrix);
   osg::ref_prt PAT3= new osg::MatrixTransform();
PAT3 ->setMatrix(_matrix);
   osg::ref_prt PAT4= new osg::MatrixTransform();
PAT4 ->setMatrix(_matrix);

  PAT1->addChild(PAT2->get());
  PAT2->addChild(PAT3->get());
  PAT3->addChild(PAT4->get());

 osg::Node* node = osgDB::readNodeFile("*.ive");
 PAT4->addChild(node);

I think node's final position is (40,40,0),but the actual position in scene
is(10,10,0).Do I have to accumulate the four MatrixTransform manually?

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


[osg-users] how to draw an object once

2009-05-03 Thread yang zhiyuan
Hi:
Is there any way to draw an object only once?For example,if I load
a model via
osgDB::readNodeFile(""),then I add the loaded model to rootNode of
scene.What
I want to do is that I want to draw the model once at the first
frame,during the other frames,I just keep the model drawn at the frist
frame(do not redraw the model ).

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


[osg-users] how to change texture dynamically

2009-02-23 Thread yang zhiyuan
Hi:
   If I have a node with four texure in it, what should I do if I want to
change one texture of these 4 dynamically?(the new texure's size my be
different)


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


Re: [osg-users] how to compile osgplugins\quicktime plugin (Robert Osfield)

2009-02-20 Thread yang zhiyuan
Hi:
The problem has been solved yet.Line 4016 and Line 4017 of
QuicktimeComponents.h has been commented.Uncomment this two lines,then
compile will be ok.

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


[osg-users] how to compile osgplugins\quicktime plugin

2009-02-19 Thread yang zhiyuan
Hi:
I failed to compile osgdb_qt plugin under osgplugins\quicktime via
osg2.6 and
quick time 7.0&7.3 SDK.There are a lot of compile errors.I wonder that
which version of quick time SDK is needed for compiling osgdb_qt
plugin under osg2.6.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] how to get drawing primitives

2009-02-11 Thread yang zhiyuan
Hi:
If I load a osg model like this:
osg::Node* node = osgDB::readNodeFile("modelname");
If I want to get the drawing primitives(vertex coord,normal,vertex
color and so on) form the node I created,What should I do?Is there
some member functions to call to get the primitive data I wanted.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] problem with osg::MatrixTransform

2008-11-26 Thread yang zhiyuan
Hi:
 I try to transform osg::Node by MatrixTransform,but failed .Could
anybody tell me what is the matter.

   Here is my code:

   osgViewer::Viewer viewer;
osg::Node* node = osgDB::readNodeFile("car/car.osg");

 osg::Group* rootNode = new osg::Group;
osg::MatrixTransform* mt1=new osg::MatrixTransform;
mt1->setMatrix(osg::Matrix::translate(osg::Vec3(0.0,0.0f,2.0f)));
mt1->addChild(node);

rootNode->addChild(mt1);

 viewer.setSceneData(rootNode);
viewer.realize();
viewer.run();



another problem: can I add matrixtransform to another matrixtransfrom in
order to get the total effect the two matrixtransforms?Should I use
nodevisitor to implement this idea?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] how to add shader to osgcal node

2008-11-12 Thread yang zhiyuan
Hi:
I am trying to add shader to osgcal node.
I do it like this:

   osgCal::CoreModel *core = new osgCal::CoreModel("dummy");
 load(core); //< loading some data into it
 // Creating a concrete model using the core template
 osgCal::Model *model = new osgCal::Model();
 model->create(core);
 osgCal::Model *model_2 = new osgCal::Model();
 model_2->create(core);
 //osgCal::Model *model = new osgCal::Model(core);
 // Setting the first animation in loop mode, weight 1, and starting just
now
 model->startLoop(0, 1.0f, 0.0f);
 model_2->startLoop(1, 1.0f, 0.0f);
 model_2->setTimeScale(1.5f);
 osg::ref_ptr escena = new osg::Group();
 escena->addChild(model);
 escena->addChild(model_2);
osg::StateSet* stateSet = escena->getOrCreateStateSet();
osg::Program* program= new osg::Program;
osg::Shader*   shader = new osg::Shader(osg::Shader::VETEXT);
...

the problem is the shander does not apply to the osg node,is there any other
way to add shader to osgcal node?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Re osg::getGlyphQuads

2008-10-14 Thread yang zhiyuan
Hi:
I have solved the problem how to get one char's position inside a
osgText::Text;
The purpose is to move cursor when input text.

Here is my code:
   updateCursorPos(const std::string& string, int position)
{
  osg::Vec3 cursor_position = m_inputText->getPosition();
  //get the font resolution
   osgText::FontResolution fr;
fr.first = FONT_RES_X;
fr.second = FONT_RES_Y;

//m_inputText is the osg::Text from which you want to get the last
char's position
 const osgText::Font* font = m_inputText->getFont();
 osgText::Font* font1 = const_cast(font);
//get total size of input parameter string
   //string is the the std::string inside the m_inputText
unsigned int size = string.size();
osgText::Font::Glyph* glyph = font1->getGlyph(fr,size-1);
osgText::Font::GlyphTexture* glyphTexture = glyph->getTexture();

const osgText::Text::GlyphQuads * glyph_quads =
m_inputText->getGlyphQuads( glyphTexture );
if( glyph_quads )
{
int coord_size = glyph_quads->getTransformedCoords(0).size();
int input_text_size = string.size(); // # chars on line.
if( position > 0 )
{
// Get position of character under cursor
// There are 4 coords per character, BottomLeft, TopLeft,
//   BottomRight, TopRight. We want the BottomRight.
osg::Vec3 glyph_pos = glyph_quads->getTransformedCoords(0)[
position * 4 - 2 ];
cursor_position[0] = glyph_pos[0];  // Use only the X position
}
}

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


[osg-users] osgText::getGlyphQuads

2008-10-12 Thread yang zhiyuan
Hi:
 I have some code to update from osg1.2 to osg2.6 and confront with some
problem.
 the input parameter for osgText::getGlyphQuads has changed from
osg::StateSet* stateSet
 to Font::GlyphTexture* texture.


 Here is my original code:

 osg::Vec3 cursor_position = m_inputText->getPosition();
osg::StateSet* ss = m_inputText->getStateSet();


//
   //m_inputText->getGlyphQuads( ss ) has to be changed.:)
const osgText::Text::GlyphQuads * glyph_quads =
m_inputText->getGlyphQuads( ss );


if( glyph_quads )
{
int coord_size = glyph_quads->getTransformedCoords(0).size();
int input_text_size = string.size(); // # chars on line.
//assert( position <= input_text_size );
//assert( position * 4 <= coord_size );
if( position > 0 )
{
// Get position of character under cursor
// There are 4 coords per character, BottomLeft, TopLeft,
//   BottomRight, TopRight. We want the BottomRight.
osg::Vec3 glyph_pos = glyph_quads->getTransformedCoords(0)[
position * 4 - 2 ];
cursor_position[0] = glyph_pos[0];  // Use only the X position
}
}

Is there anyone can tell me how to modify the above function
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSGPPU

2008-10-04 Thread yang zhiyuan
Hi:
I just down load OSGPPU and compile it with OSG2.6.But the
example(hdr,dof) output nothing(the screen is black).Is there anybody can
tell me what is wrong.
The example viewer can not run when execute to here:
inline observer_ptr& operator = (T* ptr)
{
if (_ptr==ptr) return *this;

// it goes wrong
here!!!
if (_ptr) _ptr->removeObserver(this);

_ptr = ptr;
if (_ptr) _ptr->addObserver(this);
return *this;
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] HDR in osg

2008-10-03 Thread yang zhiyuan
Hi:
I try to implement HDR render pipline in osg.Ater I render the scene to
FBO as a texture,I do not konw how to apply this texture to the original
scene after post processed.
   following is the code for render to texture:

 //render to texture
{
// texture to render to and to use for rendering of flag.
osg::Texture* texture = 0;


osg::TextureRectangle* textureRect = new
osg::TextureRectangle();
textureRect->setTextureSize(tex_width, tex_height);
textureRect->setInternalFormat(GL_RGBA);

textureRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);

textureRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

texture = textureRect;
texture->setInternalFormat(GL_FLOAT_RGBA32_NV);
texture->setSourceFormat(GL_RGBA);
texture->setSourceType(GL_FLOAT);





 osg::Camera* camera = new osg::Camera;
// set up the background color and clear mask.
camera->setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f));
camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// the camera is going to look at our input quad
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
// set viewport
camera->setViewport(0, 0, tex_width, tex_height);
// set the camera to render before the main camera.
camera->setRenderOrder(osg::Camera::PRE_RENDER);
// tell the camera to use OpenGL frame buffer objects

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),
texture);
//camera->attach(osg::CameraNode::COLOR_BUFFER, texture);
osg::Image* image = new osg::Image;
image->allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT);

camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),
image);
textureRect->setImage(0, image);
//unsigned int numFace = texture->getNumImages();
camera->setPostDrawCallback(new MyCameraPostDrawCallback(image));
camera->addChild(rootnode);
rootGroup->addChild(camera);

}

   Is there any one can tell me what to do if I want to access the texure in
pixel shader.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org