• Advertisement
Sign in to follow this  

Awesomium and OSG - cannot render to a geode

This topic is 2063 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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->setRenderBinDetails(11, "RenderBin");

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

image->setImage(800,600,1,4,[b]GL_BGRA[/b], GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE, 1);


//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:

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

Couple things I know for sure:[list]
[*]AwesomuimUI's render buffer is not empty because [b]awe_renderbuffer_save_to_png[/b] 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,

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? Edited by Gasim

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement