Ejemplo n.º 1
0
void mirrorclamp_app::render(double T)
{
    glViewport(0, 0, info.windowWidth, info.windowHeight);

    glClearBufferfv(GL_COLOR, 0, sb7::color::Black);

    Sleep(1);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, input_texture);

    glBindVertexArray(dummy_vao);
    glUseProgram(render_program);

    switch (display_mode)
    {
        case CLAMP_TO_BORDER:
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
            break;
        case MIRROR_CLAMP_TO_EDGE:
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRROR_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRROR_CLAMP_TO_EDGE);
            break;
    }

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    overlay.clear();
    overlay.drawText(display_mode == CLAMP_TO_BORDER ? "Mode = GL_CLAMP_TO_BORDER (M toggles)" : "Mode = GL_MIRROR_CLAMP_TO_EDGE (M toggles)", 0, 0);
    overlay.draw();
}
Ejemplo n.º 2
0
void cullindirect_app::updateOverlay()
{
    char buffer[256];

    overlay.clear();
    sprintf(buffer, "%2.2fms / frame (%4.2f FPS)", 1000.0f / fps, fps);
    overlay.drawText(buffer, 0, 0);
    overlay.draw();
}
Ejemplo n.º 3
0
void pmbstreaming_app::updateOverlay()
{
    char buffer[256];
    static const char * modenames[] =
    {
        "BRAK_SYNCHRONIZACJI",
        "FUNKCJA_FINISH",
        "POJEDYNCZA_SYNCHRONIZACJA",
        "WIELE_SYNCHRONIZACJI"
    };

    overlay.clear();
    sprintf(buffer, "%2.2fms / klatka (%4.2f FPS)", 1000.0f / fps, fps);
    overlay.drawText(buffer, 0, 0);
    sprintf(buffer, "TRYB: %s", modenames[mode]);
    overlay.drawText(buffer, 0, 1);
    if (stalled)
    {
        overlay.drawText("BLOKOWANIE", 0, 2);
    }

    overlay.draw();
}
Ejemplo n.º 4
0
void pmbstreaming_app::updateOverlay()
{
    char buffer[256];
    static const char * modenames[] =
    {
        "NO_SYNC",
        "FINISH",
        "ONE_SYNC",
        "RINGED_SYNC"
    };

    overlay.clear();
    sprintf(buffer, "%2.2fms / frame (%4.2f FPS)", 1000.0f / fps, fps);
    overlay.drawText(buffer, 0, 0);
    sprintf(buffer, "MODE: %s", modenames[mode]);
    overlay.drawText(buffer, 0, 1);
    if (stalled)
    {
        overlay.drawText("STALLED", 0, 2);
    }

    overlay.draw();
}
Ejemplo n.º 5
0
void dof_app::startup()
{
    load_shaders();

    int i;

    static const char * const object_names[] =
    {
        "media/objects/dragon.sbm",
        "media/objects/sphere.sbm",
        "media/objects/cube.sbm",
        "media/objects/cube.sbm",
        "media/objects/cube.sbm",
    };

    static const vmath::vec4 object_colors[] =
    {
        vmath::vec4(1.0f, 0.7f, 0.8f, 1.0f),
        vmath::vec4(0.7f, 0.8f, 1.0f, 1.0f),
        vmath::vec4(0.3f, 0.9f, 0.4f, 1.0f),
        vmath::vec4(0.6f, 0.4f, 0.9f, 1.0f),
        vmath::vec4(0.8f, 0.2f, 0.1f, 1.0f),
    };

    for (i = 0; i < OBJECT_COUNT; i++)
    {
        objects[i].obj.load(object_names[i]);
        objects[i].diffuse_albedo = object_colors[i];
    }

    glGenFramebuffers(1, &depth_fbo);
    glBindFramebuffer(GL_FRAMEBUFFER, depth_fbo);

    glGenTextures(1, &depth_tex);
    glBindTexture(GL_TEXTURE_2D, depth_tex);
    glTexStorage2D(GL_TEXTURE_2D, 11, GL_DEPTH_COMPONENT32F, FBO_SIZE, FBO_SIZE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glGenTextures(1, &color_tex);
    glBindTexture(GL_TEXTURE_2D, color_tex);
    glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, FBO_SIZE, FBO_SIZE);

    glGenTextures(1, &temp_tex);
    glBindTexture(GL_TEXTURE_2D, temp_tex);
    glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, FBO_SIZE, FBO_SIZE);

    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_tex, 0);
    glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, color_tex, 0);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    glEnable(GL_DEPTH_TEST);

    glGenVertexArrays(1, &quad_vao);
    glBindVertexArray(quad_vao);

    overlay.init(80, 50);
    overlay.clear();
    overlay.drawText("Q: Increas focal distance", 0, 0);
    overlay.drawText("A: Decrease focal distance", 0, 1);
    overlay.drawText("W: Increase focal depth", 0, 2);
    overlay.drawText("S: Decrease focal depth", 0, 3);
    overlay.drawText("P: Pause", 0, 4);
}