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





--- Comment #7 from Chris Rankin <[EMAIL PROTECTED]>  2008-09-04 05:46:00 PST 
---
I have been examining the rubik code. Each individul sub-cube is drawn by a
function called draw_cubit(), which has the following structure:

draw_cubit()
        draw_stickerless_cubit()
        if (back face visible)
                draw back sticker;
        if (front face visible)
                draw front sticker;
        if (left face visible)
                draw left sticker;
        if (right face visible)
                draw right sticker;
        if (bottom face visible)
                draw bottom sticker;
        if (top face visible)
                draw top sticker;

I have discovered that commenting out the call to draw_stickerless_cubit() here
allows the colored stickers to be seen again. It also makes the program run a
LOT faster, i.e. there is no longer a huge decrease in performance for larger
rubik's cubes. The draw_stickerless_cubit() function look like this:

#define CUBELEN 0.50
#define CUBEROUND (CUBELEN-0.05)
#define STICKERLONG (CUBEROUND-0.05)
#define STICKERSHORT (STICKERLONG-0.05)
#define STICKERDEPTH (CUBELEN+0.01)

draw_stickerless_cubit:
        glBegin(GL_QUADS);
        glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialGray);
        /* Put sticker here */
        glNormal3f(0.00, 0.00, 1.00);
        glVertex3f(-CUBEROUND, -CUBEROUND, CUBELEN);
        glVertex3f(CUBEROUND, -CUBEROUND, CUBELEN);
        glVertex3f(CUBEROUND, CUBEROUND, CUBELEN);
        glVertex3f(-CUBEROUND, CUBEROUND, CUBELEN);

        // And other 5 faces...

        /* Edges of cubit */
        glNormal3f(-1.00, -1.00, 0.00);
        glVertex3f(-CUBEROUND, -CUBELEN, -CUBEROUND);
        glVertex3f(-CUBEROUND, -CUBELEN, CUBEROUND);
        glVertex3f(-CUBELEN, -CUBEROUND, CUBEROUND);
        glVertex3f(-CUBELEN, -CUBEROUND, -CUBEROUND);

        // And other 5 faces...

        glEnd();
        glBegin(GL_TRIANGLES);
        glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialGray);
        /* Corners of cubit */
        glNormal3f(1.00, 1.00, 1.00);
        glVertex3f(CUBEROUND, CUBEROUND, CUBELEN);
        glVertex3f(CUBELEN, CUBEROUND, CUBEROUND);
        glVertex3f(CUBEROUND, CUBELEN, CUBEROUND);

        // And other 5 faces...

        glEnd();

It seems to be the GL_QUADS part of draw_stickerless_cubit() that makes
everything very slow, with the stickerless cube somehow masking the colors.


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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to