Re: [osg-users] compositeview and offscreen rendering

2016-01-29 Thread Peiman Shakeri

robertosfield wrote:
> Hi Peinman,
> 
> Looking at your code the performance problems have little to do with
> OpenGL and the OSG and everything to with creating a new callback on
> every frame and writing to disk from the main thread,  File IO is very
> expensive so absolutely not something you want to do in main rendering
> thread.   The start/stop of threading and releaseContext() is rather
> odd too, I can't think what you are trying to achieve here.
> 
> What you should do is create a single callback that you can toggle
> on/off when needed and have it generate an image write operation that
> it dispatches to a back ground thread that does the writing to disk.
> Ideally you'd recycle the images once you've finished.
> 
> If this all sounds a bit involved, well what you are trying to do is
> reasonable advanced stuff, you are rather diving into the deep end
> without armbands having not learnt to swim yet...
> 
> Robert.
> 
> 
> 


hi Robert
thx for replying

1.without any writing to disk, frame rate is still down.my 
WindowCaptureCallback write nothing into disk.
2.The start/stop of threading and releaseContext() is necessary for multi 
threading model because of off-screen rendering on topview.
3.please more explain about that single callback and the way on/off it.

cheers peiman

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





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


Re: [osg-users] [ANN] View-dependent progressive meshes on OpenSceneGraph

2016-01-29 Thread Jim Tan
Screenshot is here: http://jimtan0805.blogspot.tw/2016/01/lod-with-vdpm.html

Video is here: https://youtu.be/3anybmyYP10

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





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


Re: [osg-users] StatsHandler missing numbers

2016-01-29 Thread Daniel Emminizer

aroth wrote:
> 
> I'm quite interested if this issue also occurs on a different OS. Let's see 
> if the OS world is different with this great new Windows 10 ;-)
> 


I've been lurking on this thread for a while.  I know it's old, but I finally 
got some time to track it down.  I've seen the exact same problems on my Intel 
4600 on Windows 10.  We've seen the problem on pretty much every Intel 4000+ 
card tested on every version of Windows for the last couple of years.  Most of 
our Linux machines with Intel also have Optimus, and we disable the Intel side 
through BIOS, so I don't have any useful Linux input.

I finally tracked down a fix, and I think it suggests a bug in the Intel 
drivers.  The problem appears to be due to issues with the textures that are 
loaded from glTexSubImage2D in Glyph.cpp.  The following patch worked well for 
us and fixed the disappearing text glyphs problem on Intel.  It works by 
reapplying the texture min filter right before the glTexSubImage2D().

Without this, depending on the size of the font, glyphs that are loaded after 
the initial set will show up either grey, or completely transparent.  NVidia 
drivers do not suffer the same problem.

I've tested on Intel 4600 and NVidia K2100m.  I've also tested the state values 
with glGetTexParameteriv(), and it appears correct prior to this code.  That 
implies to me that this is a driver bug, but I don't have enough experience to 
say for certain.  If it is a driver bug, it's been outstanding for at least a 
year, if not several years.

I could not find a way to fix this in our own code without modifying OSG code.  
I hope someone finds this useful.  I realize it is a bit of a hack.

Thanks,

 - Dan

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




Attachments: 
http://forum.openscenegraph.org//files/patchsrcosgtextglyph_159.cpp


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


[osg-users] osgjs fix for 64 builds with some compilers

2016-01-29 Thread Trajce Nikolov NICK
Hi Robert,

attached is small fix for 64 builds with some compilers. It is from the
3.5.1 dev release. Is there a chance to integrate this fix into the
mentioned version?

Was tested with MSVC and g++

-- 
trajce nikolov nick
#include "WriteVisitor"
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include "Base64"

#if defined(_M_X64) || defined(__amd64__)
	#define BUILD_64BIT 1
#endif




osg::Array* getTangentSpaceArray(osg::Geometry& geometry) {
for(unsigned int i = 0 ; i < geometry.getNumVertexAttribArrays() ; ++ i) {
osg::Array* attribute = geometry.getVertexAttribArray(i);
bool isTangentArray = false;
if(attribute && attribute->getUserValue("tangent", isTangentArray) && isTangentArray) {
return attribute;
}
}
return 0;
}

void translateObject(JSONObject* json, osg::Object* osg)
{
if (!osg->getName().empty()) {
json->getMaps()["Name"] = new JSONValue(osg->getName());
}

osgSim::ShapeAttributeList* osgSim_userdata = dynamic_cast(osg->getUserData());
if (osgSim_userdata) {
JSONObject* jsonUDC = new JSONObject();
jsonUDC->addUniqueID();

JSONArray* jsonUDCArray = new JSONArray();
jsonUDC->getMaps()["Values"] = jsonUDCArray;
for (unsigned int i = 0; i < osgSim_userdata->size(); i++) {
const osgSim::ShapeAttribute& attr = (*osgSim_userdata)[i];
JSONObject* jsonEntry = new JSONObject();
jsonEntry->getMaps()["Name"] = new JSONValue(attr.getName());
osg::ref_ptr > value;
switch(attr.getType()) {
case osgSim::ShapeAttribute::INTEGER:
{
std::stringstream ss;
ss << attr.getInt();
value = new JSONValue(ss.str());
}
break;
case osgSim::ShapeAttribute::DOUBLE:
{
std::stringstream ss;
ss << attr.getDouble();
value = new JSONValue(ss.str());
}
break;
case osgSim::ShapeAttribute::STRING:
{
std::stringstream ss;
ss << attr.getString();
value = new JSONValue(ss.str());
}
break;
case osgSim::ShapeAttribute::UNKNOWN:
default:
break;
}
jsonEntry->getMaps()["Value"] = value;
jsonUDCArray->getArray().push_back(jsonEntry);
}
json->getMaps()["UserDataContainer"] = jsonUDC;

} else if (osg->getUserDataContainer()) {
JSONObject* jsonUDC = new JSONObject();
jsonUDC->addUniqueID();

if (!osg->getUserDataContainer()->getName().empty()) {
jsonUDC->getMaps()["Name"] = new JSONValue(osg->getUserDataContainer()->getName());
}
JSONArray* jsonUDCArray = new JSONArray();
jsonUDC->getMaps()["Values"] = jsonUDCArray;
for (unsigned int i = 0; i < osg->getUserDataContainer()->getNumUserObjects(); i++) {
osg::Object* o = osg->getUserDataContainer()->getUserObject(i);
std::string name, value;
getStringifiedUserValue(o, name, value);
if(!name.empty() && !value.empty())
{
JSONObject* jsonEntry = new JSONObject();
jsonEntry->getMaps()["Name"] = new JSONValue(name);
jsonEntry->getMaps()["Value"] = new JSONValue(value);
jsonUDCArray->getArray().push_back(jsonEntry);
}

}
json->getMaps()["UserDataContainer"] = jsonUDC;
}
}


void getStringifiedUserValue(osg::Object* o, std::string& name, std::string& value) {
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
if(getStringifiedUserValue(o, name, value)) return;
}


template
bool getStringifiedUserValue(osg::Object* o, std::string& name, std::string& value) {
osg::TemplateValueObject* vo = dynamic_cast< osg::TemplateValueObject* >(o);
if (vo) {
std::ostringstream oss;
oss << vo->getValue();
name = vo->getName();
value = oss.str();
return true;
}
return false;
}


static JSONValue* getBlendFuncMode(GLenum mode) {
switch (mode) {
case osg::BlendFunc::DST_ALPHA: return new JSONValue("DST_ALPHA");
case osg::BlendFunc::DST_COLOR: return new JSONValue("DST_COLOR");
case osg::BlendFunc::ONE: return new JSONValue("ONE");
case osg::BlendFunc::ONE_MINUS_DST_ALPHA: return new JSONValue("ONE_MINUS_DST_ALPHA");