creating a buffer pointer problem(noobish question)

Started by
7 comments, last by kauna 11 years, 5 months ago
[source lang="cpp"]void createBuffer(...other parameters...,ID3D10Buffer** b)

{

...other code...

g_pd3dDevice->CreateBuffer( &d, &i, b);

}[/source]
its like the buffer pointer pointer doesnt works, why?
Advertisement
Why don't you give the whole source code for the createBuffer and then it is much much easier to see the potential problems. It is really hard to tell from your code even which kind of buffer you are creating.

For example, you could have some conflicting parameters or problem with the size of the buffer.

Cheers!
ID3D10Buffer* buffer;
createBuffer(...other parameters...,&buffer);
thats when i use the method
Please, copy the code exactly as it is in your program. The code excerpts you give don't show anything which could give a clue whether things should work or not.

Also, you haven't give the error message which you get.

- Does your program crash?
- The created buffer object doesn't work as intended?
- The returned buffer is NULL?

Best regards!
Iomateron: DirectX11 can fail for a variety of reasons, and most of the time it's due to an invalid parameters in your D3D11_BUFFER_DESC, that's what Kauna was asking. If the buffer you're getting is NULL, that's because the creation failed. It's hard for us to help if we don't have all the information :)

Just copy and paste the area where you setup the buffer description and use the "code" tags when you paste them :)
Perception is when one imagination clashes with another
I thought my mistake was in those lines, i i still think it is, here is the whole code.
[source lang="java"]LoMeFi(const char* name,int v,ID3D10Buffer** vl)
{
FILE * pFile; //----
pFile = fopen ( name , "rb" );//----

D3D10_BUFFER_DESC bds;//---
bds.Usage = D3D10_USAGE_DEFAULT;//----
bds.ByteWidth = 20*v;//----
bds.BindFlags = D3D10_BIND_VERTEX_BUFFER;//----
bds.CPUAccessFlags = 0;//----
bds.MiscFlags = 0;//----

vector<SimpleTex> ofg(v);//----
fread (&ofg[0],bds.ByteWidth,1,pFile);//----

D3D10_SUBRESOURCE_DATA iD;
iD.pSysMem = &ofg[0];
iD.SysMemPitch=bds.ByteWidth;
hr = g_pd3dDevice->CreateBuffer( &bds, &iD, vl);
if( FAILED( hr ) )
return hr;
}
ID3D10Buffer* buffer;
LoMeFi("gleass.bin",600,&buffer);[/source]

when i start drawing using the buffer it says

D3D10 INFO: ID3D10Device::DrawIndexed: Element [0] in the current Input Layout's declaration references input slot 0, but there is no Buffer bound to this slot. This is OK, as reads from an empty slot are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind an input Buffer here. [ EXECUTION INFO #348: DEVICE_DRAW_VERTEX_BUFFER_NOT_SET]
The logical question here is "Have you bound your vertex buffer?"

Have you called IASetVertexBuffers?

Cheers!
ooopps sorry, THANKS too, the mistake was there in the IASetVertexBuffers, i was settting another ID3D10Buffer* that wasnt crated.
Another previous similar problem was making me paranoic, thinking the mistake was there, dont letting me look any other place.
What is the HRESULT of CreateBuffer? -> if( FAILED( hr ) ) return hr;

What is the size of SimpleTex structure?

This topic is closed to new replies.

Advertisement