Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualBogomil

Posted 30 April 2012 - 06:48 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsof...9(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
	  D3DXVECTOR3 p; //D3DFVF_XYZ
	  D3DXVECTOR3 n; //D3DFVF_NORMAL
	  float tu,tv;			  //D3DFVF_TEX1
};

What happens if you put assert(

_CrtCheckMemory( )



); right before the SetFVF() call?


I attached an image of the result.

The second square of code(where the error occurs in the green code) is in mlock.c
[attachment=8553:error.png]
I also used windows symbols to get a more detailed stack heap,but I can't really figure out why setting a new vertex declaration corrupts the heap.
[attachment=8558:Call Stack.png]

#5Bogomil

Posted 30 April 2012 - 04:00 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsof...9(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
	  D3DXVECTOR3 p; //D3DFVF_XYZ
	  D3DXVECTOR3 n; //D3DFVF_NORMAL
	  float tu,tv;			  //D3DFVF_TEX1
};

What happens if you put assert(

_CrtCheckMemory( )


); right before the SetFVF() call?



I attached an image of the result.

The second square of code(where the error occurs) is in mlock.c

#4Bogomil

Posted 30 April 2012 - 03:59 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsof...9(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
	  D3DXVECTOR3 p; //D3DFVF_XYZ
	  D3DXVECTOR3 n; //D3DFVF_NORMAL
	  float tu,tv;			  //D3DFVF_TEX1
};

What happens if you put assert(

_CrtCheckMemory( )

); right before the SetFVF() call?



I attached an image of the result.

The second square of code(where the error occurs) is in <i><b>mlock.c</b></i>

#3Bogomil

Posted 30 April 2012 - 03:57 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsof...9(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
	  D3DXVECTOR3 p; //D3DFVF_XYZ
	  D3DXVECTOR3 n; //D3DFVF_NORMAL
	  float tu,tv;			  //D3DFVF_TEX1
};

What happens if you put assert(

_CrtCheckMemory( )

); right before the SetFVF() call?



I attached an image of the result.

#2Bogomil

Posted 30 April 2012 - 03:56 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsof...9(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
	  D3DXVECTOR3 p; //[b][i]D3DFVF_XYZ[/i][/b]
	  D3DXVECTOR3 n; //[b][i]D3DFVF_NORMAL[/i][/b]
	  float tu,tv;			  //[b][i]D3DFVF_TEX1[/i][/b]
};

What happens if you put assert(

_CrtCheckMemory( )

); right before the SetFVF() call?



I attached an image of the result.

#1Bogomil

Posted 30 April 2012 - 03:45 AM

Your problem lies in this

#define D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
This is not a properly defined FVF.

SetFVF takes a DWORD as it's parameter not a define.
//From the DX SDK documentation
HRESULT SetFVF(
  [in]  DWORD FVF
);
And if you would look at the examples they use in the documentation you see that they all use "const DWORD" variables to define the custom vertex format.
The better way of doing this is to use a vertexdeclaration, which will allow you to use shaders properly as well and will make the switch from DX9 to higher much easier to achieve as the fixed function pipeline is dead.


I changed it to const DWORD D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1);
but it still gives the same error.I actualy used #define before,because that's how I saw it in msdn.( http://msdn.microsoft.com/en-us/library/windows/desktop/bb204869(v=vs.85).aspx )My CUSTOMVERTEX pretty much matches the FVF,doesn't it?


struct CUSTOMVERTEX
{
      D3DXVECTOR3 p; //[b][i]D3DFVF_XYZ[/i][/b]
      D3DXVECTOR3 n; //[b][i]D3DFVF_NORMAL[/i][/b]
      float tu,tv;              //[b][i]D3DFVF_TEX1[/i][/b]
};

PARTNERS