Hi all,
I’m creating a semi transparent 2D overlay that needs to update quickly (moving windows and so on) and it worked fine until I tried it at FullHD resolution (putting fullscreen in my game for fun). Some comments would be great because I’m all out of ideas.
What I currently do is:
If an interface component has moved
Clear a buffered image the same size as the window (using fillrect, so slow!)
Draw the interface components onto the buffered image
Tell the OpenGL thread that the overlay has changed
The OpenGL thread then picks up the buffered image and makes it into a texture (binding the already existing texture but calling glTexImage2D again)
Every loop (no matter if the texture has changed or not)
The OpenGL thread marks parts of the texture to be drawn (where there is a component)
Moves over to a 2D viewpoint
Draws triangles of each marked part using the texture created
The last part (what happens every loop) is really fast no matter the resolution, but the first two parts are really really slow when I’m handling a texture of 20482048, which I guess makes sense… it works really great up to 1024512 though.
What is the best practice around this and how have other people solved it? Handle one BufferedImage/texture per element/window (they are mostly quite small and quite static, the problem is the movement which would be solved then as that’s only the triangles moving)? Update the texture using glTexSubImage2D?
Kind regards,
Mike
