Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GekkoCube

DrawPrimitiveUP...crashing

This topic is 5716 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

Strange this problem. When i call the code i am about to post here BEFORE i draw anything else, it crashes. i tried to read the return flag, but it doesnt give. but if i call this stuff AFTER my main objects are rendered (terrain and skybox), then things are fine...although the colors eeem to be off.
  
m_Indicator[0].x     = m_Position.x;
m_Indicator[0].y     = m_Position.y;
m_Indicator[0].z     = m_Position.z;
m_Indicator[0].color = 0xffffff00;

D3DXVECTOR3 end = m_Position;
end += m_Direction * 5.0f;

// 2nd vertex

m_Indicator[1].x     = end.x;
m_Indicator[1].y     = end.y;
m_Indicator[1].z     = end.z;
m_Indicator[1].color = 0xffffff00;

// Render the single line primitive.

g_pd3dDevice->DrawPrimitiveUP( D3DPT_LINESTRIP, 1, m_Indicator,                                  m_iSizeOfInfo );
  
Im drawing a single line, so the 2nd parameter is 1. the vertex format has D3DFVF and DIFFUSE. any help will help - i am lost at this point and I hate to just rearrange the render calling to where it will work...its just weird how rearranging the rendering calls will make/break a crash!

Share this post


Link to post
Share on other sites
Advertisement
check debug output, it sounds like there is a messed up state, the debug output will probably tell you whats wrong

Share this post


Link to post
Share on other sites
I cannot imagine anyone, in any conceivable walk of life, ever in a million years wanting to use DrawPrimitiveUP.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by GekkoCube

Im drawing a single line, so the 2nd parameter is 1.
the vertex format has D3DFVF and DIFFUSE.





What is D3DFVF? you need XYZ and Diffuse..maybe a typo..

What Version of DirectX are you using? I don''t see where you set the shader (DX8) or FVF (DX9).. If you are drawing D3DXMeshs, then the drawsubset would be setting the FVF, and that is why you would be able to draw but it''s messed up cause the FVF is wrong and maybe has a different stride.

Share this post


Link to post
Share on other sites
Ok, i am guessing that DrawPrimitiveUP is not very efficient or something....and Im guessing DrawIndexedPrimitive is.?

What about VerexBuffers?

Anyways, yes, that D3DFVF was a typo. I have a vertex format with XYZ and DIFFUSE.

i think i am drawing d3dxmeshes because i am drawing X file, copied from the tiger.x demo.
but i dont think this is the issue for this problem.

and what exactly is the stride?
any code anybody would like to see for this?

Share this post


Link to post
Share on other sites
quote:
Original post by GekkoCube
Ok, i am guessing that DrawPrimitiveUP is not very efficient or something....and Im guessing DrawIndexedPrimitive is.?

What about VerexBuffers?



To quote Richard Huddy (ex-NVIDIA, now ATI):

There are almost zero cases when avoiding VB’s make sense. If you think you have one of those cases then:
a) You haven’t really thought hard
b) Consult a doctor – it’s as bad as that


Share this post


Link to post
Share on other sites
So DrawIndexPrimitive uses vertex buffers?
I will use it.

Also, what do you mean by debug output?
Do you mean from the error message that windows gives me, or do you mean my own debug statements?

Also, what do you mean by "messed up states" ?
do you mean renderstates or what?

My problem i am trying to find is this:
My line strips (a single line segment) is being colored by something that I dont know what. also, when i move (rotate) that line, well, it changes colors (but not any single shade, but rather multiple colors). so this makes me believe a renderstate or something is off. i tried materials and turning off textures before i draw the line. also, when i first start, the line is red. when i move, it appears rainbow-like (not a pretty rainbow).

any help, tips, ideas...i need. thanks.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!