Texture in OpenGL ES 2 looks pixelated

Luminary
Posts: 5,143
Joined: 2002.04
Post: #16
Well, glVertexAttrib[Pointer] with those values, since it's ES2. But yes.
Quote this message in a reply
Member
Posts: 25
Joined: 2011.08
Post: #17
(Aug 30, 2011 12:29 PM)ThemsAllTook Wrote:  
(Aug 30, 2011 11:25 AM)vunterslaush Wrote:  How do I submit premultiplied vertex colors?

I think he means you should do glColor4f(r*a, g*a, b*a, a) instead of glColor4f(r, g, b, a) while you're using GL_ONE, GL_ONE_MINUS_SRC_ALPHA.

Oh so if I'm using an array of colors per vertex, instead of
Code:
static const GLfloat squareColors[] = {
        1.0f,0.0f,0.0f,0.5f,
        1.0f,0.0f,0.0f,0.5f,
        1.0f,0.0f,0.0f,0.5f,
        1.0f,0.0f,0.0f,0.5f,
    };

I should write
Code:
static const GLfloat squareColors[] = {
        0.5f,0.0f,0.0f,0.5f,
        0.5f,0.0f,0.0f,0.5f,
        0.5f,0.0f,0.0f,0.5f,
        0.5f,0.0f,0.0f,0.5f,
    };

Yes?


EDIT:
Another question- I noticed that in the template it binds the render buffer every frame, and in the example that I've used so far that wasn't the case. Why is that, and what is the best way to do it?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #18
(Aug 30, 2011 04:39 PM)vunterslaush Wrote:  Yes?

Yep, that's it!

(Aug 30, 2011 04:39 PM)vunterslaush Wrote:  EDIT:
Another question- I noticed that in the template it binds the render buffer every frame, and in the example that I've used so far that wasn't the case. Why is that, and what is the best way to do it?

Presumably that's just defensive programming on the template's part, in case another part of the program binds a different renderbuffer. If you're not changing the renderbuffer anywhere, it should be safe to only bind it once, I think.
Quote this message in a reply
Member
Posts: 87
Joined: 2006.08
Post: #19
(Aug 30, 2011 06:41 PM)ThemsAllTook Wrote:  
(Aug 30, 2011 04:39 PM)vunterslaush Wrote:  EDIT:
Another question- I noticed that in the template it binds the render buffer every frame, and in the example that I've used so far that wasn't the case. Why is that, and what is the best way to do it?

Presumably that's just defensive programming on the template's part, in case another part of the program binds a different renderbuffer. If you're not changing the renderbuffer anywhere, it should be safe to only bind it once, I think.

It was half defensive programming, and half just trying to have clear code. In simpler apps, it will be redundant, but the intention of the code is much clearer when you don't have to refer to code 'somewhere else' to know what renderbuffer is being operated on.

It is redundant, but it isn't a performance issue. Small instances of once-per-frame overhead will never be a practical problem, unless you're drawing 1,000 frames per second.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL ES Texture Masking airfire 6 15,205 Mar 17, 2014 07:07 PM
Last Post: baioses
  OpenGL ES Texture Compression ajrs84 9 4,726 May 7, 2013 03:36 PM
Last Post: ajrs84
  OpenGL ES Texture Masking dalasjoe sin 0 3,926 Apr 13, 2012 12:17 AM
Last Post: dalasjoe sin
  Lighting and changing texture colors in OpenGL agreendev 2 7,880 Aug 13, 2010 03:47 PM
Last Post: agreendev
  OpenGL ES Texture Problems jhbau1000 1 5,381 Jul 12, 2010 05:57 AM
Last Post: Kezhaya