OpenSceneGraph Emissive Lighting - opengl

I have a rather large mesh, (which I load with osgDB). It also has several sub-meshes.
I am trying to set the emission lighting. However I can see (suspect) that only the 1st sub-mesh is lit up. How is it possible to light up all the sub-meshes.
I am not using lighting to lit up the scene.
What is the recommended approach?
int main()
{
osg::Node * cytBuilding = osgDB::readNodeFile( OBJ_FILE );
osg::Group * root = new osg::Group();
osg::PositionAttitudeTransform * scenePAT = new osg::PositionAttitudeTransform();
root->addChild(scenePAT);
scenePAT->addChild( cytBuilding );
//material
osg::Material* material = new osg::Material();
material->setAmbient(osg::Material::FRONT, osg::Vec4(1.0,1.0f,1.0f,1.0f));
material->setDiffuse(osg::Material::FRONT, osg::Vec4(1.0,1.0f,1.0f,1.0f));
material->setSpecular(osg::Material::FRONT, osg::Vec4(0.0,0.0f,0.0f,1.0f));
material->setEmission(osg::Material::FRONT, osg::Vec4(1.0,1.0f,1.0f,1.0f));
osg::StateSet* stateset = new osg::StateSet();
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
root->setStateSet(stateset);
// viewer
osgViewer::Viewer viewer;
viewer.setSceneData( root );
viewer.realize();
return viewer.run();
As I read the mesh (osgDB::readNodeFile()), it display following error messages
*** line not handled *** :map_bump
*** line not handled *** :bump
*** line not handled *** :map_opacity
*** line not handled *** :map_d
*** line not handled *** :refl
*** line not handled *** :map_kS
*** line not handled *** :map_Ns
Resulting display was:
Same mesh when I display with meshlab, I see

This largely depends on how the StateSets within the model are organized.
Could you try to enforce lighting on your root node?
stateset->setMode( GL_LIGHTING, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );
You could also try to implement a small visitor to dump all Materials and StateSets within the model to see how they are assigned, maybe its overridden per node with a OVERRIDE|PROTECTED flag.
Just for testing, did you try to apply your Material to all Geodes or Geometries within the model?

Related

Can not access data from given OIDs using net-snmp

i implemented the simple net-snmp simple application into my project. when i tried to use the example OID given at the site: .1.3.6.1.2.1.1.1.0 it worked just fine.
now i need to get data from these oids: https://www.sysadmin.md/snmp-most-useful-linux-oids.html. when i tried to implement these oids into my code i got error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV).
the simple application code:
add_mibdir(".");
pdu = snmp_pdu_create(SNMP_MSG_GET);//creating a get pdu
if(read_objid(".1.3.6.1.4.1.2021.11.9", id_oid, &id_len)==1)//specifying the oid we want to receive
cout<<"oid read"<<endl;
else
cout<<"couldnt read oid"<<endl;
snmp_add_null_var(pdu, id_oid, id_len);//making room for the response
status = snmp_synch_response(session_handle, pdu, &response);//getting the response
cout<<"status: "<<status<<endl;
string ReturnBuffer;
cout<<"vars: "<<vars->val.string<<endl;
for(vars = response->variables; vars; vars = vars->next_variable)//printing the values we got back
{
cout<<vars->val.string<<endl;
ReturnBuffer.append(reinterpret_cast<char*>(vars->val.string));
}
ReturnBuffer.append("\0"); //test
return ReturnBuffer;
according to the code the oid itself is read and the status of the response is 0 and yet im not getting any of the data and got the error above, i'd appreciate any help thanks in advance.
language: c++
os: linux(ubuntu)

G4GDMLParser Evaluator : syntax error C++

I am trying to read a GDML file with G4GDMLParser:
...
G4GDMLParser parser;
parser.Read(G4Str_Filename, fValidate);
But it gives an error:
...
G4GDML: Reading materials...
G4GDML: Reading solids...
Evaluator : syntax error
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : InvalidExpression
issued by : G4GDMLEvaluator::Evaluate()
Error in expression: 40.0
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment
-------- EEEE -------- G4Exception-END --------- EEEE -------
*** G4Exception: Aborting execution ***
Signal: SIGABRT (Aborted)
I tried putting GDML file next to the executable but it didnt help.
I found it problem is My locale TR uses " , "not " . " for floats just set your locale somewhere in your code;
std::setlocale(LC_ALL, "en_US.UTF-8");
std::setlocale(LC_NUMERIC, "en_US.UTF-8");

Error in Caffe when classifying image using classification.cpp

I have trained my own network. The training was fine. I have also used 'caffe time' and it estimates time for forward and backward pass normally. However when I run this: (Using this ref)
./build/examples/cpp_classification/classification.bin models/own_net/deploy.prototxt examples/RSR_50k_all_1k_db/snapshot_iter_10000.caffemodel examples/RSR_50k_all_1k_db/mean.binaryproto examples/RSR_50k_all_1k_db/labels.txt /home/ubuntu/datasets/RSR_50k_1ll_1k/Testing/[0]/outfile243.jpg
This generates an error:
F0426 10:10:50.063822 2714 classification.cpp:63] Check failed: net_->num_outputs() == 1 (2 vs. 1) Network should have exactly one output.
*** Check failure stack trace: ***
# 0xf6c5d060 (unknown)
# 0xf6c5cf5c (unknown)
# 0xf6c5cb78 (unknown)
# 0xf6c5ef98 (unknown)
# 0xd10c Classifier::Classifier()
# 0xb0a2 main
# 0xf672c632 (unknown)
Aborted
When I use the same command to classify the stock cat image using caffenet, it works just fine. I suspect there is a problem with label file. My label file only lists all the labels, one in each line. Any idea what I am doing wrong?
unfortunately, the net is not mine so I don't think I am allowed to share the full structure. However, it has some conv, relu, and fc layers and ends with this layer:
layer {
name: "prob"
type: "Softmax"
bottom: "ip3"
top: "prob"
}
which I suspect might be the culprit.

Cocos2d crash on iOS9 simulator

2015-10-26 21:30:19.093 QP[4494:55623] 39:
OpenGL error GL_INVALID_VALUE detected at -[CCGraphicsBufferGLUnsynchronized setup] 121
2015-10-26 21:30:19.096 QP[4494:55623] *** Assertion failure in -[CCRenderStateGL initWithBlendMode:shader:shaderUniforms:copyUniforms:], /Users/quantum/code/fuck/quantumpilot/qp/Source/libs/cocos2d-iphone/cocos2d/CCRendererBasicTypes.m:313
2015-10-26 21:30:19.139 QP[4494:55623] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCRenderState: Shader is nil'
Why is this happening? Works fine on my 8.4.1 device. Will test on 9.1 device.
EDIT
From http://forum.cocos2d-objc.org/t/xcode-7-ios9-beta/17346/20
added to static NSString *CCShaderHeader in CCShader.m
#"#ifdef GL_ES\n"
#"#ifdef GL_OES_standard_derivatives\n"
#"#extension GL_OES_standard_derivatives : enable\n"
#"#endif\n"
#"#endif\n"
removed from CCDrawNode.m
#"#ifdef GL_ES\n"
#"#extension GL_OES_standard_derivatives : enable\n"
#"#endif\n"
#"\n"
fixes it. Arcane.

Popup in BlackBerry 10

How do I show a popup in Blackberry 10? I want to show popup when any contact is added /deleted/updated. I took one method like this---
void ContactEditor::showToast(QString text) {
bb::system::SystemToast toast;
toast.setBody(text);
toast.setPosition(bb::system::SystemUiPosition::MiddleCenter);
toast.exec();
}
and called like this---
showToast("contact added...");
included file for System Toast also.
but this is giving me error----
make[2]: *** [o-g/addressbook] Error 1
make[1]: *** [debug] Error 2
make: *** [Simulator-Debug] Error 2
can somebody tell me whats the problem ?
Add LIBS += -lbbsystem to your application pro file. and include
#include <bb/system/SystemToast>
SystemToast *toast = new SystemToast(this);
toast->setBody("Your Toast");
toast->setPosition(SystemUiPosition::MiddleCenter);
toast->show();