Changeset 823


Ignore:
Timestamp:
Aug 13, 2011, 10:05:48 PM (8 years ago)
Author:
sam
Message:

debug: minor updates to the debug quad code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/debug/quad.cpp

    r822 r823  
    127127    /* Prepare our quad coordinates */
    128128    vec2i const layout(4, 3);
    129     data->step = vec2(2.0f, -2.0f) / (3 * layout + vec2i(1));
     129    data->step = vec2(2.0f, -2.0f) / (4 * layout + vec2i(1));
    130130    data->orig = vec2(-1.0f, 1.0f) + data->step;
    131131    data->aa = data->orig;
    132     data->bb = data->orig + 2.0f * data->step;
     132    data->bb = data->orig + 3.0f * data->step;
    133133
    134134    /* Generate a few random numbers */
     
    200200     * Test #3: glBegin + texture
    201201     *
    202      * Renders an animated black-and-white distorted checkerboard.
     202     * Renders a multicoloured square with varying colors multiplied with an
     203     * animated distorted checkerboard.
    203204     */
    204205    glEnable(GL_TEXTURE_2D);
     
    206207    glColor3f(1.0f, 1.0f, 1.0f);
    207208    glBegin(GL_TRIANGLES);
     209        glColor3f(f1, f2, f3);
    208210        glTexCoord2f(f1, f3);
    209211        glVertex3f(data->aa.x, data->bb.y, 0.0f);
     212        glColor3f(f4, f2, f1);
    210213        glTexCoord2f(f3, f2);
    211214        glVertex3f(data->bb.x, data->bb.y, 0.0f);
     215        glColor3f(f3, f1, f4);
    212216        glTexCoord2f(f2, f4);
    213217        glVertex3f(data->bb.x, data->aa.y, 0.0f);
     
    215219        glTexCoord2f(f2, f4);
    216220        glVertex3f(data->bb.x, data->aa.y, 0.0f);
     221        glColor3f(f4, f3, f2);
    217222        glTexCoord2f(f4, f1);
    218223        glVertex3f(data->aa.x, data->aa.y, 0.0f);
     224        glColor3f(f1, f2, f3);
    219225        glTexCoord2f(f1, f3);
    220226        glVertex3f(data->aa.x, data->bb.y, 0.0f);
     
    636642                 GL_DYNAMIC_DRAW);
    637643    glVertexAttribPointer(attr[1], 3, GL_FLOAT, GL_FALSE, 0, 0);
    638     glEnableVertexAttribArray(attr[2]);
     644    glEnableVertexAttribArray(attr[1]);
    639645
    640646    glBindBuffer(GL_ARRAY_BUFFER, *buffer++);
     
    694700void DebugQuad::Advance()
    695701{
    696     data->aa.x += 3.0f * data->step.x;
    697     data->bb.x += 3.0f * data->step.x;
     702    data->aa.x += 4.0f * data->step.x;
     703    data->bb.x += 4.0f * data->step.x;
    698704    if (data->bb.x > 1.0f)
    699705    {
    700706        data->aa.x = data->orig.x;
    701         data->bb.x = data->orig.x + 2.0f * data->step.x;
    702         data->aa.y += 3.0f * data->step.y;
    703         data->bb.y += 3.0f * data->step.y;
     707        data->bb.x = data->orig.x + 3.0f * data->step.x;
     708        data->aa.y += 4.0f * data->step.y;
     709        data->bb.y += 4.0f * data->step.y;
    704710    }
    705711}
Note: See TracChangeset for help on using the changeset viewer.