Changes between Version 1 and Version 2 of pub/trash/pour-guite


Ignore:
Timestamp:
Aug 8, 2011, 12:27:59 PM (9 years ago)
Author:
sam
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pub/trash/pour-guite

    v1 v2  
     1== Some debug code for increasingly complex rendering methods ==
     2
    13{{{
    24#!cpp
     
    337339
    338340    /*
    339      * Test #7: vertex buffer
     341     * Test #7: vertex buffer + per-vertex coloring
    340342     * Renders a multicolored square with varying colors.
    341343     */
     
    356358    glDisableClientState(GL_VERTEX_ARRAY);
    357359    glDisableClientState(GL_COLOR_ARRAY);
    358     glUseProgram(0);
    359 
    360     Advance();
    361 
    362     /*
    363      * Test #8: vertex buffer + texture & color in 1.10 fragment shader
     360
     361    Advance();
     362
     363    /*
     364     * Test #8: vertex buffer + per-vertex coloring + texture
     365     * Renders a multicolored square with varying colors multiplied with an
     366     * animated distorted checkerboard.
     367     */
     368    GLfloat const vertices2[] = { data->aa.x, data->bb.y, 0.0f,
     369                                  data->bb.x, data->bb.y, 0.0f,
     370                                  data->bb.x, data->aa.y, 0.0f,
     371                                  data->bb.x, data->aa.y, 0.0f,
     372                                  data->aa.x, data->aa.y, 0.0f,
     373                                  data->aa.x, data->bb.y, 0.0f };
     374
     375    glEnable(GL_TEXTURE_2D);
     376    glBindTexture(GL_TEXTURE_2D, data->texture[0]);
     377    glEnableClientState(GL_COLOR_ARRAY);
     378    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
     379    glEnableClientState(GL_VERTEX_ARRAY);
     380
     381    glColorPointer(3, GL_FLOAT, 0, colors);
     382    glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
     383    glVertexPointer(3, GL_FLOAT, 0, vertices2);
     384    glDrawArrays(GL_TRIANGLES, 0, 6);
     385
     386    glDisableClientState(GL_VERTEX_ARRAY);
     387    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
     388    glDisableClientState(GL_COLOR_ARRAY);
     389    glDisable(GL_TEXTURE_2D);
     390
     391    Advance();
     392
     393    /*
     394     * Test #9: vertex buffer + texture & color in 1.10 fragment shader
    364395     * Renders a multicolored square with varying colors xored with an
    365396     * animated distorted checkerboard.
     
    386417
    387418    data->shader[3]->Bind();
    388     GLfloat const vertices2[] = { data->aa.x, data->bb.y, 0.0f,
     419    GLfloat const vertices3[] = { data->aa.x, data->bb.y, 0.0f,
    389420                                  data->bb.x, data->bb.y, 0.0f,
    390421                                  data->bb.x, data->aa.y, 0.0f,
     
    397428    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    398429
    399     glVertexPointer(3, GL_FLOAT, 0, vertices2);
     430    glVertexPointer(3, GL_FLOAT, 0, vertices3);
    400431    glColorPointer(3, GL_FLOAT, 0, colors);
    401432    glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
     
    410441
    411442    /*
    412      * Test #8: vertex buffer + texture & color in 1.20 fragment shader
     443     * Test #10: vertex buffer + texture & color in 1.20 fragment shader
    413444     * Renders a multicolored square with varying colors xored with an
    414445     * animated distorted checkerboard.
     
    442473    }
    443474    data->shader[4]->Bind();
    444     GLfloat const vertices3[] = { data->aa.x, data->bb.y, 0.0f,
     475    GLfloat const vertices4[] = { data->aa.x, data->bb.y, 0.0f,
    445476                                  data->bb.x, data->bb.y, 0.0f,
    446477                                  data->bb.x, data->aa.y, 0.0f,
     
    452483
    453484    glBindBuffer(GL_ARRAY_BUFFER, data->buffer[0]);
    454     glBufferData(GL_ARRAY_BUFFER, sizeof(vertices3), vertices3,
     485    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices4), vertices4,
    455486                 GL_DYNAMIC_DRAW);
    456487    glVertexAttribPointer(data->attr[0], 3, GL_FLOAT, GL_FALSE, 0, 0);
     
    480511
    481512    /*
    482      * Test #8: vertex buffer + texture & color in 1.30 fragment shader
     513     * Test #11: vertex buffer + texture & color in 1.30 fragment shader
    483514     * Renders a multicolored square with varying colors xored with an
    484515     * animated distorted checkerboard.
     
    512543    }
    513544    data->shader[5]->Bind();
    514     GLfloat const vertices4[] = { data->aa.x, data->bb.y, 0.0f,
     545    GLfloat const vertices5[] = { data->aa.x, data->bb.y, 0.0f,
    515546                                  data->bb.x, data->bb.y, 0.0f,
    516547                                  data->bb.x, data->aa.y, 0.0f,
     
    522553
    523554    glBindBuffer(GL_ARRAY_BUFFER, data->buffer[3]);
    524     glBufferData(GL_ARRAY_BUFFER, sizeof(vertices4), vertices4,
     555    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices5), vertices5,
    525556                 GL_DYNAMIC_DRAW);
    526557    glVertexAttribPointer(data->attr[3], 3, GL_FLOAT, GL_FALSE, 0, 0);