So far it is working great, but I am having issues getting my "resize view" code to work. Basically I have a webpage with a button that invokes a method to resize the texture, internal image buffer, and Berkelium's render window.
For whatever reason, I get this error with OpenGL:
Code: Select all
GL_INVALID_OPERATION
Could not glTexImage2D
Which I have narrowed down to coming from the error check in COpenGLTexture.cpp on line 351 when I call ITexture::unlock()
Here is the constructor for my PageRenderer class along with the function that (re)creates the texture/image.
Code: Select all
// Page Render Class
PageRenderer::PageRenderer(irr::core::dimension2du size,bool transparent) : size(size), texture(0), image(0)
{
ares->log("Creating Berkelium page renderer");
webView = Berkelium::Window::create();
assert(webView);
webView->setDelegate(this);
webView->setTransparent(transparent);
createTexture(size);
}
//Create the image+texture also update webwindow size.
void PageRenderer::createTexture(irr::core::dimension2du newSize)
{
//irr::core::dimension2du oldSize = size;
size = newSize;
if (texture) {ares->getDriver()->removeTexture(texture);}
if (image) {image->drop();}
image = ares->getDriver()->createImage(irr::video::ECF_A8R8G8B8,size);
texture = ares->getDriver()->addTexture(L"internalwebrender",image);
webView->resize(size.Width,size.Height);
}
Code: Select all
char* imagebuffer;
//[...]
//Full render (It happens during partial render too, but I left that out to be brief
imagebuffer = (char*)image->lock();
ares->log("Full render locked.");
memcpy(imagebuffer,sourceBuffer,size.Width*size.Height*(image->getBitsPerPixel()/8));
ares->log("Full render complete.");
//[...]
void* texbuffer = texture->lock(false,0);
memcpy(texbuffer,imagebuffer,size.Width*size.Height*(image->getBytesPerPixel()));
//Also tried memcpy(texbuffer,imagebuffer,image->getImageDataSizeInBytes()); to no avail.
texture->unlock();//This line is when the error appears
image->unlock();
I'd also like to point out my memcpy throws an exception in the software renderers for some reason 0.o Also, the issue happens on both my Intel GMA laptop and ATI Radeon HD4890 desktop.
BTW> I can put the whole source for the renderer and GUI class up if you think it'd help. I plan to release them eventually once the system is done.
Oh! Almost forgot, if I remove the line "if (texture) {ares->getDriver()->removeTexture(texture);}" the error stops, but this obviously causes a huge memory leak. I should also point out that I am using NPOT textures right now.
~David