Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


creating a buffer pointer problem(noobish question)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 19 November 2012 - 10:10 AM

[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, 19 November 2012 - 10:12 AM.


Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2832

Like
0Likes
Like

Posted 19 November 2012 - 10:39 AM

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!

#3 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 19 November 2012 - 10:47 AM

ID3D10Buffer* buffer;
createBuffer(...other parameters...,&buffer);
thats when i use the method

Edited by lomateron, 19 November 2012 - 10:49 AM.


#4 kauna   Crossbones+   -  Reputation: 2832

Like
0Likes
Like

Posted 19 November 2012 - 10:55 AM

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!

#5 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 19 November 2012 - 10:57 AM

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

#6 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 19 November 2012 - 11:13 AM

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, 19 November 2012 - 11:15 AM.


#7 kauna   Crossbones+   -  Reputation: 2832

Like
0Likes
Like

Posted 19 November 2012 - 11:15 AM

The logical question here is "Have you bound your vertex buffer?"

Have you called IASetVertexBuffers?

Cheers!

Edited by kauna, 19 November 2012 - 11:17 AM.


#8 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 19 November 2012 - 11:22 AM

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, 19 November 2012 - 11:29 AM.


#9 kauna   Crossbones+   -  Reputation: 2832

Like
0Likes
Like

Posted 19 November 2012 - 11:28 AM

What is the HRESULT of CreateBuffer? -> if( FAILED( hr ) ) return hr;

What is the size of SimpleTex structure?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS