XNA Index Buffers on Laptops

I have been working through The Hazy Mind XNA tutorials at http://www.thehazymind.com/XNAEngine.htm.

The computer I have been using for development is my old laptop that has a Intel 915 GM. This card has integrated pixel shading, but relies on the CPU for vertex shading. It also has some other issues, but I won’t go into those now.

As I went through the tutorials, I was having issues rendering the textured quads that are the first object made and rendered. These quads are also used to create the skybox, so getting them working was required to continue developing through these tutorials.

These two pictures show the issues I was having. The first picture shows a single triangle not rendering correctly, and the second shows two triangles not rendering.

Int Render Error 1

Int Render Error 2

After quite a few tries, I finally discovered what the problem was. In the tutorial code, the Index Buffer is created using:


int[] inds = { 0, 1, 2, 1, 3, 2 };

myIndices = new IndexBuffer(myDevice, typeof(int), 6, ResourceUsage.WriteOnly, ResourceManagementMode.Automatic);

myIndices.SetData(inds, 0, 6, SetDataOptions.None);

In this, each of the indicies is represented by an integer. For some reason, using ints causes the rendering errors. By looking at other tutorials, I found that many of them used shorts instead (A short is just an integer that uses less memory and stores a smaller range of numbers).

To fix the errors, all I had to do was change the code to:


short[] inds = { 0, 1, 2, 1, 3, 2 };

myIndices = new IndexBuffer(myDevice, typeof(short), 6, ResourceUsage.WriteOnly, ResourceManagementMode.Automatic);

myIndices.SetData(inds, 0, 6, SetDataOptions.None);

Here is the final result. You can see that the rendering problems are gone.

Short Render

Moving From DirectX9 to XNA

I’ve been working the last week on getting started with XNA and how to port AquariusSim over to it. Learning XNA has been easier than I expected it to be since I had already written a lot of code in DirectX9.

Microsoft did a good job with most of XNA, but there are a few things that I think will really frustrate new developers. Getting started has been improved a lot. It now only takes a few lines to set up a device and render a blank screen. That was one of the things that took me the longest when I was starting to learn DirectX. Most of the complexity of setting up the device has been hidden, which makes it a lot simpler. It might end up making some advanced features harder to implement, but I am not sure because I never used any of them.

Switching to fullscreen is also a lot easier. When I was working on the first version of AquariusSim I remember spending days working on getting that to work, but its now just a few lines of code.

The one thing I like the least about XNA is the removal of the Fixed Pipeline. The Fixed Pipeline in DirectX allowed you to render objects using simple Lighting Objects and not have to worry about learning another programming language to implement shaders. XNA has removed this functionality and requires shaders to be written for everything. This means that the programmer has to either learn a completely new langauge, or they have to just use other people’s shaders without understanding how to change them. This could end up being a serious block to new game developers.

Overall, I think Microsoft made some really good decisions for XNA and I think that for someone experienced with 3D graphics it will be an easy switch. But as before, there are some serious roadblocks that could make aspiring game developers give up before they get very far into it.

Now, back to working on this port. Hopefully I should have some screenshots up soon and maybe even some code examples of what I am doing.

in480.com Beta Sign-ups Now Open

We have just opened up sign-ups for the beta of in480.com. in480 is a new online speed dating website where you can meet people to date or just as friends. Our matching system matches you with people who you will be interested in and gives you tips to get the conversation started.

If you sign up on our website, you could be one of the first people to be able to experience this new website that I have been working on for the last few months. Over the next few weeks I will be posting more about our progress and what is happening with the site. We will also be trying to get a developer blog set up where the other people working on the site can post as well and I will provide a link to that from here.

In the meantime, go over to in480.com and sign up to get an invite to the beta.

Aquarius Simulator XNA

If you talked to me a few months ago, you will know that I was working on a game using C# and DirectX. The last few months have been pretty busy so I haven’t worked on it in a while, but I am going to start trying to convert it over to XNA.

XNA is the new version of managed DirectX and will allow me to (once I get one) port the game over to the XBox360 pretty easily. Since Microsoft is moving all of their development over to XNA I figure it will allow me to avoid work trying to move over to it later.

I am going to be learning XNA through some tutorials by the same person who I got a lot of the code for the first version from. You can see the tutorial on his site at http://www.thehazymind.com/XNAEngine.htm. As I go through those, I hope to also start my own series of tutorials or at least walk-throughs of how my development is going.

For those of you who don’t know, the game is going to be a simulator similar to the SimCity line of games. The difference is that I am basing it on the idea of Aquarius from the book The Millennial Project. This means that the game will consist of managing a floating island city.

I will be posting more about this as I continue working on it, so look for more soon.

New Blog

Well, after years of thinking about it, I have actually set up a blog. And for the first time since the old site (or a blank white page) the ra726.net domain is actually being used.

I am going to start using this to keep track of all my various projects and get some feedback on them. Maybe this will actually motivate me to finish some things I have been working on for a while ;).

(And yes, I know that I need to do more work on the style of this site. But at least I didn’t just leave it completely default)