http://bugs.freedesktop.org/show_bug.cgi?id=27312

           Summary: glCopyTexImage2D Doesnt seem to work correctly (returns
                    incorrect alpha component )when internal format is
                    GL_RGB
           Product: Mesa
           Version: unspecified
          Platform: x86 (IA32)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
        AssignedTo: mesa3d-dev@lists.sourceforge.net
        ReportedBy: karha...@arm.com


Created an attachment (id=34438)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=34438)
vertex shader used with above code snippet

In the following code snippet we are using RGBA color buffer which means,

glGetIntegerv(GL_RED_BITS, &red_bits);
glGetIntegerv(GL_GREEN_BITS, &green_bits);
glGetIntegerv(GL_BLUE_BITS, &blue_bits);
glGetIntegerv(GL_ALPHA_BITS, &alpha_bits);

All of the above return 8. 

The shaders are attached. I am unable to give complete code at the moment.

<Code Snippet starts>
projMat_loc = glGetUniformLocation(uiProgram, "mvpMatrix_uni");
glUniformMatrix4fv(projMat_loc, 1, 0, matProjection);

vertices_loc = glGetAttribLocation(uiProgram, "vertex_att");
colors_loc = glGetAttribLocation(uiProgram, "color_att");
txtCoord_loc = glGetAttribLocation(uiProgram, "multiTexCoord_att");
txtSampler = glGetUniformLocation(uiProgram, "texture0");

glEnableVertexAttribArray(vertices_loc);
glEnableVertexAttribArray(colors_loc);
glEnableVertexAttribArray(txtCoord_loc);

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

texCol[0] = 0.56;
texCol[1] = 0.56;
texCol[2] = 0.56;
texCol[3] = 0.56;

glClear(GL_COLOR_BUFFER_BIT);

glVertexAttribPointer(txtCoord_loc, 2, GL_FLOAT, GL_FALSE, 0, texCoords1);

vertex[0] = 4.5;
vertex[1] = 4.5;

glVertexAttribPointer(vertices_loc, 2, GL_FLOAT, GL_FALSE, 0, &vertex[0]);
glVertexAttribPointer(colors_loc, 4, GL_FLOAT, GL_FALSE, 0, texCol);

glDrawArrays(GL_POINTS, 0, 1);

glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 1, 1, 0); 

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLfloat)GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLfloat)GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (GLfloat)GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (GLfloat)GL_CLAMP_TO_EDGE);

glActiveTexture(GL_TEXTURE0);

glUniform1i(txtSampler, 0); 
glVertexAttribPointer(txtCoord_loc, 2, GL_FLOAT, GL_FALSE, 0, texCoords0);

vertex[0] = 12.5;
vertex[1] = 12.5;

col[0] = col[1] = col[2] = col[3] = 1; 

glVertexAttribPointer(vertices_loc, 2, GL_FLOAT, GL_FALSE, 0, &vertex[0]);
glVertexAttribPointer(colors_loc, 4, GL_FLOAT, GL_FALSE, 0, col);

glDrawArrays(GL_POINTS, 0, 1);

tmpBuf = (GLubyte *)malloc(4*sizeof(GLubyte));
glReadPixels(12, 12, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, tmpBuf);  

/*##############################################################
##############################################################
##############################################################
tmpBuf[0]=tmpBuf[1]=tmpBuf[2] = 143 //Expected
tmpBuf[3] = 143 //Not expected - This should be 255 as we are not using this
component. I have checked this with other vendors NVIDIA and ATI and they
indeed report correct behavior (tmpBuf[3] = 255)
##############################################################
##############################################################
##############################################################*/
</Code Snippet ends>


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to