Jump to content
  • Advertisement

Archived

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

CpMan

D3D Indexed Primitives and Sluggish Keys (unrelated)

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

I have two problems right now which have no clear solution: 1)D3D Indexed Primitives and dynamic arrays - In my program, I have a user interface that allows a given user to add objects (hence models) to a simulation at any time, and any model can be used. For effieciency purposes, it is best to use an index primitive (I''m using normal-based D3D lighting, 1 set of texture coordinates, and an XYZ). However, in order to make the best of memory, a dynamic array (I''m using std::vector) is used for both the vertices in the vertex buffer and the indices in the index buffer. The problem is, when adding elements to the vertex and index buffers, it is impossible to use memcpy becuse the array''s are not only dynamic, but also padded bitwise. So I simply copy items, index by index, into the vertex buffers and index buffers. This works fine when only vertex buffers are used in a simple primitive form (DrawPrimitive), but when Indexed primitives are used, all the triangles of a given model are draw to a single point! I''ve had his problem a few times in separate program, so I know it''s not my coding, and I have not yet found a viable solution. Using simple arrays works, but I don''t know the polygon counts before I read the file, so simply creating a huge array doesn''t seem memory efficient. So does anyone know a solution to the problem, while still keeping the dynamic arrays, or is there another, memory saving method that will work correctly? 2) Full-Screen Mode: sluggish keys - In this same program, the user accesses a settings box, containing all the information about the simulation at a given time at once, by pressing the enter key. When in windowed mode, the dialog box pops up instantly, but when in fullscreen, it takes a few presses. The only difference in code is the initialization of DirectX procedure. One is full-screen, the other windowed. What gives? Thanks for the help

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!