OpenGL texture renders with very low quality

Due to performance bottlenecks in Core Graphics, I'm trying to use OpenGL EL on iOS to draw a 2D scene, but OpenGL is rendering my images at an incredibly low resolution.

Here's part of the image I'm using (in Xcode):

在这里输入图像描述

And OpenGL's texture rendering (in simulator):

在这里输入图像描述

I'm using Apple's Texture2D to create a texture from a PNG, and then to draw it to the screen. I'm using an Ortho projection to look straight down on the scene as was recommended in Apress' Beginning iPhone Development book. The image happens to be the exact size of the screen and is drawn as such (I didn't take the full image in the screenshots above). I'm not using any transforms on the model, so drawing the image should cause no sub-pixel rendering.

I'm happy to post code examples, but thought I'd start without in the case that there's a simple explanation.

Why would the image lose so much quality using this method? Am I missing a step in my environment setup? I briefly read about textures performing better as sizes of powers of two -- does this matter on the iPhone? I also read about multisampling, but I wasn't sure if that was related.

Edit: Updated screen shots so as to alleviate confusion.


I still don't fully understand why I was having quality issues with my code, but I managed to work around the problem. I was originally using the OpenGLES2DView class provided by the makers of the Apress book "Beginning iPhone 4 Development", and I suspect the problem lied somewhere within this code. I then came across this tutorial which suggested I use GLKit instead. GLKit allowed me to do exactly what I wanted!

A few lessons learned:

  • Using GLKit and the sprites class in the tutorial linked above, my textures don't need to be powers of two. GLKit seems to handle this fine.

  • Multisampling was not the solution to the problem. With GLKit, using multisampling seemingly has no effect (to my eye) when rendering 2D graphics.

  • Thanks all who tried to help.

    链接地址: http://www.djcxy.com/p/5818.html

    上一篇: lwjgl并渲染为纹理

    下一篇: OpenGL纹理以非常低的质量渲染