Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About pikebu

  • Rank
  1. Hi, has anyone a good explanation of the DrawIndexedPrimitives function? I think all the parameters seem to be a little confusing to a newbee like me. I have a vertex and an index buffer with some boxes and meshes. All boxes are stored at the beginning of my index and vertex buffer. For example: box verts are from positions 0 to 312, indices from 0 to 468. Now I want to render only my texts which are from positions 313 to 2147 in the vertex buffer and from 469 to 4188 in the index buffer. As I said before, I'm quite new to DirectX. Would be great if someone can give me some good explanation for the DrawIndexedPrimitives function. Pikebu
  2. Hi, I have a problem with my DrawIndexedPrimitive Function. I have some boxes in my scene which I store in my vertex and indexbuffer. So far, it works all fine. Now I'm creating some Mesh objects(with TextFromMesh) and add them into my vertex and index buffer. The values are in the correct place in the vertex and index array. Now I'm trying to render only the text vertices: int textBase = this.totalBoxCount * 36; // the number of all my boxes in the indexbuffer times 36 indices per box int textCount = this.indices.Length - textBase; // the number of indices for my textmesh int textVertices = this.verts.Length - this.totalBoxCount * 24; // number of my vertices in the vertexbuffer for all my boxes Now, how can I render only the mesh? I tried something like this: device.DrawIndexedPrimitives(PrimitiveType.TriangleList, textBase, textBase, textVertices, textBase, textCount/3); But this gives me a total messed up picture.
  3. works perfect now :-) THANKS THANKS THANKS!!!!!
  4. Hi, how can I get the values from an indexbuffer of a mesh. I've created a mesh object with the Mesh.TextFromFont() function. Then I'm trying to access the Indexbuffer with: using (IndexBuffer ib_local = mesh.IndexBuffer) { int[] indexes_local = (int[])ib_local.Lock(0, typeof(int), LockFlags.None, mesh.IndexBuffer.Description.Size/2); { try { MessageBox.Show(""+indexes_local[0]); } .... The problem is now, that it seems to have totally wrong values inside. The vertexbuffer of the mesh has 432 vertices and the indexes_local[0] value is e.g. 131072 what's only can be wrong. All other index_local values are even bigger then 131072. What can be wrong?
  5. pikebu

    Mouse screen pos to world coords?

    Quote:Original post by haegarr Is that "works only in the center" for both x and y axis valid? Or does a click work also well if the object is at the left side but still vertically centered? Seems to be valid for both axis unfortunately. The more offset the mouse click has from the center the less it works. Just as if the mouse-screen coordinates are not used for the calculation at all. The code of someusername assumes the y mouse value to be defined top down (what most often is the case). But perhaps the values given to you are already converted to bottom up?
  6. pikebu

    Mouse screen pos to world coords?

    thanks for the answer "someusername". the code so far works fine, but i'm only able to get correct results when my object is in the center of my screen. i think there's something wrong with the mouseX and mouseY positions in world space. can anyone tell me how, I can get the correct mouse screen values in world space?
  7. pikebu

    Mouse screen pos to world coords?

    I'm using DirectX in my project. Can anyone tell me, how to do the calculations there? Pikebu
  8. Hi, does anyone know, how I can transform screen coords, e.g. my mouse position in the rendered window to 3D world coords? Best regards Pikebu
  9. Hi, I have a vertexbuffer where I store 8 vertices with the position and color. Then I have an indexbuffer where I store my 36 indices to create a cube of my 8 vertices. The problem is now, that when I render the cube all cubesides have the same color. When I turn on the lights, the cube color becomes black. I think I need the normals for every cube side to get the right color value. How can I set the normals for all 6 cube sides? I'm able to set a normal for every vertex value in the vertexbuffer, but when I create the cube with my indexbuffer every vertex is part of three cube sides. So I think, I can't set a normal value in the vertexbuffer. Does anyone know, how I can solve this? Pikebu
  10. pikebu

    Hardware instancing in C#?

    Ok, I have generated my 50.000 boxes with Mesh.Box(). As I said, I'm quite new in DirectX so can anyone give me a code example of how I should create a dynamic vertexbuffer and then get all vertices from my boxes inside this buffer. Pikebu
  11. pikebu

    Hardware instancing in C#?

    My problem is, that I have 50000 boxes and can't render everyone with box.DrawSubset() or DrawIndexedPrimitive(). I need to copy all generated boxes into one vertexbuffer and then render all boxes with only one draw call. But unfortunately I don't know how to get all these boxes into the one vertexbuffer. Pikebu
  12. pikebu

    Hardware instancing in C#?

    Quote:Original post by acid2 I think you'd be better off using one vertex buffer with all of the cubes in that one vertex buffer, personally. However, if you do want to go forward with hardware instancing - there is a C++ sample in the SDK. It shouldn't be too hard to convert this into C#. I'll happily have a go myself if you can't get it, when I have some free time. Hth, This would be great. Well, is there an easy way of getting my generated box objects into one vertexbuffer? Again - some code samples would be very helpful Best regards Pikebu
  13. Hi, how can I achieve hardware instancing in C#? I have to draw 50.000 boxes. Some code samples would be perfect, cause I'm a newbie in DirectX. Pikebu
  14. Hello, I want to create one mesh from two meshes. I have two box objects, created with Mesh.Box() and now I try to create one mesh of these both boxes. How can I do this? I played around with the PrtEngine.ConcatenateMeshes() function, but I always only see the first box. Best regards Pikebu
  15. pikebu

    Translating a mesh

    Does anyone has this example in C#?
  • 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!