예제 #1
0
void RenderTexture::endRendering() {
    const int width = width_;
    const int height = height_;
    invalidateFrameBuffer(GL_DRAW_FRAMEBUFFER, true, false, true);
    if (renderTexture_gl_resolve_buffer_ && sample_count_ > 1) {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, renderTexture_gl_resolve_buffer_->id());
        glBlitFramebuffer(0, 0, width, height, 0, 0, width, height,
                          GL_COLOR_BUFFER_BIT, GL_NEAREST);
        invalidateFrameBuffer(GL_READ_FRAMEBUFFER, true, true, false);
    }
}
예제 #2
0
void GLRenderTexture::beginRendering(Renderer* renderer)
{
    glViewport(viewport_[0], viewport_[1], viewport_[2], viewport_[3]);
    glScissor(viewport_[0], viewport_[1], viewport_[2], viewport_[3]);
    invalidateFrameBuffer(GL_FRAMEBUFFER, true, true, renderTexture_gl_render_buffer_ != NULL);
    glDepthMask(GL_TRUE);
    GL(glEnable(GL_DEPTH_TEST));
    GL(glDepthFunc(GL_LEQUAL));
    GL(glEnable(GL_CULL_FACE));
    GL(glFrontFace(GL_CCW));
    GL(glCullFace(GL_BACK));
    GL(glDisable(GL_POLYGON_OFFSET_FILL));
    GL(glLineWidth(1.0f));

    if ((mBackColor[0] != -1))
    {
        int mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
        glClearColor(mBackColor[0], mBackColor[1], mBackColor[2], mBackColor[3]);
        if (mUseStencil && (depth_format_ == GL_DEPTH24_STENCIL8_OES))
        {
            mask |= GL_STENCIL_BUFFER_BIT;
            glStencilMask(~0);
        }
        glClear(mask);
    }
    else
    {
        glClear(GL_DEPTH_BUFFER_BIT);
    }
}
예제 #3
0
void GLRenderTexture::endRendering(Renderer* renderer)
{
    Image* image = getImage();
    const int width = image->getWidth();
    const int height = image->getHeight();
    int fbid = getFrameBufferId();

    invalidateFrameBuffer(GL_DRAW_FRAMEBUFFER, true, false, true);
    if (renderTexture_gl_resolve_buffer_ && mSampleCount > 1)
    {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, fbid);
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, renderTexture_gl_resolve_buffer_->id());
        glBlitFramebuffer(0, 0, width, height,
                          0, 0, width, height,
                          GL_COLOR_BUFFER_BIT, GL_NEAREST);
        invalidateFrameBuffer(GL_READ_FRAMEBUFFER, true, true, false);
    }
}
예제 #4
0
void RenderTexture::beginRendering() {
    const int width = width_;
    const int height = height_;
    glBindFramebuffer(GL_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
    glViewport(0, 0, width, height);
    glScissor(0, 0, width, height);
    glDepthMask(GL_TRUE);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    invalidateFrameBuffer(GL_FRAMEBUFFER, true, true, true);
    glClear(GL_DEPTH_BUFFER_BIT);
}
예제 #5
0
bool VDVideoSourceFLM::setTargetFormat(int format) {
	if (!format)
		format = nsVDPixmap::kPixFormat_XRGB8888;

	switch(format) {
	case nsVDPixmap::kPixFormat_XRGB1555:
	case nsVDPixmap::kPixFormat_RGB888:
	case nsVDPixmap::kPixFormat_XRGB8888:
		if (!VideoSource::setTargetFormat(format))
			return false;

		invalidateFrameBuffer();
		return true;
	}

	return false;
}
예제 #6
0
bool VideoSourceImages::setTargetFormat(int format) {
	if (!format)
		format = nsVDPixmap::kPixFormat_XRGB8888;

	switch(format) {
	case nsVDPixmap::kPixFormat_XRGB1555:
	case nsVDPixmap::kPixFormat_RGB888:
	case nsVDPixmap::kPixFormat_XRGB8888:
		if (!VideoSource::setTargetFormat(format))
			return false;

		invalidateFrameBuffer();

		mvbFrameBuffer.init((void *)getFrameBuffer(), mpTargetFormatHeader->biWidth, mpTargetFormatHeader->biHeight, mpTargetFormatHeader->biBitCount);
		mvbFrameBuffer.AlignTo4();

		return true;
	}

	return false;
}
예제 #7
0
void RenderTexture::beginRendering() {
    const int width = width_;
    const int height = height_;
    glBindFramebuffer(GL_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
    glViewport(0, 0, width, height);
    glScissor(0, 0, width, height);
    glDepthMask(GL_TRUE);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    invalidateFrameBuffer(GL_FRAMEBUFFER, true, true, true);
    if ((back_color_[0] + back_color_[1] + back_color_[2] + use_stencil_) != 0) {
        int mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
        glClearColor(back_color_[0], back_color_[1], back_color_[2], 1);
        if (use_stencil_) {
            mask |= GL_STENCIL_BUFFER_BIT;
            glStencilMask(~0);
        }
        glClear(mask);
    } else {
        glClear(GL_DEPTH_BUFFER_BIT);
    }
}
예제 #8
0
VideoSourceImages::VideoSourceImages(VDInputFileImages *parent)
	: mpParent(parent)
	, mCachedHandleFrame(-1)
{
	mSampleFirst = 0;

	mpTargetFormatHeader.resize(sizeof(BITMAPINFOHEADER));
	allocFormat(sizeof(BITMAPINFOHEADER));

	invalidateFrameBuffer();

	// This has to be 1 so that read() doesn't kick away the request.

	mSampleLast = mpParent->GetFrameCount();
	getFrame(0);

	// Fill out streamInfo
	extern const VDFraction& VDPreferencesGetImageSequenceFrameRate();
	const VDFraction& fr = VDPreferencesGetImageSequenceFrameRate();

	streamInfo.fccType					= VDAVIStreamInfo::kTypeVideo;
	streamInfo.fccHandler				= NULL;
	streamInfo.dwFlags					= 0;
	streamInfo.dwCaps					= 0;
	streamInfo.wPriority				= 0;
	streamInfo.wLanguage				= 0;
	streamInfo.dwScale					= fr.getLo();
	streamInfo.dwRate					= fr.getHi();
	streamInfo.dwStart					= 0;
	streamInfo.dwLength					= VDClampToUint32(mSampleLast);
	streamInfo.dwInitialFrames			= 0;
	streamInfo.dwSuggestedBufferSize	= 0;
	streamInfo.dwQuality				= (DWORD)-1;
	streamInfo.dwSampleSize				= 0;
	streamInfo.rcFrameLeft				= 0;
	streamInfo.rcFrameTop				= 0;
	streamInfo.rcFrameRight				= (uint16)getImageFormat()->biWidth;
	streamInfo.rcFrameBottom			= (uint16)getImageFormat()->biHeight;
}