sub_o
sub_o

Reputation: 2802

How to match texture size with window size?

I am trying to draw pixels on a given texture, when I move my mouse around. Something similar to drawing program, but with layers.

How do I expand my texture so that its dimension matches my window size (e.g. 1280 x 1080), this is mainly because I'd like to click anywhere on the window, and it will update the pixel.

Upvotes: 0

Views: 184

Answers (1)

datenwolf
datenwolf

Reputation: 162164

In OpenGL textures get their size set upon creation. You can't change the size afterwards. But you can create a new texture and copy the contents of the old one to it. For that you bind the old texture as a framebuffer object (FBO) color attachment and render the old texture into it.

Upvotes: 1

Related Questions