Jump to content

View more

Image of the Day

「筋肉兄貴のスーパーラン!」
夕焼けにガラス・・・(´・ω・`)
ガラスは割りたいでしょうけど、割ったらクリアできないですよ。
(o・ω・o)
 #indiedev  #indiegame #screenshotsaturday https://t.co/fhKO5NJ5ee
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Problem show up when I use debug in DX9 control panel

2: Adsense

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
3 replies to this topic

#1 DarkRonin   Members   

1172
Like
0Likes
Like

Posted 02 June 2014 - 12:28 AM

Hi Guys,

I have just noticed that when I run my program with the DX Control Panel set to use the debug mode, I get an error every draw call.

Direct3D9: (ERROR) :Vertex buffer must be unlocked during DrawPrimitive call
Direct3D9: (ERROR) :DrawPrimitive failed.


This is the code I am using to render a single quad. Nothing else is happening in the draw call that reports any errors (i.e. If I comment out this source the program doesnt report any errors)

if(!FAILED(pVertexSpriteObject->Lock(0,(nNumVerts)*sizeof(D3DVERTEX),&pVertexBuffer,D3DLOCK_DISCARD)))
{
	pVertexSpriteObject->Lock(0,(nNumVerts)*sizeof(D3DVERTEX),&pVertexBuffer,D3DLOCK_DISCARD);

	memcpy(pVertexBuffer,vertices,(nNumVerts)*sizeof(D3DVERTEX));
	
	Renderer->DeviceHandle()->SetStreamSource(0,pVertexSpriteObject,0,sizeof(D3DVERTEX));
	Renderer->DeviceHandle()->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);

	pVertexSpriteObject->Unlock();
	Renderer->DeviceHandle()->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,nNumVerts-2);
}
As far as I can see, I am unlocking the vertex buffer with pVertexSpriteObject->Unlock();.

I have tried moving that line below DrawPrimative() but get the same error.

Any chance anyone could advise on what I am doing wrong?

Thanks in advance smile.png
Win32 Developer
One Of Them - Martial arts game that is mid development.

#2 DarkRonin   Members   

1172
Like
5Likes
Like

Posted 02 June 2014 - 12:30 AM

*
POPULAR

Damn, what a stupid mistake. I saw what is wrong straight after I posted this (must be the different font - LOL)

I am locking the vertex buffer twice in a row.

Edited by lonewolff, 02 June 2014 - 12:30 AM.

Win32 Developer
One Of Them - Martial arts game that is mid development.

#3 SeanMiddleditch   Members   

17445
Like
1Likes
Like

Posted 02 June 2014 - 11:21 AM

Damn, what a stupid mistake. I saw what is wrong straight after I posted this (must be the different font - LOL)


It happens. I know a number of developers who keep a stuffed animal or somesuch around just so they can go up to it and explain out loud the problem they're stuck on in detail (without distracting any teammates) and then often figure out the problem as they're explaining it.

Game Developer, C++ Geek, Dragon Slayer - http://seanmiddleditch.com

C++ SG14 "Games & Low Latency" - Co-chair - public forums

Wargaming Seattle - Lead Server Engineer - We're hiring!


#4 cozzie   Members   

4929
Like
0Likes
Like

Posted 02 June 2014 - 01:59 PM

If you want you can also mark/ enable that the application stops when a d3d error occurs, that way you don't have to constantly check and rely on checking the output debug window always

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me





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.