当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECT3DSURFACE9::GetDesc方法代码示例

本文整理汇总了C++中LPDIRECT3DSURFACE9::GetDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DSURFACE9::GetDesc方法的具体用法?C++ LPDIRECT3DSURFACE9::GetDesc怎么用?C++ LPDIRECT3DSURFACE9::GetDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECT3DSURFACE9的用法示例。


在下文中一共展示了LPDIRECT3DSURFACE9::GetDesc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
HRESULT CDXGraphicsContext::ResizeD3DEnvironment()
{
    HRESULT hr;
	
    // Release all vidmem objects
    if( FAILED( hr = CleanDeviceObjects() ) )
        return hr;
	
    // Reset the device
    if( IsResultGood( hr = m_pd3dDevice->Reset( &m_d3dpp ), true ) )
	{
		while ( hr == D3DERR_DEVICELOST )
		{
			Pause(true);
			hr = m_pd3dDevice->Reset( &m_d3dpp );
		}
	}
	else
	{
        return hr;
	}
	
    // Store render target surface desc
    LPDIRECT3DSURFACE9 pBackBuffer;
    m_pd3dDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
    pBackBuffer->GetDesc( &m_d3dsdBackBuffer );
    pBackBuffer->Release();
	
    // Initialize the app's device-dependent objects
	if ( CRender::IsAvailable() )
	{
		CRender::GetRender()->InitDeviceObjects();
	}
    return S_OK;
}
开发者ID:hminth,项目名称:Rice-Video,代码行数:39,代码来源:DXGraphicsContext.cpp

示例2: DbgLog

__forceinline bool CDecDXVA2::CopyFrame(LAVFrame *pFrame)
{
  HRESULT hr;
  LPDIRECT3DSURFACE9 pSurface = (LPDIRECT3DSURFACE9)pFrame->data[3];
  pFrame->format = LAVPixFmt_NV12;

  D3DSURFACE_DESC surfaceDesc;
  pSurface->GetDesc(&surfaceDesc);

  D3DLOCKED_RECT LockedRect;
  hr = pSurface->LockRect(&LockedRect, NULL, D3DLOCK_READONLY);
  if (FAILED(hr)) {
    DbgLog((LOG_TRACE, 10, L"pSurface->LockRect failed (hr: %X)", hr));
    return false;
  }

  // Free AVFrame based buffers again
  FreeLAVFrameBuffers(pFrame);
  // Allocate memory buffers
  AllocLAVFrameBuffers(pFrame, LockedRect.Pitch);
  // Copy surface onto memory buffers
  CopyFrameNV12((BYTE *)LockedRect.pBits, pFrame->data[0], pFrame->data[1], surfaceDesc.Height, pFrame->height, LockedRect.Pitch);

  pSurface->UnlockRect();

  return true;
}
开发者ID:betaking,项目名称:LAVFilters,代码行数:27,代码来源:dxva2dec.cpp

示例3: createFromPointer

ErrorCode Surface::createFromPointer(LPDIRECT3DSURFACE9 surf)
{
    if (this->surf != 0)
    {
        this->surf->Release();
        this->surf = 0;
    }

    if (surf == 0)
        return ErrorHandle(mamain->err, ErrorInv);

    D3DSURFACE_DESC desc;

    HRESULT res = surf->GetDesc(&desc);

    if (FAILED(res))
        return ErrorHandle(mamain->err, ErrorD3D9, res, "GetDesc");

    surfUsage  = desc.Usage;
    surfPool   = desc.Pool;
    surfWidth  = desc.Width;
    surfHeight = desc.Height;

    this->surf = surf;
    surf->AddRef();

    return ErrorOk;
}
开发者ID:gitter-badger,项目名称:MA-Engine,代码行数:28,代码来源:Resources.cpp

示例4: sizeof

HRESULT XD3DView::CreateView( HWND hWnd, LPDIRECT3DDEVICE9 pd3dDevice, D3DFORMAT backBufferFormat )
{
	SafeRelease( &m_pd3dChain );
//	CMainFrame *pMainFrm = g_pMainFrm;
    
	m_hWnd = hWnd;
	D3DPRESENT_PARAMETERS d3dpp;
	ZeroMemory( &d3dpp, sizeof(d3dpp) );
	d3dpp.Windowed = TRUE;
	d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;
	// Use the current display mode.
//	d3dpp.BackBufferFormat = g_pMainFrm->m_d3dpp.BackBufferFormat;
	d3dpp.BackBufferFormat = backBufferFormat;
	// m_hWnd contains child window handle
	d3dpp.hDeviceWindow=m_hWnd;
	// m_pSwapChain is IDirect3DSwapChain *
	HRESULT hr = pd3dDevice->CreateAdditionalSwapChain( &d3dpp, &m_pd3dChain );
	// Store render target surface desc
	LPDIRECT3DSURFACE9 pBackBuffer = NULL;
//	XBREAK( m_pd3dChain == NULL );
	if( m_pd3dChain )
	{
		m_pd3dChain->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
		pBackBuffer->GetDesc( &m_d3dsdBackBuffer );
		pBackBuffer->Release();
	}
	return S_OK;
}
开发者ID:xahgo,项目名称:tama,代码行数:28,代码来源:d3dView.cpp

示例5: DrawSurface

//************************************************************
//	Function:	DrawSurface
//	Vars:	dest	-	The destination surface to draw to
//			x	-	The location in the destination to draw to
//			y	
//			source -	The source image to draw from
//	Process:	This draws from a source surface area to a specific
//			 locatio in the destination
//	Returns:	None
//************************************************************
void DirectX::DrawSurface(
							LPDIRECT3DSURFACE9	dest,
							float			x, 
							float			y, 
							LPDIRECT3DSURFACE9	source
					)
{
    D3DSURFACE_DESC				desc;									//Describes surface information
    source->GetDesc			(	&desc);									//get width/height data from source

    RECT						source_rect	=	{						//Source rect to use in drawing
												0,					//	x position
												0,					//	y position
												desc.Width,			//	image width
												desc.Height			//	image height
											};					    
    RECT						dest_rect		=	{						//Dest rect to use in drawing
												x,					//	x position to draw to
												y,					//	y position to draw to		
												x+desc.Width,			//	image width
												y+desc.Height			//	image height
											};				
   
    d3ddev->StretchRect		(											//Draw from source using source rect
																	// Size to dest using dest rect size
							source,									//	source texture
							&source_rect,								//	source size
							dest,									//	dest texture
							&dest_rect,								//	dest size
							D3DTEXF_NONE								//	No Texture filter								
						);
}
开发者ID:tj10200,项目名称:Simple-Soccer,代码行数:42,代码来源:DirectX.cpp

示例6:

// Figure out if we can render some puff or not (note that this is state dependent), 
//	I'm assuming it called with the render states set as they will be during rendering...
void CD3D_Device::PreCalcSomeDeviceCaps()
{
	if (!m_pD3DDevice) return;

	// Figure out if we can do specular highlights on models.
//	ModelSpecularStateBackup stateBackup;
//	SetModelSpecularStates(&stateBackup); unsigned long nPasses = 0;
//	m_ExtraDevCaps.m_bModelSpecularCapable = (m_pD3DDevice->ValidateDevice((unsigned long*)&nPasses) == D3D_OK);
//	UnsetModelSpecularStates(&stateBackup);

//	SetDetailTextureStates();
//	m_ExtraDevCaps.m_bDetailTextureCapable = (m_pD3DDevice->ValidateDevice((unsigned long*)&nPasses) == D3D_OK);
//	if (m_DeviceCaps.MaxSimultaneousTextures < 2) { m_ExtraDevCaps.m_bDetailTextureCapable = false; }
//	UnsetDetailTextureStates();

	// Check for stencil buffer & get the format...
	LPDIRECT3DSURFACE9 pDepthStencilBuffer = NULL;
	m_pD3DDevice->GetDepthStencilSurface(&pDepthStencilBuffer);
	if (pDepthStencilBuffer) 
	{
		D3DSURFACE_DESC SurfDesc; 
		pDepthStencilBuffer->GetDesc(&SurfDesc);
		m_ExtraDevCaps.m_DepthStencilBufferFormat = SurfDesc.Format; uint32 iZDepth,iStencilDepth;
		d3d_GetDepthStencilBits(m_ExtraDevCaps.m_DepthStencilBufferFormat,iZDepth,iStencilDepth);
		m_ExtraDevCaps.m_bHasZBuffer			  = (iZDepth>0		 ? true : false);
		m_ExtraDevCaps.m_bHasStencilBuffer		  = (iStencilDepth>0 ? true : false);
		int iRefCnt = pDepthStencilBuffer->Release(); 
	}
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:31,代码来源:d3d_device.cpp

示例7: Draw

void Render::Draw(IDirect3DSurface9* renderTarget, D3DXMATRIX* view, D3DXMATRIX* projection)
{
    // Get or create device
    LPDIRECT3DDEVICE9 device = GetDevice();
    if (device == NULL) return;

    // Load shaders if it is required
//    if (!EnsureShaders()) return;

    // Prepare depth surface
    D3DSURFACE_DESC renderTargetDescription;
    renderTarget->GetDesc(&renderTargetDescription);
    D3DSURFACE_DESC depthSurfaceDescription;
    if (depthSurface != NULL) depthSurface->GetDesc(&depthSurfaceDescription);
    if (depthSurface == NULL || depthSurfaceDescription.Width != renderTargetDescription.Width || depthSurfaceDescription.Height != renderTargetDescription.Height)
    {
        if (depthSurface != NULL) depthSurface->Release();
        device->CreateDepthStencilSurface(renderTargetDescription.Width, renderTargetDescription.Height, D3DFMT_D24X8, D3DMULTISAMPLE_NONE, 0, FALSE, &depthSurface, NULL);
        if (depthSurface == NULL) return;
    }

    device->SetRenderTarget(0, renderTarget);
    device->SetDepthStencilSurface(depthSurface);
    device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0);

    if (lowPolySphere == NULL)
    {
        // Create spheres
        lowPolySphere = CreateSphere(2);
        middlePolySphere = CreateSphere(3);
        highPolySphere = CreateSphere(5);
        // Create cylinders
        lowPolyCylinder = CreateCylinder(3);
        middlePolyCylinder = CreateCylinder(12);
        highPolyCylinder = CreateCylinder(24);
    }



    // FIXME: light dir must be slightly different!
    D3DVECTOR lightDirection;
    lightDirection.x = view->_13;
    lightDirection.y = view->_23;
    lightDirection.z = view->_33;
    D3DVECTOR viewDirection;
    viewDirection.x = view->_13;
    viewDirection.y = view->_23;
    viewDirection.z = view->_33;
    elementMaterials[0].SetViewLightDirection(&viewDirection, &lightDirection);

    // Rendering
    device->BeginScene();


    DrawAtoms(view, projection);
    DrawBonds(view, projection);
    DrawResidues(view, projection);

    device->EndScene();
}
开发者ID:AnthonyNystrom,项目名称:NuGenBioChemDX,代码行数:60,代码来源:Render.cpp

示例8: sizeof

//	I'm assuming it called with the render states set as they will be during rendering...
void CD3D_Device::PreCalcSomeDeviceCaps()
{
	if (!m_pD3DDevice)
		return;

	// Fix some issues on ATI cards
	if( m_pAdapter->AdapterID.VendorId == 0x1002 )
	{
		g_pStruct->RunConsoleString( "Use0WeightsForDisable 1" );
	}

	// Check for TableFog...
	if ((m_DeviceCaps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && ((m_DeviceCaps.RasterCaps & D3DPRASTERCAPS_ZFOG) || (m_DeviceCaps.RasterCaps & D3DPRASTERCAPS_WFOG)) && g_CV_TableFog.m_Val)
	{
		m_ExtraDevCaps.m_bUsingTableFog = true;
	}
	else
	{
		m_ExtraDevCaps.m_bUsingTableFog = false;
	}

	// Check for stencil buffer & get the format...
	LPDIRECT3DSURFACE9 pDepthStencilBuffer = NULL;
	D3D_CALL(m_pD3DDevice->GetDepthStencilSurface(&pDepthStencilBuffer));
	if (pDepthStencilBuffer)
	{
		D3DSURFACE_DESC SurfDesc;	// SurfDesc.Size   = sizeof(SurfDesc);
		D3D_CALL(pDepthStencilBuffer->GetDesc(&SurfDesc));
		m_ExtraDevCaps.m_DepthStencilBufferFormat = SurfDesc.Format; uint32 iZDepth,iStencilDepth;
		d3d_GetDepthStencilBits(m_ExtraDevCaps.m_DepthStencilBufferFormat,iZDepth,iStencilDepth);
		m_ExtraDevCaps.m_bHasStencilBuffer = (iStencilDepth>0 ? true : false);
		int iRefCnt	= pDepthStencilBuffer->Release();
	}
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:35,代码来源:d3d_device.cpp

示例9: UpdateSize

		void teTexture::UpdateSize()
		{
			LPDIRECT3DSURFACE9 surface;
			texture->GetSurfaceLevel(0, &surface);

			D3DSURFACE_DESC desc;
			surface->GetDesc(&desc);
			size.x = desc.Width;
			size.y = desc.Height;

			surface->Release();
		}
开发者ID:EvgeniyRudnev,项目名称:tatengine,代码行数:12,代码来源:teTexture.cpp

示例10: DrawSurface

/*This function will draw a SURFACE object. It takes the source(the object we want to draw)
  grabs the dimensions, creates a RECT for the source, RECT for the destination(this is where our
  source RECT will be drawn) then uses StretchRect to put our source into destination*/
void DrawSurface(LPDIRECT3DSURFACE9 dest, float x, float y, LPDIRECT3DSURFACE9 source) {
	//get width and height of the source rectangle
	D3DSURFACE_DESC desc;
	source->GetDesc(&desc);

	//create rects for both
	RECT sourceRect = { 0,0,(long)desc.Width,(long)desc.Height };
	RECT destRect = { (long)x,(long)y,(long)x + desc.Width,(long)y + desc.Height };

	//draw the surface onto the destination
	d3ddev->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_NONE);
}
开发者ID:ICEentertainment,项目名称:Project1,代码行数:15,代码来源:MyDirectX.cpp

示例11: CreateTextureFromSurface

HRESULT VertexObject::CreateTextureFromSurface(LPDIRECT3DSURFACE9 pSurface, RECT* pSrcRect, RECT* pDestRect, LPDIRECT3DTEXTURE9* ppTexture)
{
	int width, height;
	RECT Src;
	D3DSURFACE_DESC surfDesc;
	pSurface->GetDesc(&surfDesc);

	if( !pSrcRect )
	{
		width = surfDesc.Width;
		height = surfDesc.Height;
		Src.left = Src.top = 0;
		Src.right = width;
		Src.bottom = height;
	}
	else
	{
		width = pSrcRect->right - pSrcRect->left; // + 1;
		height = pSrcRect->bottom - pSrcRect->top; // + 1;
		Src = *pSrcRect;
	}

	D3DXCreateTexture(DDevice, width, height, 
	1, 0, surfDesc.Format, D3DPOOL_DEFAULT, ppTexture) ;

	// Retrieve the surface image of the texture.
	LPDIRECT3DSURFACE9 pTexSurface;
	LPDIRECT3DTEXTURE9 pTexture = *ppTexture;
	pTexture->GetLevelDesc(0, &surfDesc);
	pTexture->GetSurfaceLevel(0, &pTexSurface);

	// Create a clean surface to clear the texture with.
	LPDIRECT3DSURFACE9 pCleanSurface;
	D3DLOCKED_RECT lockRect;
	DDevice->CreateOffscreenPlainSurface(
	surfDesc.Width, surfDesc.Height, surfDesc.Format, D3DPOOL_DEFAULT, &pCleanSurface, NULL);
	pCleanSurface->LockRect(&lockRect, NULL, 0) ;
	memset((BYTE*)lockRect.pBits, 0, surfDesc.Height * lockRect.Pitch);
	pCleanSurface->UnlockRect() ;

	DDevice->UpdateSurface(pCleanSurface, NULL, pTexSurface, NULL);
	pCleanSurface->Release();

	// Copy the image to the texture.
	POINT destPoint = { 0, 0 };
	DDevice->UpdateSurface(pSurface, &Src, pTexSurface, &destPoint);
	pTexSurface->Release();

	return S_OK;
}
开发者ID:vdoom,项目名称:GAM,代码行数:50,代码来源:VertexObject.cpp

示例12: exception

D3DSURFACE_DESC RenderWin32DX9Imp::getRenderTargetDesc() {
    LPDIRECT3DSURFACE9 currentRenderTarget = NULL;
    const HRESULT hr = getD3D9Device()->GetRenderTarget( 0, & currentRenderTarget );
    if( FAILED( hr ) ) {
        DXUT_ERR( L"RenderWin32DX9Imp::getHeight", hr );
        throw exception();
    }

    D3DSURFACE_DESC desc;
    currentRenderTarget->GetDesc( & desc );
    SAFE_RELEASE( currentRenderTarget );

    return desc;
}
开发者ID:simonfosh,项目名称:mybilliard01,代码行数:14,代码来源:RenderWin32DX9Imp.cpp

示例13: DrawSurface

void DrawSurface(LPDIRECT3DSURFACE9 dest, float x, float y, LPDIRECT3DSURFACE9 source)
{
    //get width/height from source surface
    D3DSURFACE_DESC desc;
    source->GetDesc(&desc);

    //create rects for drawing
    RECT source_rect = {0, 0, (long)desc.Width, (long)desc.Height };
    RECT dest_rect = { (long)x, (long)y, (long)x+desc.Width, (long)y+desc.Height};
    
    //draw the source surface onto the dest
    d3ddev->StretchRect(source, &source_rect, dest, &dest_rect, D3DTEXF_NONE);

}
开发者ID:kyphelps,项目名称:spring-2013,代码行数:14,代码来源:MyDirectX.cpp

示例14: restore_objects

	bool restore_objects()
	{
		if ( retry_count )
		{
			if ( --retry_count ) return false;

			release_objects();
			if ( lpdev->Reset( &dpp ) != D3D_OK ) return false;
		}

		retry_count = 0;

		LPDIRECT3DSURFACE9 lpbb;
		HRESULT hr;
		if( SUCCEEDED( hr = lpdev->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, & lpbb ) ) ) {
			lpbb->GetDesc( & d3dsd );
			lpbb->Release();
		}

		lpdev->SetTextureStageState(0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1);
		lpdev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
		lpdev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);

		lpdev->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1);
		lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
		lpdev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);

		lpdev->SetRenderState(D3DRS_LIGHTING, false);
		lpdev->SetRenderState(D3DRS_ZENABLE,  false);
		lpdev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

		lpdev->SetRenderState(D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA);
		lpdev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
		lpdev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);

		lpdev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);

		if ( lpdev->CreateVertexBuffer( sizeof(d3dvertex) * 4, flags.v_usage, D3DFVF_XYZRHW | D3DFVF_TEX1, (D3DPOOL)flags.v_pool, &lpvbuf, NULL ) != D3D_OK )
			return false;

		update_filtering( 1 );

		lpdev->SetRenderState( D3DRS_DITHERENABLE,   TRUE );

		if ( lpdev->CreateTexture( surface_width, surface_height, 1, flags.t_usage, D3DFMT_X8R8G8B8, (D3DPOOL)flags.t_pool, &lptex, NULL ) != D3D_OK )
			return false;

		return true;
	}
开发者ID:kode54,项目名称:QuickNES_Windows,代码行数:49,代码来源:display_d3d9.cpp

示例15: drawSurface

/** Draw a surface to the screen given the source and destination surfaces; uses StretchRect
    x, y are the points you want to draw at (top-left of rectangle) 
	Note that this uses the size of the source surface to determine how big you want to draw */
void DirectXStuff::drawSurface(LPDIRECT3DSURFACE9 dest, float x, float y, LPDIRECT3DSURFACE9 source)
{
	//get width and height of source surface
	//useful so you only need to define source surface width / height when creating it rather than keeping track
	D3DSURFACE_DESC desc;
	source->GetDesc(&desc);

	//rectangles for drawing; note destination rectangle is equal size to source rectangle
	//apparently you can define them like enum; are they structs?
	RECT source_rect = {0, 0, (long)desc.Width, (long)desc.Height};
	RECT dest_rect = {(long)x, (long)y, (long)x + desc.Width, (long)y + desc.Height};

	//draw the source surface on to the destination
	d3ddev->StretchRect(source, &source_rect, dest, &dest_rect, D3DTEXF_NONE);	
}//end drawSurface
开发者ID:thawhtaik,项目名称:Battle-of-Fight-War,代码行数:18,代码来源:DirectXStuff.cpp


注:本文中的LPDIRECT3DSURFACE9::GetDesc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。