Texture in OpenGL ES 2 looks pixelated

Moderator
Posts: 1,552
Joined: 2003.10
Post: #5
(Aug 26, 2011 09:29 AM)vunterslaush Wrote:  Ok fixed it. I changed glViewPort and I multiplied by 2 the width and height.
Does that make any sense or my programming is way off?

Multiplying by 2 will be correct for the specific case you're writing for at the moment, but isn't particularly futureproof, and would mean you'd have to use different code depending on whether you're running on a retina display or not. That's fine if you're only writing for iPhone 4, but if you want your code to run on a iPad or an older iPhone (or a newer one with potentially a different resolution), you may want a more general approach. I do it like this:

Code:
    GLint backingWidth, backingHeight;
    
    glGetRenderbufferParameterivOES(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);
    glGetRenderbufferParameterivOES(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);
    glViewport(0, 0, backingWidth, backingHeight);

(Aug 26, 2011 09:29 AM)vunterslaush Wrote:  (BTW, still doesn't look as good as UIImageView)...

Another comparison screenshot, maybe? The UIImageView in your previous one looks like simple linear magnification to me, so I'd expect GL to do just as good a job of it...

(Aug 26, 2011 09:10 AM)vunterslaush Wrote:  BTW, when I'm running the simulator, when my device is the normal iPhone it shows a picture of an iPhone4, so I thought that it would simulate retina support, but it doesn't, and when I choose iPhone (retina) it show's an iPad, but it actually simulating a retina iPhone :| not a big deal but I'm wondering if it's like that for everyone or is it just me.

Yeah, the simulator's window doesn't look like an iPhone in retina mode for some reason. It should be the correct size for a retina display, though, whereas the iPad simulator window is somewhat smaller with a wider aspect ratio.
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Texture in OpenGL ES 2 looks pixelated - ThemsAllTook - Aug 26, 2011 10:32 AM
Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL ES Texture Compression ajrs84 9 522 May 7, 2013 03:36 PM
Last Post: ajrs84
  OpenGL ES Texture Masking airfire 5 11,477 Nov 14, 2012 09:36 AM
Last Post: toanNguyen
  OpenGL ES Texture Masking dalasjoe sin 0 3,150 Apr 13, 2012 12:17 AM
Last Post: dalasjoe sin
  Lighting and changing texture colors in OpenGL agreendev 2 6,134 Aug 13, 2010 03:47 PM
Last Post: agreendev
  OpenGL ES Texture Problems jhbau1000 1 4,426 Jul 12, 2010 05:57 AM
Last Post: Kezhaya