• Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

DIrectX 9 Woes...

Sign in to follow this  


I got a DirectX 9 Driver up and running, but I am having an issue rendering with a vertex buffer. I wrote a caching system that uses 1 dynamic vertex buffer and keeps track of each brush using a vector of a struct that contains the following information:

1. Starting vertex in the VB
2. Number of primitives
3. Number of texture layers
4. The texture array
5. Rendering flags (Alpha blending, Z buffer stuff, ...)

Before DrawPrimitive() is called, I sort the brushes by texture. The Flush() function only changes texture if the texture id is different from the previous one. I am using triangle fans to render as the engine is optimized for that right now.

The original way I did it worked, but was unoptimal. I originally just filled the vertex buffer with the one brush then called DrawPrimitive(). When I switched to the new way, I get a "polygon soup". In otherwords, the level looks exploded. If I figure it out, version 1 of my driver is done. Next step would be to get the world into 1 static vertex buffer.

Old Way (one brush then flush vertex buffer):

New way (fill dynamic vertex buffer, render using saved brush data):
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement