well the callback (actually) is like this :
Code: Select all
Ogre::OverlayContainer* container[50];
Ogre::TextAreaOverlayElement* displayElement[50];
Ogre::Overlay* pin_overlay;
void CALLBACK VPinmame::OnDisplayAvailable(int index, int displayCount, PinmameDisplayLayout* p_displayLayout) {
Ogre::OverlayManager* overm=Ogre::OverlayManager::getSingletonPtr();
if(!overm) std::cout<<"ERROR !!!!!"<<std::endl;
if(overm->hasOverlayElement("GUI")) std::cout<<"OK !!"<<std::endl;
container[index] = static_cast<Ogre::OverlayContainer*>(overm->createOverlayElement("Panel", "GUI"+std::to_string(index)));
container[index]->setPosition(0,0+(index*50));
container[index]->setDimensions(400,100);
container[index]->setMetricsMode(Ogre::GMM_PIXELS);
displayElement[index] = static_cast<Ogre::TextAreaOverlayElement*>(overm->createOverlayElement("TextArea", "TextAreaName"+std::to_string(index)));
displayElement[index]->setMetricsMode(Ogre::GMM_PIXELS);
displayElement[index]->setDimensions(0,0);
displayElement[index]->setPosition(0,0+(index*50));
displayElement[index]->setFontName("DejaVu",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
displayElement[index]->setParameter("horz_align", "left");
displayElement[index]->setParameter("vert_align", "top");
displayElement[index]->setParameter("char_height", "42");
displayElement[index]->setColour(Ogre::ColourValue(0.0f,1.0f,0.0f, 0.5f));
displayElement[index]->setCaption(Ogre::String("Hello World!"+std::to_string(index)));
container[index]->addChild(displayElement[index]);
pin_overlay->add2D(container[index]);
pin_overlay->show();
}
the error come from the show() function.
in the 'main' function i have this :
Code: Select all
[...]
Ogre::OverlaySystem* ovsys = new Ogre::OverlaySystem();
this->m_backscn_mgr->addRenderQueueListener(ovsys);
Ogre::FontManager &fontMgr = Ogre::FontManager::getSingleton();
Ogre::ResourcePtr p_font= fontMgr.create("DejaVu", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
p_font->setParameter("type", "truetype");
p_font->setParameter("source", "DejaVuSans.ttf");
p_font->setParameter("size", "26");
p_font->setParameter("resolution", "96");
p_font->load();
if(!p_font->isLoaded())
std::cout << "ERROR : FONT LOAD ERROR" << std::endl;
std::cout << "FONT LOADED " << p_font->getName() <<std::endl;
Ogre::OverlayManager& overm = Ogre::OverlayManager::getSingleton();
Ogre::Overlay* p_overlay= overm.create("Backglassover");
Ogre::OverlayContainer* p_container = static_cast<Ogre::OverlayContainer*>(overm.createOverlayElement("Panel", "GUI"));
p_container->setPosition(0,0);
p_container->setDimensions(400,100);
p_container->setMetricsMode(Ogre::GMM_PIXELS);
Ogre::TextAreaOverlayElement* p_text = static_cast<Ogre::TextAreaOverlayElement*>(overm.createOverlayElement("TextArea", "TextAreaName"));
p_text->setMetricsMode(Ogre::GMM_PIXELS);
p_text->setDimensions(0, 0);
p_text->setPosition(0,0);
p_text->setFontName(p_font->getName(),Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
p_text->setParameter("horz_align", "left");
p_text->setParameter("vert_align", "top");
p_text->setParameter("char_height", "26");
p_text->setColour(Ogre::ColourValue(0.0f,1.0f,0.0f, 0.5f));
p_text->setCaption(Ogre::String("Hello World!"));
p_container->addChild(p_text);
p_overlay->add2D(p_container);
p_overlay->show();
[...]
In the main function all is ok, window is show with the overlay text and the main function is execute before the callback creation (if i comment the call to show() function in the callback function).
the error as i see is a call to glGenBuffersARB() in ogre part....so for me there is something that in the thread that opengl is not know or setup
valgrind debug tell me this :
Code: Select all
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
Texture 'DejaVuTexture': Loading 1 faces(PF_BYTE_LA,512x512x1) Internal format is PF_BYTE_LA,512x512x1.
FONT LOADED DejaVu
I/O warning : failed to load external entity "../../src/files/Nudge Test and Calibration.directB2S"
ERROR: can't load ../../src/files/Nudge Test and Calibration.directB2S associate file
Backglass render
PINMAME: name=hh, description=Haunted House (rev. 2), manufacturer=Gottlieb, year=1982, flags=0, found=1
PINMAME: ok
osd_display_loading_rom_message(): loading u2_80.bin ...
osd_display_loading_rom_message(): loading u3_80.bin ...
osd_display_loading_rom_message(): loading 669-2.cpu ...
osd_display_loading_rom_message(): loading 669-s1.snd ...
osd_display_loading_rom_message(): loading 669-s2.snd ...
osd_display_loading_rom_message():
osd_create_display: 60.00 fps
OnAudioAvailable(): channels=1, sampleRate=44100.00, framesPerSecond=60.00, samplesPerFrame=735, bufferSize=16384
PULSE init...
OnStateUpdated(): state=1
OnMechAvailable: mechNo=0, type=5, length=240, steps=240, pos=0, speed=0
OnDisplayAvailable(): index=0, displayCount=9, type=3, top=0, left=0, width=0, height=0, depth=0, length=6
OK !!
==35589== Thread 12:
==35589== Conditional jump or move depends on uninitialised value(s)
==35589== at 0xC978AF3: Ogre::GLHardwareVertexBuffer::GLHardwareVertexBuffer(Ogre::HardwareBufferManagerBase*, unsigned long, unsigned long, int, bool) (in /usr/lib/x86_64-linux-gnu/OGRE/RenderSystem_GL.so.1.12.10)
==35589== by 0xC9738C8: Ogre::GLHardwareBufferManager::createVertexBuffer(unsigned long, unsigned long, int, bool) (in /usr/lib/x86_64-linux-gnu/OGRE/RenderSystem_GL.so.1.12.10)
==35589== by 0x490346F: Ogre::PanelOverlayElement::_restoreManualHardwareResources() (in /usr/lib/x86_64-linux-gnu/libOgreOverlay.so.1.12.10)
==35589== by 0x48F23F9: Ogre::Overlay::show() (in /usr/lib/x86_64-linux-gnu/libOgreOverlay.so.1.12.10)
==35589== by 0x52C9567: libpinmame_update_display (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x521BDB3: updateDisplay (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x521BE32: video_update_core_gen (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x516354E: force_partial_update (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x5163589: draw_screen (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x51638D4: updatescreen (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x50E7336: cpu_vblankcallback (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x50E6FDD: cpu_firstvblankcallback (in /usr/local/lib/libpinmame.so.3.5)
==35589==
terminate called after throwing an instance of 'Ogre::InternalErrorException'
what(): InternalErrorException: Cannot create GL vertex buffer in GLHardwareVertexBuffer::GLHardwareVertexBuffer at ./RenderSystems/GL/src/OgreGLHardwareVertexBuffer.cpp (line 46)
==35589==
==35589== Process terminating with default action of signal 6 (SIGABRT)
==35589== at 0x812DCE1: raise (raise.c:51)
==35589== by 0x8117536: abort (abort.c:79)
==35589== by 0x7E5F7EB: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==35589== by 0x7E6A965: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==35589== by 0x7E6A9D0: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==35589== by 0x7E6AC64: __cxa_throw (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==35589== by 0xC93FAD6: ??? (in /usr/lib/x86_64-linux-gnu/OGRE/RenderSystem_GL.so.1.12.10)
==35589== by 0xC9738C8: Ogre::GLHardwareBufferManager::createVertexBuffer(unsigned long, unsigned long, int, bool) (in /usr/lib/x86_64-linux-gnu/OGRE/RenderSystem_GL.so.1.12.10)
==35589== by 0x490346F: Ogre::PanelOverlayElement::_restoreManualHardwareResources() (in /usr/lib/x86_64-linux-gnu/libOgreOverlay.so.1.12.10)
==35589== by 0x48F23F9: Ogre::Overlay::show() (in /usr/lib/x86_64-linux-gnu/libOgreOverlay.so.1.12.10)
==35589== by 0x52C9567: libpinmame_update_display (in /usr/local/lib/libpinmame.so.3.5)
==35589== by 0x521BDB3: updateDisplay (in /usr/local/lib/libpinmame.so.3.5)
so for now i don't know where to look for...