Awesomium and OSG - cannot render to a geode

Started by
-1 comments, last by Kasya 11 years, 10 months ago
Hello,
I have been trying to integrate awesomium UI to OSG. What I am trying to do is to create a HUD overlay and then design the whole UI in html. Here is the code. Ill explain the unclear stuff in the comments:



void GraphicsSystem::createHUD() {
//geometry of hudGeode, projectionMatrix etc. here. Details are not relevant for my problem.
osg::StateSet * ss = new osg::StateSet;
ss->setTextureAttributeAndModes(0, hudTexture, osg::StateAttribute::ON);
ss->setMode(GL_BLEND, osg::StateAttribute::ON);
ss->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
ss->setRenderBinDetails(11, "RenderBin");
hudGeode->setStateSet(ss);
}


void GraphicsSystem::renderHUD(unsigned char * data) {

image->setImage(800,600,1,4,GL_BGRA, GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE, 1);
hudTexture->setImage(image);

}

//hudTexture and image are members of the class GraphicsSystem


and here is the awesomium update view function:


void AwesomiumUI::updateView() {
const awe_renderbuffer * rbuffer = awe_webview_render(view);
awe_renderbuffer_save_to_png(rbuffer, str2awe("test.png"), false);
const unsigned char * buffer = awe_renderbuffer_get_buffer(rbuffer);
Base::sys()->sendEvent(new Event1<const unsigned char*>("renderHUD", buffer));
}


When I run it I get the following error:


Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)[/quote]

Couple things I know for sure:

  • AwesomuimUI's render buffer is not empty because awe_renderbuffer_save_to_png is saving a file test.png correctly
  • The StateSet does not have any issues because I have created a trigger to change the texture dynamically and it worked.
  • The problem is maybe in the image->setImage(...). Maybe the formattings of render buffers in Awesomium and OSG are different. I am still looking it up.

If anyone can help me, I would really appreciate it.

Thanks in advance,
Gasim

EDIT: I have fixed the issue. The problem was I was not using the right texture type. Awesomium is using GL_BGRA. I have bolded it in the code above. But I still need help. The texture is flipped vertically. How can I flip it back using osg?

This topic is closed to new replies.

Advertisement