Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Pixel perfect sprite rendering
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mike Wyatt  
View profile  
 More options Oct 27 2010, 11:04 pm
From: Mike Wyatt <mikejohnwy...@gmail.com>
Date: Wed, 27 Oct 2010 22:04:44 -0500
Local: Wed, Oct 27 2010 11:04 pm
Subject: Pixel perfect sprite rendering

I'm rendering a hex map with a batched set of sprites (one per cell).  The
batch looks pretty good, but on close inspection I can see that the pixels
are not rendered exactly as the source image.

Here's a image with the original image and a small cropped view of a few
rendered sprites in the hex grid:
http://img830.imageshack.us/img830/812/hexes.png

I'm guessing I either need to adjust the modelview transformation or change
some gl* setting.  I've played around with GL_TEXTURE_MIN_FILTER and
GL_TEXTURE_MAG_FILTER and glHint, but haven't had any luck.

How can I fix this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tristam MacDonald  
View profile  
 More options Oct 27 2010, 11:31 pm
From: Tristam MacDonald <swiftco...@gmail.com>
Date: Wed, 27 Oct 2010 23:31:08 -0400
Local: Wed, Oct 27 2010 11:31 pm
Subject: Re: Pixel perfect sprite rendering

On Wed, Oct 27, 2010 at 11:04 PM, Mike Wyatt <mikejohnwy...@gmail.com>wrote:

> I'm rendering a hex map with a batched set of sprites (one per cell).  The
> batch looks pretty good, but on close inspection I can see that the pixels
> are not rendered exactly as the source image.

> Here's a image with the original image and a small cropped view of a few
> rendered sprites in the hex grid:
> http://img830.imageshack.us/img830/812/hexes.png

Are you sure you didn't create a multi-sample context and request
anti-aliasing? That looks a bit like it could be anti-aliasing on the
polygon edges.

Also make sure that you disable both GL_LINE_SMOOTH and GL_POLYGON_SMOOTH,
just in case something else had enabled them.

> I'm guessing I either need to adjust the modelview transformation or change
> some gl* setting.  I've played around with GL_TEXTURE_MIN_FILTER and
> GL_TEXTURE_MAG_FILTER and glHint, but haven't had any luck.

For testing, set both your MIN and MAG filters to GL_NEAREST, to prevent any
chance of bilinear interpolation.

How can I fix this?


If none of the above did the trick, then double check your math - you might
have introduced rounding error somewhere...

--
Tristam MacDonald
http://swiftcoder.wordpress.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Wyatt  
View profile  
 More options Oct 28 2010, 12:16 am
From: Mike Wyatt <mikejohnwy...@gmail.com>
Date: Wed, 27 Oct 2010 23:16:32 -0500
Local: Thurs, Oct 28 2010 12:16 am
Subject: Re: Pixel perfect sprite rendering

Thanks, Tristam.  I tried all that, and double-checked my math, but it still
looked a little off.

I was just able to fix it, though.  The problem was in my cocos2d
initialization.  I apologize for not mentioning I was using that library in
my original post.  I started looking at the cocos2d director code after
exhausting the other options, and realized it was scaling the projection
matrix.  I added `do_not_scale=True` to the director instantiation, and the
sprites are now being drawn without any "blurriness".

From: Tristam MacDonald <swiftco...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »