[SOLVED]- Uploading a grayscale image to OpenGL

Hi all,
I m using opengl3.3 core profile. Previously for loading an 8bit image, I would simply call


and it worked out fine.

I just see the latest specs and both GL_INTENSITY and GL_LUMINANCE are deprecated and thus the error bit is set in the forward compatible context. My question is what is the replacement of these? I can put my data in red/green/blue channel using GL_[RED,GREEN,BLUE] format but it comes out in colors (red/green/blue resp.). Do i need to explicity generate the other two components also with the same value and pass it using GL_RGB? or is there another alternate which accepts the single intensity value so that i dont have to replicate the two channels needlessly?

Nevermind I got it. I can use a single channel (GL_RED for instance to pass the data to this channel only) and in shader assign it to the remaining channels like this.

vFragColor.rgb = texture(textureMap,uv).rrr;

Reference for people reading this:

Also allows the equivalent behaviour of GL_INTENSITY and GL_LUMINANCE without adding extra code to the shader.

It also allows the texture fetch hardware to do the swizzle rather than adding extra operations to the compiled shader.