Esempio n. 1
0
 GLTexture2DRenderView::GLTexture2DRenderView(const TexturePtr& texture, int32 index, int32 level):
 mTexture(texture),
 mLevel(level) {
     GLTexture2D* glTexture = (GLTexture2D*)mTexture.get();
     mTex = (GLuint)glTexture->getTextureId();
     mWidth = glTexture->width(0);
     mHeight = glTexture->height(0);
     mIndex = index;
     mElementFormat = glTexture->format();
 }
Esempio n. 2
0
    GLDepthStencilView::GLDepthStencilView(const TexturePtr& texture, int32 level):
    mTexture(texture),
    mLevel(level),
    mRBO(0),
    mSampleCount(1),
    mSampleQuaility(1) {
        GLTexture2D* glTexture = (GLTexture2D*)mTexture.get();
        mTex = (GLuint)glTexture->getTextureId();
        mWidth = glTexture->width(0);
        mHeight = glTexture->height(0);
        mElementFormat = glTexture->format();

        CHECK_GL_CALL(glGenRenderbuffers(1, &mRBO));
        if(mRBO) {
            CHECK_GL_CALL(glBindRenderbuffer(GL_RENDERBUFFER, mRBO));

            if(mSampleCount <= 1 || !glRenderbufferStorageMultisampleEXT) {
                CHECK_GL_CALL(glRenderbufferStorage(GL_RENDERBUFFER, element_format_to_gl_format(mElementFormat), mWidth, mHeight));
            }
            else {
                CHECK_GL_CALL(glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, mSampleCount, element_format_to_gl_format(mElementFormat), mWidth, mHeight));
            }
        }
    }