Exemplo n.º 1
0
static void droid_Shutdown(GF_VideoOutput *dr)
{
	RAWCTX;
	LOG( ANDROID_LOG_DEBUG, TAG, "Android Shutdown\n");

	releaseTexture(rc);
#ifdef GLES_FRAMEBUFFER_TEST
	releaseFrameBuffer(rc);
#endif
        LOG( ANDROID_LOG_VERBOSE, TAG, "Android Shutdown DONE");
}
Exemplo n.º 2
0
 ~Impl() {
   releaseFrameBuffer();
   try {
     if(cameraProxy) {
       // Unregister the video module.
       cameraProxy->unsubscribe(nameId);
     }
     cameraProxy.reset(); // explicit shared_ptr ref count decr
   } catch(const AL::ALError& e) {
     qiLogError("FGrab: Error in Impl desctructor: ") <<  e.toString() << std::endl;
   }
 }
Exemplo n.º 3
0
void release() {
	delete redMat;
	delete greenMat;
	delete planeMat;
	delete sphereMat;
	delete emiMat;
	delete matSampler;
	delete camera;
	ReleaseWorld();

	releaseFrameBuffer(&frameBuffer);
}
Exemplo n.º 4
0
bool GlesBox::bindFrameBuffer(uint32_t width, uint32_t height) {
  //renew framebuffer
  if (core_->framebuffer_ == 0 || core_->width_ != width || core_->height_ != height) {
    releaseFrameBuffer();
    createFrameBuffer(width, height);
    core_->width_ = width;
    core_->height_ = height;
  }
  glEnable(GL_TEXTURE_2D);
  //glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, core_->texture_render_);
  glBindFramebuffer(GL_FRAMEBUFFER, core_->framebuffer_);
  glViewport(0, 0, core_->width_, core_->height_);
  
  return true;
}
Exemplo n.º 5
0
void RenderSystem::shutdown()
{
  delete m_stateCache;
  m_stateCache = 0;

  if (m_isFullScreen && m_swapChain)
    m_swapChain->SetFullscreenState(FALSE, NULL);

  if (m_renderContext)
    m_renderContext->ClearState();

  releaseFrameBuffer();
  
  SAFE_RELEASE(m_swapChain);
  SAFE_RELEASE(m_renderContext);
  SAFE_RELEASE(m_device);
}
Exemplo n.º 6
0
void RenderSystem::createFrameBuffer()
{
  releaseFrameBuffer();

  ID3D11Texture2D* backBuffer;
  if (SUCCEEDED(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer)))
  {
    VALIDATE(m_device->CreateRenderTargetView(backBuffer, NULL, &m_backBufferRTV));
    backBuffer->Release();
  }

  DXGI_SWAP_CHAIN_DESC sd;
  m_swapChain->GetDesc(&sd);

  D3D11_TEXTURE2D_DESC desc;
  ::ZeroMemory(&desc, sizeof(D3D11_TEXTURE2D_DESC));
  desc.ArraySize = 1;
  desc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
  desc.Format = DXGI_FORMAT_R24G8_TYPELESS;
  desc.Width = sd.BufferDesc.Width;
  desc.Height = sd.BufferDesc.Height;
  desc.MipLevels = sd.SampleDesc.Count > 0 ? 1 : 0;
  desc.SampleDesc = sd.SampleDesc;
  desc.Usage = D3D11_USAGE_DEFAULT;

  if (SUCCEEDED(m_device->CreateTexture2D(&desc, NULL, &m_depthBuffer)))
  {
    D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
    ::ZeroMemory(&descDSV, sizeof(D3D11_DEPTH_STENCIL_VIEW_DESC));
    descDSV.ViewDimension = sd.SampleDesc.Count > 0 ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D;
    descDSV.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;

    VALIDATE(m_device->CreateDepthStencilView(m_depthBuffer, &descDSV, &m_backBufferDSV));
  }

  m_stateCache->setRenderTargets(1, &m_backBufferRTV, m_backBufferDSV);

  setViewport((float)sd.BufferDesc.Width, (float)sd.BufferDesc.Height);
}
Exemplo n.º 7
0
int createFrameBuffer(AndroidContext *rc)
{
	int backingWidth;
	int backingHeight;
	int res;

	if ( rc->framebuff >= 0 )
		releaseFrameBuffer(rc);

	LOG( ANDROID_LOG_DEBUG, TAG, "Android Create FrameBuffer"));

	glGenFramebuffersOES(1, &(rc->framebuff));
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, rc->framebuff);

//	glGenRenderbuffersOES(1, &(rc->depthbuff));
//	glBindRenderbufferOES(GL_RENDERBUFFER_OES, rc->depthbuff);

//	glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
//	glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);

//	LOG( ANDROID_LOG_ERROR, TAG, "Android Depth Buffer Size: %dx%d\n", backingWidth, backingHeight));

//    glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, rc->width, rc->height);

//    glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES,
//            GL_RENDERBUFFER_OES, rc->depthbuff);

	glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES,
			GL_TEXTURE_2D, rc->texID, 0);

	if ( (res=(int)glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)) != GL_FRAMEBUFFER_COMPLETE_OES )
	{
		LOG( ANDROID_LOG_ERROR, TAG, "Android failed to make complete framebuffer object:");
		switch (res)
		{
			case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES:
				LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES");
				break;
			case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES:
				LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES");
				break;
			case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES:
				LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES");
				break;
			case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES:
				LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES");
				break;
			case GL_FRAMEBUFFER_UNSUPPORTED_OES:
				LOG( ANDROID_LOG_ERROR, TAG, "GL_FRAMEBUFFER_UNSUPPORTED_OES");
				break;
			default :
				LOG( ANDROID_LOG_ERROR, TAG, "Unknown error: %d", res);
				break;
		}

        return 1;
    }

    //glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);

	return 0;
}
Exemplo n.º 8
0
void resize(int width,int height) {
	releaseFrameBuffer(&frameBuffer);
	initFrameBuffer(&frameBuffer,width,height);

	scrw=width; scrh=height;
}