DirectX 10 simple effect issue,bombs out after failing to load fx file

  • (2 Pages)
  • +
  • 1
  • 2

21 Replies - 779 Views - Last Post: 12 January 2013 - 12:50 PM Rate Topic: -----

#16 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 09 January 2013 - 03:27 PM

View Poststayscrisp, on 09 January 2013 - 02:51 PM, said:

Are you still using this
 p_basicTechnique = p_basicEffect->GetTechniqueByName("renderTheScene");



As your technique is called Render

tecnique10 Render




nah, ive changed that to Render in my code, after success with loading shader file.

I now have it not giving me any "not responding" errors, but the triangle strip of 3 verts are not being drawn still for some reason.

just getting home in a mo, will post loading code from there.
Cheers and brb.
Gruffy
Was This Post Helpful? 0
  • +
  • -

#17 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 09 January 2013 - 03:33 PM

Here is the Render code to draw triangle




//render - the scene
void ManageD3DX::renderTheScene()
	{
		//clear the scene 
		p_d3dDevice->ClearRenderTargetView(p_renderTargetView, D3DXCOLOR(0,0,0,0)); //d3dxcolor att rgba window color 

		//RENDER HERE
		//create the world (matrix)
		static float rotation;
		D3DXMATRIX world;
		D3DXMatrixIdentity(&world);
		D3DXMatrixRotationY(&world, rotation); //declared later on in ....remember to state 
		//make camera rotate by a small amount per render cycle if you want to dudes
		rotation += 0.001f;

		//set effect matrices
		p_worldMatEffectVar->SetMatrix(world);
		p_viewMatEffectVar->SetMatrix(viewMatrix);
		p_projMatEffectVar->SetMatrix(projMatrix);

		//fill vertex buffer with vertices
		UINT numOfVerts = 3;	
		oneVertex* v = NULL;

		//lock vertex buffer to cpu for use
		p_vertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**) &v );
		//create a triangle from vertex points and give each a colour provided by the derived struct oneVertex
		v[0] = oneVertex(D3DXVECTOR3(-1,-1,0), D3DXVECTOR4(0,0,1,1));
		v[1] = oneVertex(D3DXVECTOR3(0,1,0), D3DXVECTOR4(0,1,0,1));
		v[2] = oneVertex(D3DXVECTOR3(1,-1,0), D3DXVECTOR4(1,0,1,1));

		//reference the vertex buffer to run the unmap method
		p_vertexBuffer->Unmap();

		//p_d3dDevice->IASetVertexBuffers( 0, 1, &p_vertexBuffer, &stride, &offset );

		// Set primitive topology 
		p_d3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );

		//get technique desc
		D3D10_TECHNIQUE_DESC TechDesc;
		p_basicTechnique->GetDesc( &TechDesc );
	
		for( UINT p = 0; p < TechDesc.Passes; ++p )
		{
			//apply technique
			p_basicTechnique->GetPassByIndex( p )->Apply( 0 );
				
			//draw
			p_d3dDevice->Draw( numOfVerts, 0 );
		}

		//refernces swapChain to the value held in Present
		p_swapChain->Present(0, 0);
	};






Hope this is right stayscrisp.
Thanks for all this help so far bud, you are amazing !
Gruffy
Was This Post Helpful? 0
  • +
  • -

#18 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 09 January 2013 - 03:45 PM

Just as an aside, the experiment in putting a triangle to the render view was to demonstrate that the pipeline was functioning correctly so i could move forward into bring in a mesh to manipulate in the shader by animating the vertex shader positioning.
This is for my module and I really need to move forward into loading a model mesh into th edirectx window.

If you think you could guide me on that instead (perhaps you stayscrisp know this method well, Im not there yet unfortunately and you could give me the best guidance as far as you know etc)

Many thanks for putting up with my stupid questioning and tired corrections and mistakes so far.
Gruffy :)
Needs Pizza
Was This Post Helpful? 0
  • +
  • -

#19 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 09 January 2013 - 05:26 PM

View Poststayscrisp, on 09 January 2013 - 01:45 PM, said:

Post your loading code again please :)/>




	//create the actual D3Ddevvice and swapchain
	if (FAILED  (D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &swapChainDesc, &p_swapChain, &p_d3dDevice)))
		return err(L"D3D could not create, this message will self destruct in 5, 4, 3, 2 ...");

	/*END SWAPCHAIN AND D3D DEVICE SETUP*/

		//SHADER STAGE
	//*****************************************************************************
		
	//Load Basic Effect and Technique 
	//--------------------------------------------------------------
	if ( FAILED( D3DX10CreateEffectFromFile(	L"basicEffect.fx", 
												NULL, NULL, 
												"fx_4_0", 
												D3D10_SHADER_ENABLE_STRICTNESS, 
												0, 
												p_d3dDevice, 
												NULL, 
												NULL, 
												&p_basicEffect, 
												NULL, 
												NULL	) ) ) 
												return err(L"Could not load effect file! see source line 115 - 126 of ManageD3Dx.cpp");
	//there may be an issue in the specified shader if this error is occuring

	p_basicTechnique = p_basicEffect->GetTechniqueByName("Render");
	
	//create matrix effect pointers
	p_viewMatEffectVar = p_basicEffect->GetVariableByName( "View" )->AsMatrix();
	p_projMatEffectVar = p_basicEffect->GetVariableByName( "Projection" )->AsMatrix();
	p_worldMatEffectVar = p_basicEffect->GetVariableByName( "World" )->AsMatrix();

	//INPUT ASSEMBLY STAGE
	//*****************************************************************************


Was This Post Helpful? 0
  • +
  • -

#20 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 994
  • View blog
  • Posts: 4,158
  • Joined: 14-February 08

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 12 January 2013 - 03:51 AM

View Postgruffy, on 09 January 2013 - 10:45 PM, said:

Just as an aside, the experiment in putting a triangle to the render view was to demonstrate that the pipeline was functioning correctly so i could move forward into bring in a mesh to manipulate in the shader by animating the vertex shader positioning.
This is for my module and I really need to move forward into loading a model mesh into th edirectx window.


OK, well have you looked into any kind of mesh loading and displaying? Is there anything you're having particular trouble with there?
Was This Post Helpful? 1
  • +
  • -

#21 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 12 January 2013 - 11:41 AM

[/quote]

OK, well have you looked into any kind of mesh loading and displaying? Is there anything you're having particular trouble with there?
[/quote]

yeah , all of it! lol

My main issue nw i have a wrking win0w is to load the mesh and then dislay it.
My task is to do then animate in the shader file the movement (approximately at least) of some wings or attachment of sorts.

If yu have some knwledge of this I would certainly appreciate sme guidance as I am nt getting very far at the mo
:(
Was This Post Helpful? 0
  • +
  • -

#22 gruffy  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 106
  • Joined: 28-April 11

Re: DirectX 10 simple effect issue,bombs out after failing to load fx file

Posted 12 January 2013 - 12:50 PM

Mainly the goals below ar edictating my needs from this...

Make something that does the minimal:
is a static mesh that can be manipulated in the shader code to transform some wings or similar that would be attahced to that mesh.
There should also be functionality by means of projectiles and physics associated to them.

This was why I was working on the premise of getting a triangle to show and spin usng a better abstracted solution to implementing a window with directx10 than "simple sample". not getting the triangle up is telling me ive got something wrong before i even entered the realms of mesh models, importing them etc. Man this is due monday :(
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2