Пример #1
0
void Grabber::grab(Texture2D* texture)
{
    FZ_ASSERT(texture, "Texture can not be NULL");

    FZRETAIN_TEMPLATE(texture, p_texture);

    // generate FBO
    if(m_fbo == 0)
        fzGLGenFramebuffers(1, &m_fbo);

    // cache current framebuffer
    m_oldFBO = fzGLGetFramebuffer();

    // bind FBO
    fzGLBindFramebuffer(m_fbo);

    // associate texture with FBO
    fzGLFramebufferTexture2D(FZ_FRAMEBUFFER, FZ_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_texture->getName(), 0);

    // check if it worked
    GLuint status = fzGLCheckFramebufferStatus(FZ_FRAMEBUFFER);
    if (status != FZ_FRAMEBUFFER_COMPLETE) {
        FZLOGERROR("Grabber: Could not attach texture to framebuffer. Status: 0x%04X.", status);
    }

    fzGLClearColor(fzColor4F(0,0,0,0));
    glClear(GL_COLOR_BUFFER_BIT);

    fzGLBindFramebuffer(m_oldFBO);
    m_oldFBO = -1;

    CHECK_GL_ERROR_DEBUG();
}
Пример #2
0
    void Label::setFont(Font* font)
    {
        FZRETAIN_TEMPLATE(font, p_font);

        if(font) {
            setTexture(font->getTexture());
            createFontChars();
        }
    }
Пример #3
0
    void Sprite::setTexture(Texture2D* texture)
    {
        FZ_ASSERT( m_mode == kFZSprite_SelfRendering, "Sprite mode is not kFZSprite_SelfRendering.");

        if(m_mode != kFZSprite_SelfRendering)
            return;
        
        FZRETAIN_TEMPLATE(texture, mode.A.p_texture);
        
        updateTextureCoords(m_textureRect);
    }
Пример #4
0
 void ParticleSystem::setTexture(Texture2D *texture)
 {
     FZRETAIN_TEMPLATE(texture, p_texture);
 }
Пример #5
0
 void Step::setInnerAction(Action *action)
 {
     FZRETAIN_TEMPLATE(action, p_innerAction);
 }
Пример #6
0
 void RepeatForever::setInnerAction(FiniteTimeAction *action)
 {
     FZRETAIN_TEMPLATE(action, p_innerAction);
 }