コード例 #1
0
void CreateD3DDevice()
{
	ZeroMemory( &g_D3DParams, sizeof( g_D3DParams ) );

	RECT ClientRect;
	GetClientRect( g_pHWND, &ClientRect );

	g_D3DParams.Windowed = TRUE;
	g_D3DParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
	g_D3DParams.BackBufferWidth = ClientRect.right;
	g_D3DParams.BackBufferHeight = ClientRect.bottom;
	g_D3DParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
	g_D3DParams.BackBufferFormat = D3DFMT_X8R8G8B8;
	//g_D3DParams.EnableAutoDepthStencil = TRUE;
	//g_D3DParams.AutoDepthStencilFormat = D3DFMT_D24S8;
	g_D3DParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

	HRESULT hr = g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_pHWND, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &g_D3DParams, &g_pD3DDevice );
	if ( FAILED(hr) )
	{
		OutputDebugString( DXGetErrorDescription( hr ) );
		return;
	}
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Name: InitD3D()
// Desc: Initializes Direct3D
//-----------------------------------------------------------------------------
HRESULT InitD3D( HWND hWnd )
{
    // Create the D3D object.
    if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
        return E_FAIL;

    // Set up the structure used to create the D3DDevice. Since we are now
    // using more complex geometry, we will create a device with a zbuffer.
    D3DPRESENT_PARAMETERS d3dpp;
    //ZeroMemory( &d3dpp, sizeof( d3dpp ) );
	vp_os_memset(&d3dpp, 0, sizeof( d3dpp ));
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
    d3dpp.EnableAutoDepthStencil = TRUE;
    d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

    // Create the D3DDevice
    if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
                                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                      &d3dpp, &g_pd3dDevice ) ) )
    {
        return E_FAIL;
    }

    // Turn off culling
    g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

    // Turn off D3D lighting
    g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );

    // Turn on the zbuffer
    g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );

    return S_OK;
}
コード例 #3
0
ファイル: Main.cpp プロジェクト: BillyKim/directxcode
HRESULT InitD3D( HWND hWnd )
{
    // Create the D3D object, which is needed to create the D3DDevice.
    if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
    {
        MessageBoxA(NULL, "Create D3D9 object failed!", "Error", 0) ;
        return E_FAIL;
    }

    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory( &d3dpp, sizeof(d3dpp) );

    d3dpp.Windowed = TRUE; // use window mode, not full screen
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;

    // Create device
    if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
                                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                      &d3dpp, &g_pd3dDevice ) ) )
    {
        MessageBoxA(NULL, "Create D3D9 device failed!", "Error", 0) ;
        return E_FAIL;
    }

    // Disable lighting, since we didn't specify color for vertex
    g_pd3dDevice->SetRenderState( D3DRS_LIGHTING , FALSE );

    // Create teapot
    D3DXCreateTeapot(g_pd3dDevice, &g_pMesh, NULL) ;

    // Create camera
    g_Camera = new FirstPersonViewCamera() ;

    return S_OK;
}
コード例 #4
0
ファイル: Converter.cpp プロジェクト: jsj2008/blog-source
void Cleanup()
{
    if (g_pMeshMaterials)
        delete[] g_pMeshMaterials;

    if (g_pMeshTextures)
    {
        for (DWORD i = 0; i < g_dwNumMaterials; i++)
        {
            if (g_pMeshTextures[i])
                g_pMeshTextures[i]->Release();
        }
        delete[] g_pMeshTextures;
    }

    if (g_pMesh)
        g_pMesh->Release();

    if (g_pd3dDevice)
        g_pd3dDevice->Release();

    if (g_pD3D)
        g_pD3D->Release();
}
コード例 #5
0
ファイル: Main.cpp プロジェクト: junglek/DirectX-Basic
///Create Direct3D Device
HRESULT initD3D(HWND hWnd){

	if(NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
		return E_FAIL;
	D3DPRESENT_PARAMETERS d3dpp;
	ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS));
	d3dpp.Windowed = TRUE;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
	d3dpp.EnableAutoDepthStencil = TRUE;
	d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

	if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
		D3DCREATE_HARDWARE_VERTEXPROCESSING,
		&d3dpp, &g_pDevice ) ) ){
			return E_FAIL;
	}

	g_pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
	g_pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);//default is open

	setupViewProjMatrix();
	return S_OK;
}
コード例 #6
0
ファイル: d2.cpp プロジェクト: anokata/AllInOne
// this function initializes and prepares Direct3D for use
void initD3D(HWND hWnd)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION);

    D3DPRESENT_PARAMETERS d3dpp;

    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.hDeviceWindow = hWnd;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferWidth = SCREEN_WIDTH;
    d3dpp.BackBufferHeight = SCREEN_HEIGHT;

    // create a device class using this information and the info from the d3dpp stuct
    d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      D3DDEVTYPE_HAL,
                      hWnd,
                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &d3dpp,
                      &d3ddev);

    init_graphics();    // call the function to initialize the triangle
}
コード例 #7
0
ファイル: ACW1.cpp プロジェクト: dimivogi/MSC.skullShaders
//-----------------------------------------------------------------------------
// Name: Cleanup()
// Desc: Releases all previously initialized objects
//-----------------------------------------------------------------------------
VOID Cleanup()
{
	// release all textures used
	if ( g_pTexture != NULL )
		g_pTexture->Release();

	if ( g_pTexture2 != NULL )
		g_pTexture2->Release();

	if ( marbleTexture != NULL )
		marbleTexture->Release();

	if ( backgroundTexture != NULL )
		backgroundTexture->Release();

	if( g_pMeshMaterials != NULL ) 
		delete[] g_pMeshMaterials;

	if( g_pMeshTextures )
	{
		for( DWORD i = 0; i < g_dwNumMaterials; i++ )
		{
			if( g_pMeshTextures[i] )
				g_pMeshTextures[i]->Release();
		}
		delete[] g_pMeshTextures;
	}
	if( g_pMesh != NULL )
		g_pMesh->Release();

	if( g_pd3dDevice != NULL )
		g_pd3dDevice->Release();

	if( g_pD3D != NULL )
		g_pD3D->Release();
}
コード例 #8
0
ファイル: MyDirectX.cpp プロジェクト: kyphelps/spring-2013
bool Direct3D_Init(HWND window, int width, int height, bool fullscreen)
{
    //initialize Direct3D
    d3d = Direct3DCreate9(D3D_SDK_VERSION);
    if (!d3d) return false;

    //set Direct3D presentation parameters
    D3DPRESENT_PARAMETERS d3dpp; 
    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.hDeviceWindow = window;
    d3dpp.Windowed = (!fullscreen);
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.EnableAutoDepthStencil = 1;
    d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
    d3dpp.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
    d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferCount = 1;
    d3dpp.BackBufferWidth = width;
    d3dpp.BackBufferHeight = height;

    //create Direct3D device
    d3d->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
        D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev);
    if (!d3ddev) return false;


    //get a pointer to the back buffer surface
    d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);


    //create sprite object
    D3DXCreateSprite(d3ddev, &spriteobj);

    return 1;
}
コード例 #9
0
ファイル: Main.cpp プロジェクト: junglek/DirectX-Basic
VOID cleanup(){
	if(g_pMeshMaterials != NULL)
		delete [] g_pMeshMaterials;

	if(g_pMeshTextures){
		for(DWORD i=0; i<g_dwNumMaterials; ++i){
			if(g_pMeshTextures[i])
				g_pMeshTextures[i]->Release();
		}
		delete [] g_pMeshTextures;
	}

	if(g_pMesh != NULL)
		g_pMesh->Release();

	if(g_pShutter != NULL)
		g_pShutter->Release();

	if(g_pDevice != NULL)
		g_pDevice->Release();

	if(g_pD3D != NULL)
		g_pD3D->Release();
}
コード例 #10
0
HRESULT InitD3D( HWND hWnd )
{
    g_pD3D = Direct3DCreate9( D3D_SDK_VERSION );

    if( !g_pD3D ) return E_FAIL;

    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory( &d3dpp, sizeof(d3dpp) );
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;

    if( FAILED( g_pD3D->CreateDevice( 
                    D3DADAPTER_DEFAULT,
                    D3DDEVTYPE_HAL,
                    hWnd,
                    D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                    &d3dpp, &g_pd3dDevice ) ) )
    {
        return E_FAIL;
    }

    return S_OK;
}
コード例 #11
0
//-----------------------------------------------------------------------------
// Name: Cleanup()
// Desc: Releases all previously initialized objects
//-----------------------------------------------------------------------------
VOID Cleanup()
{
	if( g_pMeshMaterials != NULL )
		delete[] g_pMeshMaterials;
	if( g_pMeshMaterials2 != NULL )
		delete[] g_pMeshMaterials2;

	if( g_pMeshTextures )
	{
		for( DWORD i = 0; i < g_dwNumMaterials; i++ )
		{
			if( g_pMeshTextures[i] )
				g_pMeshTextures[i]->Release();
		}
		delete[] g_pMeshTextures;
	}
	if( g_pMeshTextures2 )
	{
		for( DWORD i = 0; i < g_dwNumMaterials2; i++ )
		{
			if( g_pMeshTextures2[i] )
				g_pMeshTextures2[i]->Release();
		}
		delete[] g_pMeshTextures2;
	}
	if( g_pMesh != NULL )
		g_pMesh->Release();
	
	if( g_pMesh2 != NULL )
		g_pMesh2->Release();
	if( g_pd3dDevice != NULL )
		g_pd3dDevice->Release();

	if( g_pD3D != NULL )
		g_pD3D->Release();
}
コード例 #12
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CreateDevice(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface)
{

	LOG_API();
#if 1
	HRESULT res = 0;
#if 0
	if (configMgr.GetConfig(TTX_CONFIG_WINDOWED))
	{

		D3DPRESENT_PARAMETERS d3dpp;
		RECT rect;

		ShowWindow(hFocusWindow, SW_HIDE);
		GetClientRect(hFocusWindow, &rect);
		AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
		SetWindowLong(hFocusWindow, GWL_STYLE, WS_OVERLAPPEDWINDOW);
		SetWindowPos(hFocusWindow, HWND_TOPMOST, 100, 100, rect.right, rect.bottom, SWP_FRAMECHANGED | SWP_NOCOPYBITS);
		ShowWindow(hFocusWindow, SW_SHOWNORMAL);
		ShowCursor(TRUE);
		InvalidateRect(hFocusWindow, NULL, TRUE);

		logmsg("--%d,%d,%d,%d\n", rect.left,rect.top,rect.right,rect.bottom);

		ZeroMemory(&d3dpp, sizeof(d3dpp));


		GetClientRect(pPresentationParameters->hDeviceWindow, &rect);

		logmsg("Area = %d,%d\n", pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);
		d3dpp.BackBufferHeight = pPresentationParameters->BackBufferHeight;
		d3dpp.BackBufferWidth = pPresentationParameters->BackBufferWidth;
		d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
		d3dpp.BackBufferFormat = pPresentationParameters->BackBufferFormat;
		d3dpp.BackBufferCount = pPresentationParameters->BackBufferCount;
		d3dpp.Windowed = TRUE;
		d3dpp.hDeviceWindow = NULL;//pPresentationParameters->hDeviceWindow;
		d3dpp.FullScreen_RefreshRateInHz = 0;
		d3dpp.PresentationInterval = pPresentationParameters->PresentationInterval;
		d3dpp.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
		d3dpp.Flags = pPresentationParameters->Flags;
		d3dpp.EnableAutoDepthStencil = TRUE;


		res = pD3D->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, &d3dpp, &pD3Dev);
	} else 
#endif
		logmsg("RES %dx%d\n", pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);
		//pPresentationParameters->BackBufferWidth = 1920;
		//pPresentationParameters->BackBufferHeight = 1080;
		res = pD3D->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, &pD3Dev);
	if (FAILED(res)) {
		logmsg("Err = %X\n", res);
		MessageBox(hFocusWindow, DXGetErrorDescriptionA(res), "Erro Direct3D", MB_OK);
		*ppReturnedDeviceInterface = NULL;
	} else {
		*ppReturnedDeviceInterface = (IDirect3DDevice9*) pD3DevWrapper;
	}

	return res;
#else
	return pD3D->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
#endif
}
コード例 #13
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HMONITOR HookIDirect3D9::GetAdapterMonitor(LPVOID _this, UINT Adapter)
{
	LOG_API();
	return pD3D->GetAdapterMonitor(Adapter);
}
コード例 #14
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::GetDeviceCaps(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps)
{
	LOG_API();
	return pD3D->GetDeviceCaps(Adapter, DeviceType, pCaps);
}
コード例 #15
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CheckDeviceFormatConversion(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat)
{
	LOG_API();
	return pD3D->CheckDeviceFormatConversion(Adapter, DeviceType, SourceFormat, TargetFormat);
}
コード例 #16
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::GetAdapterDisplayMode(LPVOID _this, UINT Adapter,D3DDISPLAYMODE* pMode)
{
	LOG_API();
	return pD3D->GetAdapterDisplayMode(Adapter, pMode);
}
コード例 #17
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
UINT HookIDirect3D9:: GetAdapterModeCount(LPVOID _this, UINT Adapter,D3DFORMAT Format)
{
	LOG_API();
	return pD3D->GetAdapterModeCount(Adapter, Format);
}
コード例 #18
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
UINT HookIDirect3D9:: GetAdapterCount(LPVOID _this)
{
	LOG_API();
	return pD3D->GetAdapterCount();
}
コード例 #19
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
ULONG HookIDirect3D9::Release(LPVOID _this)
{
	LOG_API();
	return pD3D->Release();
}
コード例 #20
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::QueryInterface(LPVOID _this, REFIID riid,LPVOID *ppvObj)
{
	LOG_API();
	return pD3D->QueryInterface(riid, ppvObj);
}
コード例 #21
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
ULONG HookIDirect3D9::AddRef(LPVOID _this)
{
	LOG_API();
	return pD3D->AddRef();
}
コード例 #22
0
bool InitialiseDirectX()
{
    const D3DFORMAT backBufferFormat = D3DFMT_D16;
    const D3DFORMAT textureFormat = D3DFMT_A8R8G8B8;

    if(FAILED(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
    {
        ShowMessageBox("Direct3D interface creation has failed");
        return false;
    }

    // Build present params
    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory(&d3dpp, sizeof(d3dpp));

    D3DMULTISAMPLE_TYPE antiAliasingLvl;
    bool antiAliasing = false;
    if(SUCCEEDED(d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, 
        D3DDEVTYPE_HAL, textureFormat, true, D3DMULTISAMPLE_2_SAMPLES, nullptr)))
    {
        d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
        antiAliasingLvl = D3DMULTISAMPLE_2_SAMPLES;
        antiAliasing = true;
    }

    d3dpp.hDeviceWindow = hWnd;
    d3dpp.Windowed = true;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = textureFormat;
    d3dpp.BackBufferWidth = WINDOW_WIDTH; 
    d3dpp.BackBufferHeight = WINDOW_HEIGHT;
    d3dpp.EnableAutoDepthStencil = TRUE;
    d3dpp.AutoDepthStencilFormat = backBufferFormat; 

    if(FAILED(d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, 
        D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3ddev)))
    {
        ShowMessageBox("Direct3D interface creation has failed");
        return false;
    }

    // Create Z-buffer
    if(FAILED(d3ddev->CreateDepthStencilSurface(WINDOW_WIDTH, WINDOW_HEIGHT, backBufferFormat,
        antiAliasing ? antiAliasingLvl : D3DMULTISAMPLE_NONE, NULL, TRUE, &backBuffer, NULL)))
    {
        ShowMessageBox("Z-buffer creation has failed");
        return false;
    }
    d3ddev->SetRenderTarget(0,backBuffer);

    // Set render states
    d3ddev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, antiAliasing);

    // Check shader capabilities
    D3DCAPS9 caps;
    d3ddev->GetDeviceCaps(&caps);

    // Check for vertex shader version 2.0 support.
    if(caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) 
    {
        ShowMessageBox("Shader model 2.0 or higher is required");
        return false;
    }

    return true;
}
コード例 #23
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::RegisterSoftwareDevice(LPVOID _this, void* pInitializeFunction)
{
	LOG_API();
	return pD3D->RegisterSoftwareDevice(pInitializeFunction);
}
コード例 #24
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CheckDeviceType(LPVOID _this, UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed)
{
	LOG_API();
	return pD3D->CheckDeviceType(Adapter, DevType, AdapterFormat, BackBufferFormat, bWindowed);
}
コード例 #25
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::GetAdapterIdentifier(LPVOID _this, UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier)
{
	LOG_API();
	return pD3D->GetAdapterIdentifier(Adapter, Flags, pIdentifier);
}
コード例 #26
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CheckDeviceFormat(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat)
{
	LOG_API();
	return pD3D->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat);
}
コード例 #27
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::EnumAdapterModes(LPVOID _this, UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode)
{
	LOG_API();
	return pD3D->EnumAdapterModes(Adapter, Format, Mode, pMode);
}
コード例 #28
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CheckDeviceMultiSampleType(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels)
{
	LOG_API();
	return pD3D->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels);
}
コード例 #29
0
ファイル: main.cpp プロジェクト: emadurandal/Effekseer
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void InitWindow()
{
	WNDCLASS wndClass;
	wchar_t szClassNme[]      =  L"RuntimeSample";
	wndClass.style         = CS_HREDRAW | CS_VREDRAW;
	wndClass.lpfnWndProc   = WndProc;
	wndClass.cbClsExtra    = 0;
	wndClass.cbWndExtra    = 0;
	wndClass.hInstance     = GetModuleHandle(0);
	wndClass.hIcon         = NULL;
	wndClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	wndClass.lpszMenuName  = NULL;
	wndClass.lpszClassName = szClassNme;
	RegisterClass(&wndClass);
	g_window_handle = CreateWindow(
		szClassNme,
		L"RuntimeSample",
		WS_SYSMENU,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		g_window_width,
		g_window_height,
		NULL,
		NULL,
		GetModuleHandle(0),
		NULL);
	ShowWindow( g_window_handle, true );
	UpdateWindow( g_window_handle );
	
	// COMの初期化
	CoInitializeEx( NULL, NULL );

	// DirectX9の初期化を行う
	D3DPRESENT_PARAMETERS d3dp;
	ZeroMemory(&d3dp, sizeof(d3dp));
	d3dp.BackBufferWidth = g_window_width;
	d3dp.BackBufferHeight = g_window_height;
	d3dp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dp.BackBufferCount = 1;      
	d3dp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dp.Windowed = TRUE;
	d3dp.hDeviceWindow = g_window_handle;
	d3dp.EnableAutoDepthStencil = TRUE;
    d3dp.AutoDepthStencilFormat = D3DFMT_D16;

	g_d3d = Direct3DCreate9(D3D_SDK_VERSION);
	
	g_d3d->CreateDevice( 
		D3DADAPTER_DEFAULT,
		D3DDEVTYPE_HAL,
		g_window_handle,
		D3DCREATE_HARDWARE_VERTEXPROCESSING,
		&d3dp,
		&g_d3d_device );
	
	// XAudio2の初期化を行う
	XAudio2Create( &g_xa2 );

	g_xa2->CreateMasteringVoice( &g_xa2_master );
}
コード例 #30
0
ファイル: D3DWrapper.cpp プロジェクト: zxmarcos/bg4t_monitor
HRESULT HookIDirect3D9::CheckDepthStencilMatch(LPVOID _this, UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat)
{
	LOG_API();
	return pD3D->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
}