Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effective way to erase painting? #37

Open
linuxaged opened this issue Dec 8, 2018 · 0 comments
Open

Effective way to erase painting? #37

linuxaged opened this issue Dec 8, 2018 · 0 comments

Comments

@linuxaged
Copy link

linuxaged commented Dec 8, 2018

I'm trying to implement a eraser, clear subregion of the texture.

PageCanvas is child of QNanoQuickItem and render with QQuickFramebufferObject, what i do is binding the texture then glTexSubImage2D. But it crashs. So where is the right place(QNanoQuickItemPainter?) to do this operation, or i'm using the texture in a wrong way.

void PageCanvas::erase(int x, int y)
{
    textureProvider()->texture()->bind();
    const int eraserSize = 16;
    quint32 subImage[eraserSize * eraserSize] = {};
    glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, eraserSize, eraserSize, GL_RGBA, GL_UNSIGNED_BYTE, subImage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant