Hi and good day!
Preface (scroll down for my problem):
I'm developing an App based on OSG 3.0 for Android and i'm having a problem
with translucent backgrounds and models.
please bear with me if it's a stupid question. i'll try to explain my problem
in detail and not too confusing.
the source code i'm basing this on is from the osgAndroidExampleGLES1
(http://forum.openscenegraph.org/viewtopic.php?t=10076).
i've already changed a lot of things. it's an augmented reality app, meaning
that i'll stream from the camera to a GLSurfaceView and have the EGLview
overlayed on this surfaceview. so far so good. to see the stream from the
camera i obviously need to make the background from the osg part translucent.
to do so, i changed the EGLview.java to initialize the context with
"translucent = true": (from EGLview.java, line 59)
Code:
public EGLview(Context context, AttributeSet attrs) {
super(context,attrs);
// we need to initialize it with translucent = true.
init(true, 16, 8);
Log.d(TAG, "EGLview(Context, AttributeSet) called");
}
this will make the whole background translucent, which is what i want. to
actually see the background i followed the advice i got from this thread
http://forum.openscenegraph.org/viewtopic.php?t=9472
and in the OsgMainApp.cpp i added this line in the function
OsgMainApp::initOsgWindow(x, y, width, height):
Code:
_viewer->getCamera()->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f));
which set the backgroundcolor to black with alpha = 0.
again, this is what i want, but it's not an option for me to stream the video
into the osg.
when i load a model and turn off the camera (as in the GLSurfaceView with the
videostream is removed) it looks like this (and this is how it should look
like):
(click the screenshots to go to bigger versions with higher quality)
[Image: http://i.imgur.com/wRpbxl.jpg ] (http://i.imgur.com/wRpbx.jpg)
now here comes my problem:
when i turn on the camera the color of the model is lost whenever the camera is
showing something of a light color. like this:
[Image: http://i.imgur.com/BnukZl.jpg ] (http://i.imgur.com/BnukZ.jpg)
in the following screenshot i tried to cover half of the camera with a book:
[Image: http://i.imgur.com/ebF9Pl.jpg ] (http://i.imgur.com/ebF9P.jpg)
now i'm honestly desperate to find a solution to this, but everything i've
tried so far didn't yield the desired results. has anyone come across a similar
problem or maybe even a solution on this? could it be an error in the model i'm
using? i thank everyone who took the time reading through this.
some more information on the model i used:
Code:
Geode {
name "siemens1_aligned_geo.ply"
nodeMask 0xffffffff
cullingActive TRUE
num_drawables 1
Geometry {
DataVariance STATIC
useDisplayList TRUE
useVertexBufferObjects TRUE
PrimitiveSets 1
{
DrawArrays POINTS 0 1317508
}
VertexArray Vec3Array 1317508
{
93.6877 -51.5449 20.8001
//... more data
}
NormalBinding PER_VERTEX
NormalArray Vec3Array 1317508
{
0.998192 -0.053112 0.0281376
// ... again, more data
}
ColorBinding PER_VERTEX
ColorArray Vec4Array 1317508
{
0.363281 0.363281 0.359375 0
// ... yes, more data
}
Thank you in advance for the smallest hint!
Cheers,
Bernd[/i]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49550#49550
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org