Re: [osg-users] [build] Why Restoring OpenGL currentState is not working with OpenGLES2 but working with GLES1

2012-11-16 Thread Koduri Lakshmi
Hi,

The error is not with the previous post code. 

When I added the following code then the model is displayed.


Code:
 mtForMarker[idx]=new osg::MatrixTransform();

 osg::Shader * vshader = new osg::Shader(osg::Shader::VERTEX, 
gVertexShader );
osg::Shader * fshader = new osg::Shader(osg::Shader::FRAGMENT, 
gFragmentShader );

osg::Program * prog = new osg::Program;
   prog-addShader ( vshader );
prog-addShader ( fshader );

mtForMarker[idx]-getOrCreateStateSet()-setAttribute ( prog );

 mtForMarker[idx]-addChild(loadedModel[idx].get());
 modelSwitch-addChild(mtForMarker[idx].get());
 
 
  osgViewer::Viewer::Windows windows;
_viewer-getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != 
windows.end();++itr)
{
  (*itr)-getState()-setUseModelViewAndProjectionUniforms(true);
  (*itr)-getState()-setUseVertexAttributeAliasing(true);
}



This code I added from osgAndroidOpenGLES2 example.

As I am new to OSG I have two doubts

1) Why should I add the shaders in OpenGLES2 to display model. If I remove this 
code then the model is not displayed. OpenGLES1 dosnt have this shaders.

2) If I add this code then the textures are not applied to my model. I got  
model from 3DS MAX. How can I get textures?

Can you please guide me how to get textures? If shaders are necessary to render 
model on Android then how can I handle textures (or any others) ? Is there any 
tutorial to handle this in Android?

... 


Thank you!

Cheers,
Koduri

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




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


[osg-users] Problem compiling VIrtualPlanetBuilder on OS X

2012-11-16 Thread Tony Vasile
I am trying to build VirtualPlanetBuilder against OpenSceneGraph 3.1.0 by
using the trunk branch from the virtual planet builder svn repository on OS
X Mountain Lion (10.8.2) and I am getting the following errors whilst
compiling BuildOptionsIO.cpp:
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:508:42:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
unsigned int size = 0; is  size  IS_BEGIN_BRACKET;
 ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
note:
  expanded from macro 'IS_BEGIN_BRACKET'
#define IS_BEGIN_BRACKETis.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:515:11:
error:
  no member named 'END_BRACKET' in 'osgDB::InputStream'
is  IS_END_BRACKET;
  ^~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
note:
  expanded from macro 'IS_END_BRACKET'
#define IS_END_BRACKET  is.END_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:523:19:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
os  size  OS_BEGIN_BRACKET  std::endl;
  ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:34:36:
note:
  expanded from macro 'OS_BEGIN_BRACKET'
#define OS_BEGIN_BRACKETos.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:529:11:
error:
  no member named 'END_BRACKET' in 'osgDB::OutputStream'
os  OS_END_BRACKET  std::endl;
  ^~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:35:36:
note:
  expanded from macro 'OS_END_BRACKET'
#define OS_END_BRACKET  os.END_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:539:42:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
unsigned int size = 0; is  size  IS_BEGIN_BRACKET;
 ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
note:
  expanded from macro 'IS_BEGIN_BRACKET'
#define IS_BEGIN_BRACKETis.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:545:11:
error:
  no member named 'END_BRACKET' in 'osgDB::InputStream'
is  IS_END_BRACKET;
  ^~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
note:
  expanded from macro 'IS_END_BRACKET'
#define IS_END_BRACKET  is.END_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:552:19:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
os  size  OS_BEGIN_BRACKET  std::endl;
  ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:34:36:
note:
  expanded from macro 'OS_BEGIN_BRACKET'
#define OS_BEGIN_BRACKETos.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:558:11:
error:
  no member named 'END_BRACKET' in 'osgDB::OutputStream'
os  OS_END_BRACKET  std::endl;
  ^~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:35:36:
note:
  expanded from macro 'OS_END_BRACKET'
#define OS_END_BRACKET  os.END_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:571:11:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
is  IS_BEGIN_BRACKET;
  ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
note:
  expanded from macro 'IS_BEGIN_BRACKET'
#define IS_BEGIN_BRACKETis.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:577:11:
error:
  no member named 'END_BRACKET' in 'osgDB::InputStream'
is  IS_END_BRACKET;
  ^~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
note:
  expanded from macro 'IS_END_BRACKET'
#define IS_END_BRACKET  is.END_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:586:11:
error:
  no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
os  OS_BEGIN_BRACKET  std::endl;
  ^~~~
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:34:36:
note:
  expanded from macro 'OS_BEGIN_BRACKET'
#define OS_BEGIN_BRACKETos.BEGIN_BRACKET
~~ ^
/users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:594:11:
error:
  no member 

Re: [osg-users] R: building OSG 3.0.1 on Mac Snow Leopard

2012-11-16 Thread Stephan Maximilian Huber
Hi Gianluca,

the message PixelBufferCocoa :: realizeImplementation not implemented
yet should not lead to a crash.

Without a stack-trace it's hard to tell why your app crashes.

And please keep the discussion on the osg-users-list, so other have a
chance to search the archive.

cheers,

Stephan
Am 16.11.12 12:13, schrieb Gianluca Natale:
 Hi Stephan,
 thanks for your answer.
 
 I did what you suggested, that is to say use the libs provided by the system, 
 and set OSG_WINDOWING_SYSTEM to Cocoa.
 Anyway, while it builds OSG (on a MacOS 10.6.8), it gave me these warnings, 
 which I don't know the meaning of (sorry, I don't know objective-C at all):
 
 Warning: class 'GraphicsWindowCocoaDelegate' does not implement the 
 'NSWindowDelegate' protocol.
 
 I ignored it, since it built OSG in any case.
 Then I built my application based upon OSG, and everything built without 
 errors and warning.
 But when I launched it, I see this message on screen:
 
 PixelBufferCocoa :: realizeImplementation not implemented yet
 
 And my application quits unexpectedly.
 I still haven't debugged yet, I wonder if that might be the cause of such 
 exit.
 I just took a look at your code in PixelBufferCocoa.mm, but as I told you I 
 don't know anything of Objective-C.
 
 Thanks,
 Gianluca
 
 
 -Messaggio originale-
 Da: Stephan Maximilian Huber [mailto:ratzf...@digitalmind.de] 
 Inviato: giovedì 15 novembre 2012 12:39
 A: OpenSceneGraph Users
 Cc: Gianluca Natale
 Oggetto: Re: [osg-users] building OSG 3.0.1 on Mac Snow Leopard
 
 Hi Gianluca,
 
 it should be safe to use the libs provieded by the system. Carbon is 
 deprecated, and most new features went into the cocoa window implementation 
 of osg, so please use the cocoa window-implementation.
 
 
 cheers,
 
 Stephan
 Am 14.11.12 17:19, schrieb Gianluca Natale:
 Hi all,
 I'm trying to build OSG 3.0.1 on Mac OSX 10.6 using the procedure 
 well-described on OSG website.
 But when I clicked on Configure in CMake-gui, after setting Where is the 
 source code and Where to build the binaries, I gotten many 
 red-highlighted options.
 I could fix most of them (actually I didn't set my build folder as 
 suggested, i.e. the prebuilt packages for dependencies are not in 
 OpenSceneGraph/3rdParty), but I have some doubt for some of them, I hope 
 anyone can give me some tip. Sorry if these are all silly questions!

 CURL LIBRARY:
 CURL_INCLUDE_DIR points to /usr/include, instead of pointing to 
 /myBuildfolder/3rdParty/include, where I unzipped the prebuilt packages.
 So, curl is already installed on my system, and the version I have there is 
 4. But in prebuilt packages there is version 4.1. Should I use the newest 
 one?

 FREETYPE LIBRARY:
 Same as CURL, it is already installed on my system. Should I use in any case 
 that provided in the prebuilt packages, or can I leave that gotten from the 
 system?

 OSG_WINDOWING_SYSTEM defaults to Carbon on my machine. Isn't it deprecated? 
 Should I change it to Cocoa?

 ZLIB LIBRARY:
 Same question as curl, should I use in any case the version provided in the 
 prebuilt packages?

 Thanks,
 Gianluca




 ___
 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] Cannot set custom shader for a node

2012-11-16 Thread michael kapelko
Hi.
I'm using SoftShadowMap scene and I want to assign custom shader to one of
the nodes, but it doesn't work.

I do it like that:

osg::ref_ptrosg::Shader frag = new osg::Shader(osg::Shader::FRAGMENT,
code);
osg::StateSet *ss = box-getOrCreateStateSet();
osg::ShaderAttribute *sa = new osg::ShaderAttribute;
sa-setType(osg::StateAttribute::FRAGMENTPROGRAM);
ss-setAttribute(sa);
sa-addShader(frag.get());

The complete code is here: http://pastie.org/5387472

As seen from the code, I tried to enable shader composition, but that
didn't help me.

Am I doing it wrong?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] slave camera using rtt texture

2012-11-16 Thread Daniel Schmid
Hi all

I have a composite viewer, where the main camera renders to texture. No I added 
a slave camera (POST_RENDER that uses the same graphics context as the main 
camera). I had a screen quad child on which I would like to render the texture 
from the main camera. But all I get is a black screen.

Regards
Daniel

[code]
osg::Camera* camera = new osg::Camera;

// set the projection matrix
camera-setProjectionMatrix(osg::Matrix::ortho2D(0,1920,0,1200));

// set the view matrix
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setViewMatrix(osg::Matrix::identity());

// only clear the depth buffer
camera-setClearMask(0);

// draw subgraph after main camera view.
camera-setRenderOrder(osg::Camera::POST_RENDER);

//GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT;
camera-setDrawBuffer(GL_BACK);
camera-setReadBuffer(GL_BACK);


// we don't want the camera to grab event focus from the viewers main 
camera(s).
camera-setAllowEventFocus(false);


camera-setGraphicsContext(a_viewer-getCamera()-getGraphicsContext());
camera-setViewport(a_viewer-getCamera()-getViewport());

camera-addChild( createScreenQuad(1.0f, 1.0f) );

osg::Camera::BufferAttachmentMap map = 
a_viewer-getCamera()-getBufferAttachmentMap();
osg::Texture* input = map[osg::Camera::COLOR_BUFFER0]._texture.get();
camera-getOrCreateStateSet()-setTextureAttributeAndModes(0, input);

a_viewer-addSlave(camera, false);
[/code]

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


Re: [osg-users] Problem compiling VIrtualPlanetBuilder on OS X

2012-11-16 Thread Robert Osfield
Hi Tony,

Raising the problem on the mailing list is the appropriate place.  IF you
have a fix then just post it to osg-submissions where I can merge it.

Cheers,
Robert.

On 16 November 2012 12:47, Tony Vasile ming...@gmail.com wrote:

 I am trying to build VirtualPlanetBuilder against OpenSceneGraph 3.1.0 by
 using the trunk branch from the virtual planet builder svn repository on OS
 X Mountain Lion (10.8.2) and I am getting the following errors whilst
 compiling BuildOptionsIO.cpp:
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:508:42:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
 unsigned int size = 0; is  size  IS_BEGIN_BRACKET;
  ^~~~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
 note:
   expanded from macro 'IS_BEGIN_BRACKET'
 #define IS_BEGIN_BRACKETis.BEGIN_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:515:11:
 error:
   no member named 'END_BRACKET' in 'osgDB::InputStream'
 is  IS_END_BRACKET;
   ^~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
 note:
   expanded from macro 'IS_END_BRACKET'
 #define IS_END_BRACKET  is.END_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:523:19:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
 os  size  OS_BEGIN_BRACKET  std::endl;
   ^~~~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:34:36:
 note:
   expanded from macro 'OS_BEGIN_BRACKET'
 #define OS_BEGIN_BRACKETos.BEGIN_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:529:11:
 error:
   no member named 'END_BRACKET' in 'osgDB::OutputStream'
 os  OS_END_BRACKET  std::endl;
   ^~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:35:36:
 note:
   expanded from macro 'OS_END_BRACKET'
 #define OS_END_BRACKET  os.END_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:539:42:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
 unsigned int size = 0; is  size  IS_BEGIN_BRACKET;
  ^~~~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
 note:
   expanded from macro 'IS_BEGIN_BRACKET'
 #define IS_BEGIN_BRACKETis.BEGIN_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:545:11:
 error:
   no member named 'END_BRACKET' in 'osgDB::InputStream'
 is  IS_END_BRACKET;
   ^~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
 note:
   expanded from macro 'IS_END_BRACKET'
 #define IS_END_BRACKET  is.END_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:552:19:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
 os  size  OS_BEGIN_BRACKET  std::endl;
   ^~~~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:34:36:
 note:
   expanded from macro 'OS_BEGIN_BRACKET'
 #define OS_BEGIN_BRACKETos.BEGIN_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:558:11:
 error:
   no member named 'END_BRACKET' in 'osgDB::OutputStream'
 os  OS_END_BRACKET  std::endl;
   ^~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:35:36:
 note:
   expanded from macro 'OS_END_BRACKET'
 #define OS_END_BRACKET  os.END_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:571:11:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::InputStream'
 is  IS_BEGIN_BRACKET;
   ^~~~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:32:36:
 note:
   expanded from macro 'IS_BEGIN_BRACKET'
 #define IS_BEGIN_BRACKETis.BEGIN_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:577:11:
 error:
   no member named 'END_BRACKET' in 'osgDB::InputStream'
 is  IS_END_BRACKET;
   ^~
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:33:36:
 note:
   expanded from macro 'IS_END_BRACKET'
 #define IS_END_BRACKET  is.END_BRACKET
 ~~ ^
 /users/tony/source/VirtualPlanetBuilder/src/vpb/BuildOptionsIO.cpp:586:11:
 error:
   no member named 'BEGIN_BRACKET' in 'osgDB::OutputStream'
 os  OS_BEGIN_BRACKET  

Re: [osg-users] slave camera using rtt texture

2012-11-16 Thread Robert Osfield
Hi Daniel,

I'm rather lost with exactly what you want to do and the code you've used.
It's probably most productive to just point you in the direction of code
that probably does something similar to what you are after.  The
osgdistortion example is probably a good place to start - this renders the
main view to a texture, then renders a camera to the main window using the
texture rendering from the first camera.

Robert.

On 16 November 2012 14:57, Daniel Schmid daniel.sch...@swiss-simtec.chwrote:

  Hi all

 ** **

 I have a composite viewer, where the main camera renders to texture. No I
 added a slave camera (POST_RENDER that uses the same graphics context as
 the main camera). I had a screen quad child on which I would like to render
 the texture from the main camera. But all I get is a black screen.

 ** **

 Regards

 Daniel

 ** **

 [code]

 osg::Camera* camera = new osg::Camera;

 ** **

 // set the projection matrix

 camera-setProjectionMatrix(osg::Matrix::ortho2D(0,1920,0,1200));

 ** **

 // set the view matrix

 camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);

 camera-setViewMatrix(osg::Matrix::identity());

 ** **

 // only clear the depth buffer

 camera-setClearMask(0);

 ** **

 // draw subgraph after main camera view.

 camera-setRenderOrder(osg::Camera::POST_RENDER);

 ** **

 //GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT;

 camera-setDrawBuffer(GL_BACK);

 camera-setReadBuffer(GL_BACK);

 ** **

 ** **

 // we don't want the camera to grab event focus from the viewers main
 camera(s).

 camera-setAllowEventFocus(false);

 ** **

 ** **


 camera-setGraphicsContext(a_viewer-getCamera()-getGraphicsContext());**
 **

 camera-setViewport(a_viewer-getCamera()-getViewport());

 ** **

 camera-addChild( createScreenQuad(1.0f, 1.0f) );

 ** **

 osg::Camera::BufferAttachmentMap map =
 a_viewer-getCamera()-getBufferAttachmentMap();

 osg::Texture* input = map[osg::Camera::COLOR_BUFFER0]._texture.get();*
 ***

 camera-getOrCreateStateSet()-setTextureAttributeAndModes(0, input);*
 ***

 ** **

 a_viewer-addSlave(camera, false);

 [/code]

 ** **

 ___
 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] Cannot set custom shader for a node

2012-11-16 Thread Robert Osfield
Hi Michael,

It's probably a bit premature to use the OSG's shader composition work, you
could try and use but it's very much bleeding edge.  For non experimental
work I would recommend using the standard
osg::Program/osg::Shader/osg::Uniform functionality.  See the osgshader
example for inspiration.
Robert.

On 16 November 2012 13:42, michael kapelko korn...@gmail.com wrote:

 Hi.
 I'm using SoftShadowMap scene and I want to assign custom shader to one of
 the nodes, but it doesn't work.

 I do it like that:

 osg::ref_ptrosg::Shader frag = new osg::Shader(osg::Shader::FRAGMENT,
 code);
 osg::StateSet *ss = box-getOrCreateStateSet();
 osg::ShaderAttribute *sa = new osg::ShaderAttribute;
 sa-setType(osg::StateAttribute::FRAGMENTPROGRAM);
 ss-setAttribute(sa);
 sa-addShader(frag.get());

 The complete code is here: http://pastie.org/5387472

 As seen from the code, I tried to enable shader composition, but that
 didn't help me.

 Am I doing it wrong?

 ___
 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] LineSegmentIntersector gives incorrect results (intersections missing)

2012-11-16 Thread Peter Bako
Hello Robert.

I digged a bit into the OSG source code and I found out that its a precision 
problem. I use big models where the vertex coordinate values are 1000.
I don't know the exact process of the intersection search, but I assume that 
the lineSegment is clipped in the  

lineSegmentIntersector.cpp

Code:
bool LineSegmentIntersector::intersectAndClip(osg::Vec3d s, osg::Vec3d 
e,const osg::BoundingBox bbInput)

 
function to the values, where the lineSegment is slightly longer, than the 
bounding sphere of the geometry. 

Code:
 osg::Vec3d bb_min(bbInput._min);
osg::Vec3d bb_max(bbInput._max);

#if 1
double epsilon = 1e-4;
bb_min.x() -= epsilon;
bb_min.y() -= epsilon;
bb_min.z() -= epsilon;
bb_max.x() += epsilon;
bb_max.y() += epsilon;
bb_max.z() += epsilon;
#endif



There is an epsilon value, which is currently set to 1e-4. I would suggest to 
set it bigger (1e-2 f. ex.). If I change it to 1e-2, I don't get this problem 
anymore.

What is the exact reason of lineSegment clipping?

Thank you!

Cheers,
Peter
Code:




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





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


Re: [osg-users] Change uniform array size

2012-11-16 Thread Peterakos
Hello.

I try to create an algorithm which uses a configurable number of samples:
uniform vec3 sample_kernel[256];
When i use value higher than 502, i get some errors which probably
refer to my GPU (gtx 650).
It seems gl_MaxFragmentUniformComponents is 2048.

I try to use
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, value);
but i dont get the correct value.

In case I use a fixed size of samples and just pass as uniform the
number of samplesi  want to be checked, won't it affect the
performance ?
I mean having a large array of samples while i need the half.

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Are shaders not saved during osgDB::writeNodeFile?

2012-11-16 Thread michael kapelko
Hi.
I've attached custom shader for a node in a ShadowedScene. I then called
osgDB::writeNodeFile upon it and found out that it doesn't save those
shaders into osg file.
Is it so by design or am I doing it wrong?

PS:
Source code: http://pastie.org/5390724
Source code archive:
https://dl.dropbox.com/u/12634473/osg/shader_not_saved.tar.bz2
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Ideas about a resource system, and deferred rendering framework

2012-11-16 Thread michael kapelko
What's the progress on this? And is there any open repository?


2012/9/17 Jeremy Moles cubic...@gmail.com

 On Tue, 2012-09-11 at 10:54 +0800, Wang Rui wrote:
  Hi Jeremy,
 
  Thanks for the tests and feedback. I'm focusing on creating a material
  system which may be a little similar to the Ogre one but will be very
  easy to integrate with OSG scenes. I'd like to also have a benchmark
  including a complete deferred shading pipeline in the near future to
  show others how OSG produces realistic worlds. :-)
 
  Your requirement could be easiliy implemented with one forward pass
  rendering the scene to a texture, and two deferred passes doing the
  blur work with the texture as input. A final compositing pass will
  make use of the outputs of the blur passes and output to a new
  texture. You can get and use the new texture then in the scene for
  your own purpose instead of direct displaying them on screen. I'd like
  to upload a DOF effect file and an updated example some days later to
  demonstrate how these work.

 Hi Wang,

 Did you ever get a chance to work up an example showing something like
 this? I've been trying to get it to work using a modified blur-x/blur-y
 approach from osgPPU, but have had no success.

  Thanks,
 
  Wang Rui
 
  2012/9/11 Jeremy Moles cubic...@gmail.com:
   On Mon, 2012-09-10 at 22:57 +0800, Wang Rui wrote:
   This looks really cool so far. I'd be really interested to know if it
   supports the following (and would be willing to create examples if
   you're willing to help)...
  
   Scenario: I want to render an entire subgraph to an FBO texture once,
   then apply 2 or more completely different shaders in some order, then
   put the final result into a last texture to be used somewhere in the
   scene. I'm doing a guassian blur, which typically applies two different
   shaders for x and y.
  
   I have this working in osgPPU, but I think you already have enough to
 do
   it here, I just couldn't put the pieces together. :)
  
  ___
  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] Ideas about a resource system, and deferred rendering framework

2012-11-16 Thread Wang Rui
Hi Michael,

Current implementation is maintained in osgRecipes (
https://github.com/xarray/osgRecipes), and some snapshots are shared in the
mail-list a few days ago using both VDSM and the compositor.

Wang Rui




2012/11/17 michael kapelko korn...@gmail.com

 What's the progress on this? And is there any open repository?


 2012/9/17 Jeremy Moles cubic...@gmail.com

 On Tue, 2012-09-11 at 10:54 +0800, Wang Rui wrote:
  Hi Jeremy,
 
  Thanks for the tests and feedback. I'm focusing on creating a material
  system which may be a little similar to the Ogre one but will be very
  easy to integrate with OSG scenes. I'd like to also have a benchmark
  including a complete deferred shading pipeline in the near future to
  show others how OSG produces realistic worlds. :-)
 
  Your requirement could be easiliy implemented with one forward pass
  rendering the scene to a texture, and two deferred passes doing the
  blur work with the texture as input. A final compositing pass will
  make use of the outputs of the blur passes and output to a new
  texture. You can get and use the new texture then in the scene for
  your own purpose instead of direct displaying them on screen. I'd like
  to upload a DOF effect file and an updated example some days later to
  demonstrate how these work.

 Hi Wang,

 Did you ever get a chance to work up an example showing something like
 this? I've been trying to get it to work using a modified blur-x/blur-y
 approach from osgPPU, but have had no success.

  Thanks,
 
  Wang Rui
 
  2012/9/11 Jeremy Moles cubic...@gmail.com:
   On Mon, 2012-09-10 at 22:57 +0800, Wang Rui wrote:
   This looks really cool so far. I'd be really interested to know if it
   supports the following (and would be willing to create examples if
   you're willing to help)...
  
   Scenario: I want to render an entire subgraph to an FBO texture once,
   then apply 2 or more completely different shaders in some order, then
   put the final result into a last texture to be used somewhere in the
   scene. I'm doing a guassian blur, which typically applies two
 different
   shaders for x and y.
  
   I have this working in osgPPU, but I think you already have enough to
 do
   it here, I just couldn't put the pieces together. :)
  
  ___
  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] Why to use Shaders to render model in Android with OpenGLES2

2012-11-16 Thread Koduri Lakshmi
Hi,

I completed osgAndroid Example with GLES1 successfully. If I try to run the 
same example with OpenGLES2 then the OSG model is not rendering. If I add the 
following code then I am able to see the model on my device.


Code:
mtForMarker[idx]=new osg::MatrixTransform();
  
osg::Shader * vshader = new osg::Shader(osg::Shader::VERTEX, 
gVertexShader );
osg::Shader * fshader = new osg::Shader(osg::Shader::FRAGMENT, 
gFragmentShader );

osg::Program * prog = new osg::Program;
   prog-addShader ( vshader );
prog-addShader ( fshader );

mtForMarker[idx]-getOrCreateStateSet()-setAttribute ( prog );
  
mtForMarker[idx]-addChild(loadedModel[idx].get());
modelSwitch-addChild(mtForMarker[idx].get());


 osgViewer::Viewer::Windows windows;
_viewer-getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != 
windows.end();++itr)
{
  (*itr)-getState()-setUseModelViewAndProjectionUniforms(true);
  (*itr)-getState()-setUseVertexAttributeAliasing(true);
} 



This code I added from osgAndroidOpenGLES2 example.

As I am new to OSG I have two doubts

1) Why should I add the shaders in OpenGLES2 to display model.Can't I display 
the model with out this Shaders code. OpenGLES1 example doesn’t have this 
shaders.

2) If I add the shaders then the fixed functionalities like textures, lighting 
etc. were disabled. But I need to enable them because I got model from 3DS MAX. 
How can I enable fixed functionalities?

Can you please guide me how to enable fixed functionalities? If shaders are 
necessary to render model on Android with OpenGLES2 then how can I handle 
textures (or any others fixed functionalities) ? Is there any tutorial to 
handle this in Android? 

NOTE:- By mistake i posted the same under Build System category. 
... 

Thank you!

Cheers,
Koduri

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




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


Re: [osg-users] Why to use Shaders to render model in Android with OpenGLES2

2012-11-16 Thread Chris Hanson
 I completed osgAndroid Example with GLES1 successfully. If I try to run
 the same example with OpenGLES2 then the OSG model is not rendering. If I
 add the following code then I am able to see the model on my device.


  This is normal.


 1) Why should I add the shaders in OpenGLES2 to display model.Can't I
 display the model with out this Shaders code. OpenGLES1 example doesn’t
 have this shaders.


  No. OpenGL ES2 is not like regular OpenGL. ES2 does NOT have the fixed
functionality available that ES1 has. You can have shaders OR fixed
function, but not both.


 2) If I add the shaders then the fixed functionalities like textures,
 lighting etc. were disabled. But I need to enable them because I got model
 from 3DS MAX. How can I enable fixed functionalities?


  You can not. You need to write shaders that provide that same
functionality.


 Can you please guide me how to enable fixed functionalities? If shaders
 are necessary to render model on Android with OpenGLES2 then how can I
 handle textures (or any others fixed functionalities) ? Is there any
 tutorial to handle this in Android?


  One way to do this is to use a shader generator to create a shader to
implement some of the fixed function capability in a shader. OSG has a
ShaderGen tool, but it's somewhat out of date with regard to OpenGL ES2.
We've been using an updated version of it, but it's not in core OSG yet.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel https://twitter.com/alphapixel facebook.com/alphapixel
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org