Managed DX problem

Started by
6 comments, last by eagleboy 19 years, 7 months ago
I wouldn't be posting here if it wasn't the last resort. I've now spent the better part of a full day trying to figure out what the problem is. The symptoms are obvious - it doesn't draw the q3 bsp map I've loaded. There are no errors (implicit via debug or crashing) and no exceptions are being thrown. I'm sure the map is loaded correctly as I've verified it again another persons loading code and they both produce the same results as I've written both representations in a meaningful format to text files and compared (this code can be found here). The only thing I can think to do is either forget about it altogether, or hope that someone with more DX experience take a quick look for me. The solution code can be found here. This is by no means a demand to take a look. Quick code synopsis: There are only classes of interest: q8.cs - program entry, initialisation Camera.cs - camera routines q3bsp - q3 map loading / rendering Note: I have a console class that renders without issue. So I'm seeing something at least. Also, the code is messy. It wasn't this way until I started thrashing looking for a solution. There are free lollies on offer to anyone that can solve this one for me. Email/MSN: acnamehere@msn.com Thanks, eb.
Advertisement
cant unzip your files
************THOUE*****Spec:Intel: 2.8GHzAti Radeon 9800 pro1024mg RAMDevelopping C# DX 9.0c appsThx you!
Hi,

I checked the zip file and it seemed ok. Perhaps, with your permission, I could attach it to an email? It's 97kb in size.

Thanks,

eb.
I'm comparing your code to my Half-Life (basically Quake 1) viewer code, also in Managed DirectX, and as far as I can tell the DX part of it is fine. You even say you get the console to render. It must be something with the data. Even if it's loading correctly, maybe you're interpreting it wrongly. A major thing to be wary of is coordinate system differences between DX and Quake 3. I know the Quake 1 engine uses XY as the "floor" plane and Z and the "height" axis, while in DX, the XY plane would be your screen, and the Z axis would be depth. This is easy to fix, but it could be a source of your rendering problems if the whole level is disoriented. Second, I recommend you implement mouse/keyboard input into your camera right away. It will saves loads of time if you can move the view around dynamically instead of having it hard-coded and recompile each time. Who knows, the whole level may simply be behind you!

I used this resource as a starting point. It was a good technical document, but it didn't answer a lot of the questions I had and didn't explain a lot of things in enough detail I thought. But hopefully you see something you're doing wrong so you can fix it. One thing you might want to try off the bat is use mesh vertexes instead of regular vertexes for your face rendering. It's a straightforward list of triangles.
Hi Zipster,

Thanks for taking the time to respond.

I'm convinced the problem is not with the internal representation of the q3 map. I've written the vertice and face data to text files from both my loader and that of another and the output is identical. We are both swapping the Y and Z axis (while negating the Z).

Thanks,

eb.

Ok, I've found the problem. Although I'm not really sure why it was a problem to begin with. When filling my vertex buffer I assign a local variable to point to the indexed vertex. However, when it seems this is not setting the vertex in the buffer. Why is this so???

I replaced this:
CustomVertex.PositionColored dxvert = v;Vertice vert = vertices;			dxvert.X = vert.Position[0];dxvert.Y = vert.Position[1];dxvert.Z = vert.Position[2];

with this:
//CustomVertex.PositionColored dxvert = v;Vertice vert = vertices;			v.X = vert.Position[0];v.Y = vert.Position[1];v.Z = vert.Position[2];



Ideas?

Aaron.
Heh, that code looked fishy to me, and I was going suggest you breakpoint it and see if the vertex buffer data was really being set, but I guess I forgot to say something :) But now that you mention it, it's because the vertexes are value types. You were modifying a copy.
Hey Zipster,

It just came to me that they would be structs rather than classes too :)

Thanks for your help.

eb.

This topic is closed to new replies.

Advertisement