Using glTexImage2D with GL_ALPHA

Hi,
I am trying to use GL_ALPHA as internal format in glTexImage2D.
My code goes like follows :

GLubyte data[4] ={255,16,8,64};

glGenTextures(1, &textureId);
glActiveTexture ( GL_TEXTURE0 );
glBindTexture(GL_TEXTURE_2D, textureId);

glTexImage2D ( GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels );

Here I am a bit confused about width and height values .
When I am assigning (2 ,2) I am not getting expected output , because glReadPixels() doesn’t return any pixel with alpha value 8 or 64.

Am I doing something wrong ?

Issue resolved

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.