Пример #1
0
static void say_buffer_make_current(say_buffer *buf) {
    say_context *context = say_context_current();

    if (context->buffer_obj != buf) {
        say_buffer_setup_pointer(buf);
        context->buffer_obj = buf;
    }
}
Пример #2
0
static void say_vbo_make_current(GLuint vbo) {
    say_context *context = say_context_current();

    if (context->vbo != vbo) {
        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        context->vbo = vbo;
    }
}
Пример #3
0
static void say_buffer_delete_vao_pair(say_vao_pair *pair) {
    say_context *context = say_context_current();

    if (context == pair->context && context->vao == pair->vao) {
        glDeleteVertexArrays(1, &pair->vao);
        say_index_buffer_rebind();

        context->vao = 0;
    }
}
Пример #4
0
static void say_vao_make_current(GLuint vao) {
    say_context *context = say_context_current();

    if (context->vao != vao) {
        glBindVertexArray(vao);
        say_index_buffer_rebind();

        context->vao = vao;
    }
}
Пример #5
0
void say_fbo_make_current(GLuint fbo) {
    say_context *context = say_context_current();

    if (context != say_fbo_last_context ||
            fbo != say_current_fbo) {
        say_current_fbo = fbo;
        say_fbo_last_context = context;

        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
    }
}
Пример #6
0
void say_rbo_make_current(GLuint rbo) {
    say_context *context = say_context_current();

    if (context != say_rbo_last_context ||
            rbo != say_current_rbo) {
        say_current_rbo = rbo;
        say_rbo_last_context = context;

        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbo);
    }
}
Пример #7
0
static GLuint say_buffer_get_vao(say_buffer *buf) {
    say_context *ctxt = say_context_current();

    if (!mo_hash_has_key(buf->vaos, &ctxt)) {
        say_vao_pair pair;
        pair.context = ctxt;
        glGenVertexArrays(1, &pair.vao);
        say_buffer_build_vao(buf, pair.vao);

        mo_hash_set(buf->vaos, &ctxt, &pair);

        return pair.vao;
    }
    else {
        return mo_hash_get_ptr(buf->vaos, &ctxt, say_vao_pair)->vao;
    }
}