Sign in to follow this  
lomateron

creating a buffer pointer problem(noobish question)

Recommended Posts

lomateron    491
[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? Edited by lomateron

Share this post


Link to post
Share on other sites
kauna    2922
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!

Share this post


Link to post
Share on other sites
kauna    2922
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!

Share this post


Link to post
Share on other sites
Seabolt    781
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 :)

Share this post


Link to post
Share on other sites
lomateron    491
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] Edited by lomateron

Share this post


Link to post
Share on other sites
kauna    2922
The logical question here is "Have you bound your vertex buffer?"

Have you called IASetVertexBuffers?

Cheers! Edited by kauna

Share this post


Link to post
Share on other sites
lomateron    491
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. Edited by lomateron

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