How do I delete objects?

Started by
18 comments, last by sixteen 17 years, 7 months ago
d3dpp.BackBufferHeight = 600;
d3dpp.BackBufferWidth = 600;

there's my problem. It must be 600 and 800, not 600 and 600. But...why? 800x600 stretches out the objects. If I load in a perfectly circular sphere .x file, it looks squished, so I fixed that with a 600x600 res. But it doesn't like that at fullscreen?
Advertisement
uhm, I assume you should just use a resolution that the graphics card and your monitor support, which are either 4:3, 16:9 or 16:10 aspect ratio resolutions. Common resolution are:
- 800 x 600
- 1024 x 768
- 1280 x 960
- 1600 x 1200
- 1600 x 900 (16:9 aspect ratio)
- 1680 x 1050 (16:10 aspect ratio)

As for the "jerky" rotation:
On my PC those two objects are rotating rather nicely, although the app is running only at ~35 FPS. The only thing jerky I noticed was some small "stutters" in the rotation when the FPS dropped a bit.
In windowed modes you can have whatever resolution you desire. When in fullscreen mode, you are changing the resolution of the screen/graphics card. There are only a certain number of combinations that the card will accept, and they are usually in set ratios (either 4:3 for standard views or 16:9 for widescreens).

If your model is getting squished when you set it to 800x600 then you are not setting up your frustrum correctly.
Ok thanks guys. As for the rotation, I tried it on my other computer and it does seem a lot smoother. The only problem is that it doesn't load the texture files o_O' It says it can't find them, but they're clearly right there. Weird. That computer does have DX9.0c, so that shouldn't be a problem. Ugh, so many hoops to jump through with this thing.
Having a look at the the .x files of your meshes it seems the texture file names are given in absolute paths, for example your myball.x contains the following:
TextureFilename {      "C:/i345/C++/thegame/Debug/myobject2.bmp";}

which indicates the texture should be at that exact location. Probably your other mesh file has the same "problem". However I have no idea how to change that in an automated way, since I never used the texture file names stored in the .x files but loaded textures directly. Changing the above line to "myobject2.bmp" fixes the problem for that specific file.
holy crap, I never would have guessed that. My gosh. Thank you so much. I'm so glad it's a simple fix instead of a DirectX version or a programming problem!

Now if I could only figure out why the application runs so slow on my computer... I have a GeForce 5500. It shouldn't have such a slow frame rate.
Ok, I'm trying to translate on of the objects now. I figured, I should use this:

D3DXMATRIX *WINAPI D3DXMatrixTranslation(          D3DXMATRIX *pOut,    FLOAT x,    FLOAT y,    FLOAT z);


however, the compiler doesn't like it. I'm guessing because "D3DXMATRIX *pOut" is something I don't have. I think that needs to point to a D3DXMATRIX thing, but I haven't made any of my meshes a D3DXMATRIX thing. I tried putting in m_pMesh[1] to target the myball.x mesh, but that doesn't work. I did it like this: D3DXMATRIX *m_pMesh[1],

So it appears as though I need to somehow make myball.x a D3DXMATRIX thing after I load it in with D3DXLoadMeshFromX. How do I do this?
I just had another look over your code and it seems that you are using software vertex processing, which means that all vertex transformations are done by the CPU, and not your graphics card. You probably will want to try D3DCREATE_HARDWARE_VERTEXPROCESSING instead of D3DCREATE_SOFTWARE_VERTEXPROCESSING in the call to CreateDevice(...) in your initDirect3D(...) function. That should speed up your application quite a lot, I hope. Furthermore you could try D3DXMESH_MANAGED instead of D3DXMESH_SYSTEMMEM when loading the meshes. Using the managed pool for the data will allow Direct3D to copy the data to the video memory if possible / necessary, which should also aid performance.
I really think you should have a look at some Direct3D tutorials for beginners. Have a look at the DirectX forum FAQ in this forum and you´ll find a list of tutorial sites under "Web Resources". After following some of these tutorials you should be able to do most "easy" things on your own.
ahh yes well, I actually did try the hardware thing, but that didn't help at all, so I switched it back. Trying hardware with D3DXMESH_MANAGED also doesn't speed it up at all unfortunately.

I'll take a look at some of those tutorials you mentioned.

This topic is closed to new replies.

Advertisement