Advertisement

Awesomium 1.7RC2: BitmapBuffer::CopyTo failing?

Started by August 15, 2012 04:11 AM
-1 comments, last by CirdanValen 12 years, 3 months ago
EDIT: Sovled the problem. Needed to enable texturing -.-

Hey guys, I'm trying to see if I can get Awesomium working and have run into a problem.

In my loop, I have this block of code. "view" is an Awesomium WebView


if(view->IsLoading()) {
awesomiumCore->Update();
Sleep(10);
std::cout << "Loading..." << std::endl;
} else {

const Awesomium::BitmapSurface *bitmap = static_cast<const Awesomium::BitmapSurface*>(view->surface());

if(bitmap->is_dirty()) {
awesomiumCore->Update();
std::cout << "Done loading." << std::endl;
saved = true;


if(bitmap == NULL) {
std::cout << "Failed to render page." << std::endl;
} else {
bitmap->SaveToPNG(Awesomium::WebString::CreateFromUTF8("google.png", strlen("google.png")), false);

glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

bitmap->CopyTo(buffer, 1024*4, 4, true, false);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 768, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer);

}
}

}


This code works fine, and the PNG that get's saved is the expected output. However, it seems that when I copy to the buffer, the resulting buffer is empty. I'm trying to render the web page out to OpenGL, but all I'm getting is a white quad.

This topic is closed to new replies.

Advertisement