[SOLVED]OpenGL edges of textures
I've finally got pixel-perfect rasterization of my textures on integer tex coords for my 2d game (pong). At first I used GL_NEAREST, but that looked bad because you could tell it was jumping from one pixel to the next. So I used GL_LINEAR, and it looked great, the pixels smoothly transition, fading in to the next location (which you can see when the ball speed is very slow). However, the edges of the ball don't do this. They just disappear on one side and appear on the other. I guess this is because they are on the edges of the texture so there isn't enough neighbours to interpolate the colour, but what else can I do? I tried adding a 1 pixel alpha border around the textures and that worked, but it's a big hassle and it messes things up when the viewport is resized.
I'm pretty sure this isn't what AA is for, but I tried it anyway and it did work like I wanted it to sort of, but it didn't seem to be interpolating every frame, more like 3-4 times per second, even with 16 super/multi samples.
Thanks.
I'm pretty sure this isn't what AA is for, but I tried it anyway and it did work like I wanted it to sort of, but it didn't seem to be interpolating every frame, more like 3-4 times per second, even with 16 super/multi samples.
Thanks.
Vertex coordinates are quantized during rasterization to integral pixels (or MSAA samples.)
Texture coordinates are interpolated during rasterization; you see sub-pixel filtering within each pixel that was produced by rasterization.
You need an alpha border.
Texture coordinates are interpolated during rasterization; you see sub-pixel filtering within each pixel that was produced by rasterization.
You need an alpha border.
Ok I was thinking that when I resized the window and use glViewport, it would be the alpha border would be double. But I was confusing my input with OpenGL's output. The thing I was worrying about was the ball rebounding off the alpha border, before it appears to actually hit, but I just need to make sure my game logic rects don't include the alpha border.
Thanks for the quick reply.
Thanks for the quick reply.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Create Aquaria-like terrain- texturing edges | AndyKorth | 3 | 5,412 |
Jul 31, 2011 08:13 PM Last Post: FlamingHairball |
|
| Replacing edges with degenerate quads (for shadow volumes) | Coyote | 9 | 6,458 |
Jan 15, 2010 07:08 PM Last Post: Coyote |
|
| OpenGL Image Textures | mikey | 52 | 20,228 |
Jun 30, 2009 10:42 AM Last Post: AnotherJake |
|
| Dealing with inverted textures in OpenGL | johncmurphy | 7 | 5,921 |
Jun 15, 2009 08:11 AM Last Post: Skorche |
|
| Using textures OpenGL switches to software renderer | bruno | 2 | 3,140 |
Oct 12, 2008 03:06 AM Last Post: bruno |
|

