• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
bluepig.man

DX11
D3D11 Shader Compile error x3116 :flags parameter is invalid.

4 posts in this topic

Hi,l'm learning Direct 11 by <Introduction to 3D Game Programming with Direct 11>. 

An trouble error break out.

The Info is : error x3116:Flags parameter is invalid.This info break out when calling D3DX11CompileFromFile.

This happend may because the D3DX11CompileFromFile function's  wrong caling.l try to change the fx file and

 the code file,but the error still happend.

The file is here:

#include <windows.h>
#include <xnamath.h>
#include <cassert>
#include <d3dx11.h>
#include <dxerr.h>
#include "d3dx11Effect.h"

//---- Global Variable  ------------------------------------------------------------------------------------
	
	//Windows
	HINSTANCE				g_hinst				 = 0;
	HWND					g_hWnd				 = 0;
	LONG					g_ClientWidth		 = 800;
	LONG					g_ClientHeight		 = 600;

	//D3D
	ID3D11Device		   *g_D3dDevice			 = NULL;
	ID3D11DeviceContext	   *g_D3dDeviceContext   = NULL;
	IDXGISwapChain		   *g_SwapChain			 = NULL;
	ID3D11DepthStencilView *g_DepthStencilView   = NULL;
	ID3D11RenderTargetView *g_RenderTargetView   = NULL;
	ID3D11Texture2D        *g_DepthStencilBuffer = NULL;
	D3D11_VIEWPORT		   g_Vp;

	//Space
	XMMATRIX g_WorldViewProj;

	//Effect
	ID3DX11EffectTechnique *g_EffectTechnique	 = 0;
	ID3DX11Effect		   *g_Effect			 = 0;
	ID3D11InputLayout	   *g_InputLayout		 = 0;
	ID3D11Buffer		   *g_VertexBuffer		 = 0;
	ID3D11Buffer		   *g_IndexBuffer		 = 0;
	
	struct Vertex
	{
		XMFLOAT3 pos;
		XMFLOAT4 color;
	};


//---- Macro Define  ------------------------------------------------------------------------------------
	//HR define
	#if defined(DEBUG) | defined(_DEBUG)
	#ifndef HR
	#define HR(x)                                              \
	{                                                          \
		HRESULT hr = (x);                                      \
		if(FAILED(hr))                                         \
		{                                                      \
			DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true); \
		}                                                      \
	}
	#endif

	#else
	#ifndef HR
	#define HR(x) (x)
	#endif
	#endif

	#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
	#define KEYUP(vk_code)   ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
	#define ReleaseCOM(x)    { if(x){ x->Release(); x = 0;} }

//----Forward Declaration------------------------------------------------------------------------------------

	LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
	void onResizeAndInit();
	void BuildInputLayout();
	void BuildBuffer();
	void BuildFx();
	void DrawScreen();
	void ReleaseAll();
	bool Init_Window();
	bool Init_DX();
	bool Init();

//----Forward Implementation---------------------------------------------------------------------------------

	int WINAPI WinMain( _In_ HINSTANCE hInstance, 
						_In_opt_ HINSTANCE hPrevInstance, 
						_In_ LPSTR lpCmdLine, 
			 			_In_ int nShowCmd )
	{
		MSG msg = {0};
		g_hinst = hInstance;

		if( !Init() )
		{
			return FALSE;
		}

		while(msg.message != WM_QUIT)
		{
			// If there are Window messages then process them.
			if(PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
			{
				TranslateMessage( &msg );
				DispatchMessage( &msg );
			}
			// Otherwise, do animation/game stuff.	
			else
			{
				if( KEYDOWN(VK_ESCAPE) )
				{
					SendMessage(g_hWnd,WM_CLOSE,0,0);
					break;
				}
				DrawScreen();
			}
		}

		return (msg.wParam);
	}

	bool Init_Window( )
	{
		WNDCLASS wc;
		wc.style = CS_HREDRAW | CS_VREDRAW;
		wc.lpfnWndProc = WndProc;
		wc.cbClsExtra = 0;
		wc.cbWndExtra = 0;
		wc.hInstance = g_hinst;
		wc.hIcon = LoadIcon(0, IDI_APPLICATION);
		wc.hCursor = LoadCursor(0,IDC_ARROW);
		wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
		wc.lpszMenuName = 0;
		wc.lpszClassName = L"D3DWndClassName";

		if( !RegisterClass(&wc) )
		{
			MessageBox( 0, L"ResiterClass Failed.", 0, 0 );
			return false;
		}

		RECT R = { 0, 0, g_ClientWidth, g_ClientHeight };
		AdjustWindowRect( &R, WS_OVERLAPPEDWINDOW, false );

		int width = R.right - R.left;
		int height = R.bottom - R.top;

		g_hWnd = CreateWindow( L"D3DWndClassName", L"createMyWindow", WS_OVERLAPPEDWINDOW, 
								  CW_USEDEFAULT, CW_USEDEFAULT, width, height, 
								  0, 0, g_hinst, 0);

		if( !g_hWnd )
		{
			MessageBox( 0, L"CreateWindow Failed! beijule", 0, 0 );
			return false;
		}

		ShowWindow( g_hWnd, SW_SHOW );
		UpdateWindow( g_hWnd );

		return true;
	}

	bool Init()
	{
		if( !Init_Window() )
		{
			return false;
		}
		if( !Init_DX() )
		{
			return false;
		}

		memset(&g_Vp, 0, sizeof(D3D11_VIEWPORT));
		g_WorldViewProj = XMMatrixIdentity();

		BuildFx();
		BuildBuffer();
		BuildInputLayout();
		return true;
	}

	bool Init_DX()
	{
		HRESULT hr;

		D3D_FEATURE_LEVEL FeatureLevelUsed;		
		HR( D3D11CreateDevice( 0, D3D_DRIVER_TYPE_HARDWARE, 0,
								D3D11_CREATE_DEVICE_DEBUG, 0,
								0, D3D11_SDK_VERSION,
								&g_D3dDevice, &FeatureLevelUsed ,&g_D3dDeviceContext));

		if( FeatureLevelUsed != D3D_FEATURE_LEVEL_11_0 )
		{
			MessageBox( NULL, L"Unsupport d3d11", NULL, NULL );
			return false;
		}

		//Now,prepare for create swapchain
		DXGI_SWAP_CHAIN_DESC sd;
		sd.BufferCount = 1;
		sd.BufferDesc.Height = g_ClientHeight;
		sd.BufferDesc.Width  = g_ClientWidth;
		sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
		sd.BufferDesc.RefreshRate.Numerator = 60;
		sd.BufferDesc.RefreshRate.Denominator = 1;
		sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
		sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
		sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
		sd.OutputWindow = g_hWnd;
		sd.Windowed = true;
		sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
		sd.SampleDesc.Count = 1;
		sd.SampleDesc.Quality = 0;
		sd.Flags = 0;

		IDXGIDevice *dxgiDevice = 0;
		hr = g_D3dDevice->QueryInterface( __uuidof( IDXGIDevice ), (void **)&dxgiDevice );
		if( FAILED(hr) )
		{
			MessageBox( NULL, L"Retrive DXGIDEVICE failed  ", NULL, NULL );
			return false;
		}

		IDXGIAdapter *dxgiAdapter = 0;
		hr = dxgiDevice->GetParent( __uuidof( IDXGIAdapter ), (void **)&dxgiAdapter );
		if( FAILED(hr) )
		{
			MessageBox( NULL, L"Retrive DXGIADAPTER failed  ", NULL, NULL );
			return false;
		}

		IDXGIFactory *dxgiFactory = 0;
		hr = dxgiAdapter->GetParent( __uuidof( IDXGIFactory ), (void **)&dxgiFactory );
		if( FAILED(hr) )
		{
			MessageBox( NULL, L"Retrive DXGIFACTORY failed  ", NULL, NULL );
			return false;
		}

		//Now it's the time to create swapchain
		hr = dxgiFactory->CreateSwapChain( g_D3dDevice, &sd, &g_SwapChain );
		dxgiFactory->MakeWindowAssociation( g_hWnd, DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_PRINT_SCREEN);
		if( FAILED(hr) )
		{
			MessageBox( NULL, L"Create SwapChain failed  ", NULL, NULL );
			return false;
		}

		//After Create SwapChain,we should release our acquired COM interfaces
		ReleaseCOM( dxgiDevice );
		ReleaseCOM( dxgiAdapter );
		ReleaseCOM( dxgiFactory );

		onResizeAndInit();
	}

	void onResizeAndInit()
	{
		assert( g_D3dDeviceContext );
		assert( g_D3dDevice ); 
		assert( g_SwapChain );

		ReleaseCOM(g_RenderTargetView);
		ReleaseCOM(g_DepthStencilView);
		ReleaseCOM(g_DepthStencilBuffer);

		HR( g_SwapChain->ResizeBuffers( 1, g_ClientWidth, g_ClientHeight, DXGI_FORMAT_R8G8B8A8_UNORM, 0) );
		ID3D11Texture2D *backBuffer = 0;
		HR( g_SwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast<void **>(&backBuffer) )) ;
		HR( g_D3dDevice->CreateRenderTargetView( backBuffer, 0, &g_RenderTargetView ) );
		ReleaseCOM(backBuffer);

		D3D11_TEXTURE2D_DESC DepthStencilDesc;
		DepthStencilDesc.Width				= g_ClientWidth;
		DepthStencilDesc.Height				= g_ClientHeight;
		DepthStencilDesc.Format				= DXGI_FORMAT_D24_UNORM_S8_UINT;
		DepthStencilDesc.MipLevels			= 1;
		DepthStencilDesc.ArraySize			= 1;
		DepthStencilDesc.Usage				= D3D11_USAGE_DEFAULT;
		DepthStencilDesc.BindFlags			= D3D11_BIND_DEPTH_STENCIL;
		DepthStencilDesc.CPUAccessFlags		= 0;
		DepthStencilDesc.MiscFlags		    = 0;
		DepthStencilDesc.SampleDesc.Count   = 1;
		DepthStencilDesc.SampleDesc.Quality = 0;

		HR( g_D3dDevice->CreateTexture2D( &DepthStencilDesc, 0, &g_DepthStencilBuffer) );
		HR( g_D3dDevice->CreateDepthStencilView( g_DepthStencilBuffer, 0, &g_DepthStencilView ) );
		g_D3dDeviceContext->OMSetRenderTargets( 1, &g_RenderTargetView, g_DepthStencilView );

		g_Vp.TopLeftX = 0;
		g_Vp.TopLeftY = 0;
		g_Vp.Width	= static_cast<float>(g_ClientWidth);
		g_Vp.Height	= static_cast<float>(g_ClientHeight);
		g_Vp.MinDepth = 0;
		g_Vp.MaxDepth = 1.0f;

		g_D3dDeviceContext->RSSetViewports( 1, &g_Vp );
	}

	void ReleaseAll()
	{
		ReleaseCOM(g_RenderTargetView);
		ReleaseCOM(g_DepthStencilView);
		ReleaseCOM(g_InputLayout);
		ReleaseCOM(g_SwapChain);

		if( g_D3dDeviceContext )
		{
			g_D3dDeviceContext->ClearState();
		}
		ReleaseCOM( g_VertexBuffer );
		ReleaseCOM( g_IndexBuffer );
		ReleaseCOM( g_InputLayout );
		ReleaseCOM( g_Effect );
		ReleaseCOM(g_D3dDevice);
		ReleaseCOM(g_D3dDeviceContext);
	}

	void DrawScreen()
	{
		assert( g_D3dDeviceContext );
		assert( g_SwapChain );

		ID3DX11EffectMatrixVariable *fxWorldViewProj;
		fxWorldViewProj = g_Effect->GetVariableByName("gWorldViewProj")->AsMatrix();
		fxWorldViewProj->SetMatrix( (float *)&g_WorldViewProj );

		D3DX11_TECHNIQUE_DESC techDesc;
		g_EffectTechnique->GetDesc( &techDesc );
		g_EffectTechnique->GetPassByIndex(0)->Apply( 0, g_D3dDeviceContext );

		UINT stride = sizeof(Vertex);
		g_D3dDeviceContext->IASetInputLayout( g_InputLayout );
		g_D3dDeviceContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
		g_D3dDeviceContext->IASetVertexBuffers( 0, 1, &g_VertexBuffer, &stride,  0 );
		g_D3dDeviceContext->IASetIndexBuffer( g_IndexBuffer, DXGI_FORMAT_R32_UINT, 0);

		XMVECTORF32 color = { 0.0f, 0.0f, 1.0f, 1.0f };
		g_D3dDeviceContext->ClearRenderTargetView( g_RenderTargetView, reinterpret_cast<const float*>(&color) );
		g_D3dDeviceContext->ClearDepthStencilView( g_DepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0.0f );
		g_D3dDeviceContext->DrawIndexed( 36, 0, 0 );

		HR(g_SwapChain->Present(0,0));
	}
	
	void BuildFx()
	{
		DWORD shaderFlag;
		#if  defined(DEBUG) || defined(_DEBUG)
		shaderFlag |= D3D10_SHADER_DEBUG;
		shaderFlag |= D3D10_SHADER_SKIP_OPTIMIZATION;
		#endif

		ID3D10Blob *CompiledShader;
		ID3D10Blob *CompiledError;

		 HR ( D3DX11CompileFromFile( L"FX/boxShader.fx", 0, 0, 0, "fx_5_0",
			shaderFlag, 0, 0, &CompiledShader, &CompiledError, 0 ) );

		if( CompiledError )
		{
			MessageBoxA( 0, (char *)CompiledError->GetBufferPointer(), 0, 0 );
			ReleaseCOM( CompiledError );
		}

		HR( D3DX11CreateEffectFromMemory( CompiledShader->GetBufferPointer(), CompiledShader->GetBufferSize(),
			0, g_D3dDevice, &g_Effect ) );

		ReleaseCOM(CompiledShader);		
	}

	void BuildBuffer()
	{
		Vertex BoxVertex[] = {
			{ XMFLOAT3(-0.5f,  0.5f, -0.5f), XMFLOAT4(1.0f, 0.0f, 0.0f, 0.0f) },
			{ XMFLOAT3( 0.5f,  0.5f, -0.5f), XMFLOAT4(0.0f, 1.0f, 0.0f, 0.0f) },
			{ XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT4(0.0f, 0.0f, 1.0f, 0.0f) },
			{ XMFLOAT3( 0.5f, -0.5f, -0.5f), XMFLOAT4(1.0f, 1.0f, 0.0f, 0.0f) },
			{ XMFLOAT3(-0.5f,  0.5f,  0.5f), XMFLOAT4(1.0f, 0.0f, 1.0f, 0.0f) },
			{ XMFLOAT3( 0.5f,  0.5f,  0.5f), XMFLOAT4(0.0f, 1.0f, 1.0f, 0.0f) },
			{ XMFLOAT3(-0.5f, -0.5f,  0.5f), XMFLOAT4(1.0f, 1.0f, 1.0f, 0.0f) },
			{ XMFLOAT3( 0.5f, -0.5f,  0.5f), XMFLOAT4(0.5f, 0.5f, 0.5f, 0.0f) },
		};

		D3D11_BUFFER_DESC vDesc;
		//memset( &vDesc, 0, sizeof(D3D11_BUFFER_DESC) );
		vDesc.ByteWidth		 = sizeof(Vertex) * 8;
		vDesc.Usage			 = D3D11_USAGE_IMMUTABLE;
		vDesc.BindFlags		 = D3D11_BIND_VERTEX_BUFFER;
		vDesc.CPUAccessFlags = 0;
		vDesc.MiscFlags		 = 0;
		vDesc.StructureByteStride = 0;
		D3D11_SUBRESOURCE_DATA vInitData;
		vInitData.pSysMem	 = BoxVertex;
		HR( g_D3dDevice->CreateBuffer( &vDesc, &vInitData, &g_VertexBuffer) );

		UINT indices[] =
		{
			//FRONT
			0, 1, 2,
			2, 1, 3,

			//TOP
			0, 4, 5,
			0, 5, 1,

			//RIGHT
			1, 5, 3,
			3, 5, 7,

			//BACK
			4, 6, 5,
			5, 6, 7,

			//BOTTOM
			2, 7, 1,
			2, 3, 7,

			//LEFT
			0, 2, 4,
			2, 6, 4
		};

		D3D11_BUFFER_DESC bDesc;
		//memset( &bDesc, 0, sizeof( bDesc ) );
		bDesc.ByteWidth		= sizeof( UINT ) * 36;
		bDesc.Usage			= D3D11_USAGE_IMMUTABLE;
		bDesc.BindFlags		= D3D11_BIND_INDEX_BUFFER;
		bDesc.CPUAccessFlags = 0;
		bDesc.MiscFlags		= 0;
		bDesc.StructureByteStride = 0;
		D3D11_SUBRESOURCE_DATA iInitDate;
		iInitDate.pSysMem = indices;
		HR( g_D3dDevice->CreateBuffer( &bDesc, &iInitDate, &g_IndexBuffer ) );
	}
	
	void BuildInputLayout()
	{
		D3D11_INPUT_ELEMENT_DESC idesc[] = 
		{
			{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
			{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }
		};
		UINT numElements = ARRAYSIZE( idesc );

		g_EffectTechnique = g_Effect->GetTechniqueByName( "ColorTech" );
		D3DX11_PASS_DESC passDesc;
		g_EffectTechnique->GetPassByName("p0")->GetDesc(&passDesc);
		
		HR( g_D3dDevice->CreateInputLayout( idesc, numElements, passDesc.pIAInputSignature ,
					passDesc.IAInputSignatureSize, &g_InputLayout) );
	}

	LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
	{
		switch( msg )
		{
		case WM_SIZE:
			g_ClientWidth  = LOWORD( lParam );
			g_ClientHeight = HIWORD( lParam );

			if( g_D3dDevice )
			{
				if( wParam != SIZE_MINIMIZED )
				{
					onResizeAndInit();
				}
			}
			return 0;

		case WM_DESTROY:
			ReleaseAll();
			PostQuitMessage(0);
			return 0;

		default: 
			break;
		}
		return DefWindowProc(hWnd, msg, wParam, lParam); 
	}

you may need the BoxShader.fx file:

//
//		Effect for boxdemo
//

cbuffer cbPerObject
{
	float4x4 gWorldViewProj;
};

struct VertexIn
{
	float3 PosL : POSITION;
	float4 color : COLOR;
};

struct VertexOut
{
	float4 PosH : SV_POSITION;
	float4 color : COLOR;
};

VertexOut VS( VertexIn vin )
{
	VertexOut vout;
	vout.PosH = mul( float4( vin.PosL, 1.0f ), gWorldViewProj );
	
	vout.color = vin.color;
	
	return vout;
}

float4 PS( VertexOut pin ) : SV_Target
{
	return pin.color;
}

technique11 ColorTech
{
	pass p0
	{
		SetVertexShader( CompileShader( vs_5_0, VS() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_5_0, PS() ) );
	}
}

Thanks for your help.

Edited by bluepig.man
0

Share this post


Link to post
Share on other sites

Have you tried setting the shader flags to 0?

 

Also (I'm not sure if it matters) but you might want to try using "ps_5_0" instead of "fx_5_0" since that's how it's set up in the shader technique.

1

Share this post


Link to post
Share on other sites

Have you tried setting the shader flags to 0?

 

Also (I'm not sure if it matters) but you might want to try using "ps_5_0" instead of "fx_5_0" since that's how it's set up in the shader technique.

 

You are right,the shader flag should set to 0.sad.png

it's so stupid mistake......

l should more careful about this mistake,thanks for your help,guys.smile.png

0

Share this post


Link to post
Share on other sites

Sry... there is already an answer

DWORD shaderFlag;
        #if defined(DEBUG) || defined(_DEBUG)
        shaderFlag |= D3D10_SHADER_DEBUG;
        shaderFlag |= D3D10_SHADER_SKIP_OPTIMIZATION;
        #endif

at creation moment shaderFlag contains some random value. change line :

DWORD shaderFlag;

to : 

DWORD shaderFlag = 0;
Edited by imoogiBG
1

Share this post


Link to post
Share on other sites

 

Sry... there is already an answer

DWORD shaderFlag;
        #if defined(DEBUG) || defined(_DEBUG)
        shaderFlag |= D3D10_SHADER_DEBUG;
        shaderFlag |= D3D10_SHADER_SKIP_OPTIMIZATION;
        #endif

at creation moment shaderFlag contains some random value. change line :

DWORD shaderFlag;

to : 

DWORD shaderFlag = 0;

 

Although,l got the answer before your suggestion, thanks.smile.png

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By bowerbirdcn
      hi, guys, how to understand the math used in CDXUTDirectionWidget ::UpdateLightDir 
      the  following code snippet is taken from MS DXTU source code
       
        D3DXMATRIX mInvView;
          D3DXMatrixInverse( &mInvView, NULL, &m_mView );
          mInvView._41 = mInvView._42 = mInvView._43 = 0;
          D3DXMATRIX mLastRotInv;
          D3DXMatrixInverse( &mLastRotInv, NULL, &m_mRotSnapshot );
          D3DXMATRIX mRot = *m_ArcBall.GetRotationMatrix();
          m_mRotSnapshot = mRot;
          // Accumulate the delta of the arcball's rotation in view space.
          // Note that per-frame delta rotations could be problematic over long periods of time.
          m_mRot *= m_mView * mLastRotInv * mRot * mInvView;
          // Since we're accumulating delta rotations, we need to orthonormalize 
          // the matrix to prevent eventual matrix skew
          D3DXVECTOR3* pXBasis = ( D3DXVECTOR3* )&m_mRot._11;
          D3DXVECTOR3* pYBasis = ( D3DXVECTOR3* )&m_mRot._21;
          D3DXVECTOR3* pZBasis = ( D3DXVECTOR3* )&m_mRot._31;
          D3DXVec3Normalize( pXBasis, pXBasis );
          D3DXVec3Cross( pYBasis, pZBasis, pXBasis );
          D3DXVec3Normalize( pYBasis, pYBasis );
          D3DXVec3Cross( pZBasis, pXBasis, pYBasis );
       
       
      https://github.com/Microsoft/DXUT/blob/master/Optional/DXUTcamera.cpp
    • By YixunLiu
      Hi,
      I have a surface mesh and I want to use a cone to cut a hole on the surface mesh.
      Anybody know a fast method to calculate the intersected boundary of these two geometries?
       
      Thanks.
       
      YL
       
    • By hiya83
      Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
      Thanks!
    • By lonewolff
      Hi Guys,
      I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?
      Any advice would be greatly appreciated
    • By MarcusAseth
      bool InitDirect3D::Init() { if (!D3DApp::Init()) { return false; } //Additional Initialization //Disable Alt+Enter Fullscreen Toggle shortkey IDXGIFactory* factory; CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&factory)); factory->MakeWindowAssociation(mhWindow, DXGI_MWA_NO_WINDOW_CHANGES); factory->Release(); return true; }  
      As stated on the title and displayed on the code above, regardless of it Alt+Enter still takes effect...
      I recall something from the book during the swapChain creation, where in order to create it one has to use the same factory used to create the ID3D11Device, therefore I tested and indeed using that same factory indeed it work.
      How is that one particular factory related to my window and how come the MakeWindowAssociation won't take effect with a newly created factory?
      Also what's even the point of being able to create this Factories if they won't work,?(except from that one associated with the ID3D11Device) 
  • Popular Now