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

           Summary: glPixelStore effect glCopyTexImage2D with ati driver
           Product: Mesa
           Version: unspecified
          Platform: x86-64 (AMD64)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Drivers/DRI/r300
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Created an attachment (id=13675)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=13675)
ati and fglrx screenshots

01:00.0 VGA compatible controller: ATI Technologies Inc RV350 AP [Radeon 9600]
mesa 7.0.1
xorg-ati 1:6.7.195
xorg 1:7.2

glCopyTexImage2D generate bad texture if GL_UNPACK_ROW_LENGTH is set while
using ati driver. the texture is generated ok while using fglrx or nvidia
binary drivers.

According to ogl glCopyTexImage2D documentation
            "The pixels in the rectangle are processed exactly as if
            glCopyPixels had been called, but the process stops just before
            final conversion"
and in glCopyPixels documentation
            "Modes specified by glPixelStore have no effect on the operation
            of glCopyPixels."

in any case both source and destination are in internal format so glPixelStore
is irrelevant.


the following example demonstrate the problem.


void draw()
{
    GLuint texture;
    int src_x = 10;
    int src_y = 10;
    int copy_x = src_x + image.width + 10;
    int copy_y = src_y + image.height + 10;
    int copy_width = 64;
    int copy_height = 64;


    glClear(GL_COLOR_BUFFER_BIT);
    glRasterPos2i(src_x, src_y);
    glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width);
    glDrawPixels(image.width, image.height, GL_BGRA, GL_UNSIGNED_BYTE,
image.pixels);

    glColor3f(1, 0, 0);
    glBegin(GL_LINE_LOOP);
        glVertex2f(copy_x - 1, copy_y);
        glVertex2f(copy_x + copy_width, copy_y);
        glVertex2f(copy_x + copy_width, copy_y +  copy_height + 1);
        glVertex2f(copy_x -1, copy_y + copy_height + 1);
    glEnd();

    glEnable(GL_TEXTURE_2D);
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, src_x, src_y, copy_width,
copy_height, 0);

    GLfloat s_gen_params[] = { 1.0 / copy_width, 0, 0, 0 }; 
    GLfloat t_gen_params[] = { 0, 1.0 / copy_height, 0, 0 };
    glTexGenfv(GL_S, GL_OBJECT_PLANE, s_gen_params);
    glTexGenfv(GL_T, GL_OBJECT_PLANE, t_gen_params);

    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();

    glTranslatef((float)-copy_x / copy_width, (float)-copy_y / copy_height, 0);
    glRecti(copy_x, copy_y, copy_x + copy_width, copy_y + copy_height);

    glFinish();
    glDeleteTextures(1, &texture);
    glDisable(GL_TEXTURE_2D);
}

static void init(int width, int height)
{
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, width, 0, height, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glClearColor(0, 0, 0, 0);

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
    glEnable(GL_TEXTURE_GEN_S); 
    glEnable(GL_TEXTURE_GEN_T);
}


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to