Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesomium 1.7RC2: BitmapBuffer::CopyTo failing?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 CirdanValen   Members   -  Reputation: 185

Like
0Likes
Like

Posted 14 August 2012 - 10:11 PM

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.

Edited by CirdanValen, 14 August 2012 - 10:51 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS