Sign in to follow this  
steve coward

How can one sprite texture content affect another?

Recommended Posts

I am experiencing a dx9 graphics bug that I am unable to locate. The bug causes spurious images to be displayed for some of the sprites in my 2D game under certain circumstances. Instead of a tank being displayed, some random rectangular portion of a texture in memory will be displayed in its place. I have noticed that when I disable fog of war, the problem disappears (or at least is much, much less prevalent.) When I enable fog of war but use a blank texture tile (all pixels erased within PaintShop) for the fog, the problem also disappears. Or if I add a few random pixels of color, the problem still disappears. But add too many and the problem reappears. At first I thought my problem was either a buffer overrun or a timing/synchronization issue, but now I am not so sure. So my question is : How can the contents of one sprite affect other sprites? Regardless of the content of a texture, the contents of my vertex buffers and all other graphics data structures must be the same in each case (i.e. same u, v, x, y, z, texture references, same polygon ordering, same number of DrawPrimitive() calls, etc.), right? Any comments would be greatly appreciated.

Share this post


Link to post
Share on other sites
Whenever I got a similar problem I most often enabled texturing without assigning a texture. Do you want to render your fog of war without texturing ? In this case it could be possible that you forget to disable texturing and the according texture units ? The same problem occurs if you are using multitexturing.

A debugging hint:
Just before rendering your fog of war, sprites ... disable texturing and all texture-units, then enable only the texture units you need and texturing(or leave it disabled if you wanted to draw a blank tile).

--
Ashaman

Share this post


Link to post
Share on other sites
I am not extremely knowledgable about advanced 3d rendering concepts.
My app is 2d. Mostly I just read in graphics from png files and then
emit these graphics (or rectangular portions of them)
as part of the scene I am rendering. So I do
not think I am doing texturing. Maybe I should not have used the word texture
in my initial post. Or maybe I am not understanding.
The only render states that I change in drawing my scenes involve
transparency. Is there a render state to enable texturing?

I have not posted code from my app because it would require the
posting of a large number of lines of code and I did not
think that people would take the time to dig into it.

I could give a summary of how it operates if that would be useful.

Just posting the draw member function of a tank unit would not give
insight into the functioning of my graphics engine/game loop. It would
consist of calls to DrawString(), DrawLine(), DrawSprite(), etc. functions.
The important point is that the tank draw function does not
know anything about the fog of war. The sprites that it renders are
separate from the sprites for the fog of war.

I am hoping that an experienced graphics programmer can give me insight
into how adding pixels (within Paintshop outside of the running of the app)
on one sprite could affect the display of another sprite when the app
is running.

thanks!

Share this post


Link to post
Share on other sites

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

Sign in to follow this