Where's the magic "Make DirectX work" button?

Started by
8 comments, last by Mithrandir 22 years, 5 months ago
i am so sick of this piece of crap SDK. The documents suck, first of all. The functions don''t work, second of all. I set the world matrix like so:
  
[640   0   0   0]
[  0 480   0   0]
[  0   0   1   0]
[  0   0   0   1]
  
this scales a point by 640 in the x direction, and 480 in the y direction. I then set the view and perspective matricies to the identity matricies. I then create 4 verticies, arranged in a quad from 0,0->1,1, and draw them with DrawPrimitiveUP. At first, it looks like nothing happened. Oh, wait, there''s a 1x1 pixel colored at the top of the screen. So i change the verticies to 0,0->640,480... recompile... The damn thing isnt transforming my vertex''s! The quad takes up the entire screen! What the hell do I have to do to make this stupid piece of crap actually do what it''s supposed to do? The matricies aren''t transforming anything at the moment.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
Advertisement
If your that irritated with it, you should use OpenGL instead...

Buy "OpenGL Game Programming" by Kevin Hawkins and Dave Astle.

Download the SDK from www.opengl.org

If you dont want to buy a book, go to

nehe.gamedev.net

No www. Jeff Moloffee is God, he makes alot of good(notice how that spells god if you take away an o? lol.. jk) OpenGL tutorials.

//// You don't have to create matrices in OpenGL

Edited by - Drizzt DoUrden on November 4, 2001 9:22:38 PM
------------------------------Put THAT in your smoke and pipe it
I like matrcies. I know how they work.

I had a fully functional 3d matrix library up and running in less than an hour.

Then someone told me that I should use d3d''s matrix features, because you can take advantage of hardware transforming. I thought it sounded like a good idea, so I went for it.

I''m now on hour four of trying to figure out why this god damn thing refuses to transform my verticies.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
It sounds as if you''re trying to transform pre-transformed coordinates - DirectX doesn''t do that. As an example, try altering the view matrix to any rotation and you should notice the quad from 0,0-640,480 is still drawn as you''ve said. You need to switch to un-transformed vertices.

Jim Adams
Drizzt, it probably isn''t a wise idea to advertise OpenGL in a DirectX forum. Mithrandir, I don''t know what''s wrong since I don''t use DirectX (your matrix seems perfectly sound to me). You may want to check what exactly DrawPrimitiveUP is meant to do (once again, I don''t know, I''m just trying to help as long as I''m posting), although you''ve probably done just that a dozen times...

[Resist Windows XP''s Invasive Production Activation Technology!]
It sounds like you are using vertices that are transformed and lit already, in which case directx does nothing but render what you give it. Can you post your code?
Ahh, Jim Adams posts while I''m typing, there''s your answer I guess .

[Resist Windows XP''s Invasive Production Activation Technology!]
quote:Original post by Drizzt DoUrden
If your that irritated with it, you should use OpenGL instead...

Lame. Both APIs are nearly identical in functionality. And as for that crack about not having to create matrices in OpenGL, you don''t have to in D3D either (you could use the D3DX library).

As usual, I''m messin'' witchu.


I wanna work for Microsoft!
you are probally making the silliest mistake and will hit yourself if i am correct. Since you did not supply much info about how you are drawing things, but seem to know what you are doing (you did code a 3d matrix class in 1 hour). Here are my thoughts on possible causes for your headaches:

1. dont ever blame the api, since you are the one making the mistake as the docs are quite useful (i learned dx8 from them)

2. you are most likly not using the correct vertex format. Since you dont specify the format you are using, i will show you a good one i use.
  #define D3DFVF_TLTVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1|D3DFVF_TEXCOORDSIZE2(0))struct TLT_VERTEX{    FLOAT x, y, z;      // The untransformed, 3D position for the vertex	FLOAT nx, ny, nz;        // normal	//unsigned long color;	FLOAT tu, tv;		// The texture coordinates	//FLOAT tu2, tv2;		// The texture coordinates	//FLOAT tu3, tv3;		// The texture coordinates};  


3. also you must ensure you set up your camera and perspective stuff. you cant expect dx to do what you want without telling it. The tutorials that come with the sdk explain how to set this stuff up rather nicly and i wont go into that here.

4. also dont forget to SET your matrix (SetTransform()). otherwise directx wont use it.

now a small rant on my detective work.
i know this must be the problem since you say that you used a 1 unit quad which would fit perfectly into the screen when changing the vertecies. Normally the coordinate space has 0,0 in the center of the screen, which you did not obviously. Also dont ever blame the sdk, or its functions. If it was so broken and crappy, then remedy (max payne/3dmark) as well as many other companies would not have done their stuff in directx. And why drizzt would he use opengl because of no matrices? that makes absolutly no sense. Especially since opengl does use matrices, though you may be able to hid their use through functions just like in directx. you would have the same problems in opengl if you did your own transformations (ie no hardware TnL)

groof
quote:Original post by Oluseyi
Lame. Both APIs are nearly identical in functionality. And as for that crack about not having to create matrices in OpenGL, you don''t have to in D3D either (you could use the D3DX library).

Yup. Even in my OpenGL powered 3D engine I needed to write a large matrix class for use in my physics code. So, realistically, he would still need to have some sort of matrix handling that he wrote himself.

[Resist Windows XP''s Invasive Production Activation Technology!]

This topic is closed to new replies.

Advertisement