Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Fri Feb 28, 2020 8:03 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Jan 12, 2014 7:37 am 
User avatar

Joined: Wed Oct 30, 2013 11:46 pm
Posts: 30
I am working with VERY small sprites. 16x16.
I have a little guy on screen that doesn't move and sits idle. No issue with that. The sprite looks perfect and, even if I put it fullscreen, the sprite (obviously) looks pixelated but fine.

There is another guy on screen. This other sprite is both animated and can be moved across the screen.
The animation is perfect and everything works fine. I enlarge the window and again, everything works fine.

The problem is that when I move the little guy around, some shading happens. No idea why. The pixel start looking very weird and the dude is barely visible at times. I think it has something to do with either size or precision (but I am using floats) but I really don't understand why this happens.

My drawing function in Graphics is similar to the one in the Kelly-s engine. I also copyed the Kelly-s engine drawing functions to see if the result was different but it's the same. What;'s going on?
Now that I put Spacewar on fullscreen I can see that the same is happening with the moving spaceship. The border sometimes disappears. Why is this happening? (of course in SPacewar this is happening much less than in my game. I am attaching both code and pictures for you to see) Is anybody else experiencing this or is it just my laptop?


You do not have the required permissions to view the files attached to this post.

Reply with quote  
PostPosted: Wed Jan 15, 2014 1:10 pm 
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 554
This is a result of the default texture filtering that DirectX is using. Check out the Texture Filter Demo on this page:

There is not much we can do to correct the issue except for changing the resolution of the sprite and screen. The problem arises because we are asking DirectX to render sub-pixel information. The default behavior that DirectX uses is to sample the surrounding pixels and interpolate what the sub-pixel data should be.

Professor Kelly

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group