void CGLWorkspace::paintGL(){
	CGLWidget::GetInstance()->resetGLView();
	Translate();
	DrawBorderRect();	
	DrawInnerRect();
	DrawToTexture();

	int ypos= CGLWidget::GetInstance()->GetSize().y()
		-iSize.y()
		-iPosition.y()+GetBorders().bottom;

	//CGLWidget::GetInstance()->resetGLView();
	//Translate();
	glViewport(iPosition.x()+GetBorders().left,
		ypos ,
		iSize.x()-GetBorders().left-GetBorders().right
		, iSize.y()-GetBorders().top-GetBorders().bottom);					// Reset The Current Viewport
	glMatrixMode(GL_PROJECTION);						// Select The Projection Matrix
	glLoadIdentity();							// Reset The Projection Matrix
	glOrtho(0, 1 , 0,1, 0.1, 90); 
	glMatrixMode(GL_MODELVIEW); 
	glLoadIdentity();				
	glTranslatef(0,0,-50);
	glDisable(GL_BLEND);

	glColor4f(1.,1.,1.,1.);
	DrawFromTexture();
	glEnable(GL_BLEND);
	/*glColor4f(1,1,1,1);
	glRectf(0,0,0.1,0.1);*/
	//DrawSelection();
}
Ejemplo n.º 2
0
void COverlayRenderer::DrawARGBBitmap(OSDTexture* pOsdTexture, const BD_ARGB_OVERLAY* pOv)
{
  CAutoLock lock(&m_csRenderLock);
  
  if (!pOsdTexture || !m_pD3DDevice || !pOv)
    return;

  if (pOv->argb)
  {
    IDirect3DTexture9* texture = NULL;

    if (m_pD3DDevice)
    {
      AdjustDirtyRect(pOv->plane, pOv->x, pOv->y, pOv->w, pOv->h);
      
      D3DLOCKED_RECT lockedRect;
    
      HRESULT hr = m_pD3DDevice->CreateTexture(pOv->w, pOv->h, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, 
                                                D3DPOOL_DEFAULT, &texture, NULL);

      if (SUCCEEDED(hr))
      {
        hr = texture->LockRect(0, &lockedRect, NULL, 0);
        if (SUCCEEDED(hr))
        {
          if (pOv->argb)
          {
            for(INT i = 0; i < pOv->h; i++)
            {
              DWORD *pDst = (DWORD*)lockedRect.pBits + (lockedRect.Pitch / 4) * i;
              DWORD *pSrc = (DWORD*)pOv->argb + i * pOv->stride;
              memcpy(pDst, pSrc, pOv->w * 4);
            }
          }
          else 
            LogDebug("ovr: DrawBitmap - pOv->argb is NULL");

          texture->UnlockRect(0);
        }
        else
          LogDebug("ovr: DrawBitmap LockRect 0x%08x", hr);

        DrawToTexture(pOsdTexture, texture, pOv->x, pOv->y, pOv->w, pOv->h);
      }
      else
        LogDebug("ovr: DrawBitmap - CreateTexture2 0x%08x", hr);
    }
  }
}
Ejemplo n.º 3
0
void COverlayRenderer::DrawBitmap(OSDTexture* pOsdTexture, const BD_OVERLAY* pOv)
{
  CAutoLock lock(&m_csRenderLock);
  
  if (!pOsdTexture || !m_pD3DDevice)
    return;

  if (pOv->palette)
    DecodePalette(pOv);

  if (pOv->img)
  {
    IDirect3DTexture9* texture = NULL;

    if (m_pD3DDevice)
    {
      AdjustDirtyRect(pOv->plane, pOv->x, pOv->y, pOv->w, pOv->h);
      
      D3DLOCKED_RECT lockedRect;
    
      HRESULT hr = m_pD3DDevice->CreateTexture(pOv->w, pOv->h, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, 
                                                D3DPOOL_DEFAULT, &texture, NULL);
    
      if (SUCCEEDED(hr))
      {
        hr = texture->LockRect(0, &lockedRect, NULL, 0);
        if (SUCCEEDED(hr))
        {
          UINT32* dst = (UINT32*)lockedRect.pBits;
          const BD_PG_RLE_ELEM* rlep = pOv->img;
          unsigned pixels = pOv->w * pOv->h;

          // Copy image data to the texture
          if (pOv->img)
          {
            for (unsigned int i = 0; i < pixels; rlep++)
            {
              for (unsigned int j = rlep->len; j > 0; j--)
              {
                if (i > 0 && i % pOv->w == 0)
                  dst += lockedRect.Pitch / 4 - pOv->w;

                *dst = m_palette[rlep->color];
                dst++;
                i++;
              }
            }
          }
          else 
            LogDebug("ovr: DrawBitmap - pOv->img is NULL");

          texture->UnlockRect(0);
        }
        else
          LogDebug("ovr: DrawBitmap LockRect 0x%08x", hr);

        DrawToTexture(pOsdTexture, texture, pOv->x, pOv->y, pOv->w, pOv->h);
      }
      else
        LogDebug("ovr: DrawBitmap - CreateTexture2 0x%08x", hr);
    }
  }
}