repositioning individual vertexes in a vertexBuffer

Started by
8 comments, last by legalize 16 years, 6 months ago
do i have to unlock the vertex buffer every time i reposition a vertex, or is there a function that does this?
Advertisement
AFAIK, yes, you have to lock/unlock during any manipulation of vertices
Generally you position vertices in the scene with the world transformation, not by editing the vertex buffer.

Transformation matrices good.

Editing vertex buffers bad.

See Chapter 5. Modeling and Chapter 6. Vertex Transformations from my book for details.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

ohh a free book on graphics. Its just been semester start so im on a thight budget so atm i cant afford any more books :(

So a free one is much appriciate. Thx Legalize.
I see its for C++, but the theroy should be the same for C# i guess.
no, i need an example of opening up a vertex buffer and repositioning the individual vertex positions. I use the directX 9 sdk.(because it works on windows down to version 2000)
Quote:Original post by Amgatroid
no, i need an example of opening up a vertex buffer and repositioning the individual vertex positions. I use the directX 9 sdk.(because it works on windows down to version 2000)


Go to your DX sample browser, and check out the "Textures" sample. They create a vertex buffer, and fill the buffer with values for each vertex via the Lock/Unlock functions.
ok i got it, thanks, now i need to use direct input for keyboard input

[Edited by - Amgatroid on September 30, 2007 9:21:13 PM]
Quote:Original post by Amgatroid
ok i got it, thanks, now i need to use direct input for keyboard input


Why are you using DirectInput for keyboard input? Its something Microsoft actually recommends against, since it creates a separate thread to parse raw input messages. You should look into handling raw input yourself, its actually simpler than working with DirectInput (IMO).

Ah, it's been at least a week since someone suggested using DirectInput for keyboard or mouse input [smile]

So....

Reasons against using DirectInput for keyboard input:
  • It creates a seperate thread to just read data from the keyboard using raw input (Which you can do yourself with Win32), meaning there's more overhead than just doing it yourself.
  • No support for keyboard repeat at the rate the user has set in the control pannel - you have to re-invent this yourself. Not too bad for game input, but a pain for GUI-style text input.
  • No support for capital letters and shifted characters - you have to detect caps lock / shift being held as well as your normal character.
  • No support for caps lock on/off; it's handled by a higher layer than DirectInput, so if someone starts your game with caps lock on, it gets confused.
  • More code to get the same effect as Window Messages.
  • It's actually recommended that you DON'T use it by Microsoft; Link:
    Quote:Overall, using DirectInput offers no advantages when reading data from mouse or keyboard devices, and the use of DirectInput in these scenarios is discouraged.
  • Quote:Original post by Amgatroid
    no, i need an example of opening up a vertex buffer and repositioning the individual vertex positions. I use the directX 9 sdk.(because it works on windows down to version 2000)


    What are you trying to achieve by editing the vertex buffer?

    Tell me the goal, not the task by which you expect to accomplish the goal.

    My free book on Direct3D: "The Direct3D Graphics Pipeline"
    My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

    This topic is closed to new replies.

    Advertisement