I am trying to create a 1 channel texture, and update on the fly with a 1 channel image buffer. Im trying to render the texture at its native black and white.
I am creating the storage like so:
glTexStorage2D ( GL_TEXTURE_2D, 1, GL_R8, width, height );
And filling it like so (where data is a single channel image buffer):
glTexSubImage2D ( GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED, GL_UNSIGNED_BYTE, data );
When rendering I am getting a red version of my b/w image.
My intention was that the other channels would get duplicates of the red channel (other than alpha which would get 1,0).
My shader is generic for any type of texture, and I dont want to have a custom one for greyscale images, as i am also showing non-greyscale images.
I was under the impression that GL_LUMINACE would do what I intended, but I thought that was deprecated.
I would rather not use a BGRA texture and fill the B G R with the same value coming from my data. Im trying to fill this as fast as possible from a decoded b/w video, and at the same time minimize use of texture memory. I also get RGB video, that i am uploading as BGRA8, which works fine (swizzling and adding A before the upload), but I want to use the same shader.
I must be doing something silly, and misunderstanding something.
How would I accomplish this?
Thanx for any help.