Jump to content
  • Advertisement
Sign in to follow this  
lomateron

creating a buffer pointer problem(noobish question)

This topic is 2094 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[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
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!

Share this post


Link to post
Share on other sites
ID3D10Buffer* buffer;
createBuffer(...other parameters...,&buffer);
thats when i use the method Edited by lomateron

Share this post


Link to post
Share on other sites
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
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
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
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
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
What is the HRESULT of CreateBuffer? -> if( FAILED( hr ) ) return hr;

What is the size of SimpleTex structure?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!