iDevGames Forums
Texture in OpenGL ES 2 looks pixelated - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Texture in OpenGL ES 2 looks pixelated (/thread-9305.html)

Pages: 1 2


RE: Texture in OpenGL ES 2 looks pixelated - OneSadCookie - Aug 30, 2011 04:04 PM

Well, glVertexAttrib[Pointer] with those values, since it's ES2. But yes.


RE: Texture in OpenGL ES 2 looks pixelated - vunterslaush - Aug 30, 2011 04:39 PM

(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?


RE: Texture in OpenGL ES 2 looks pixelated - ThemsAllTook - Aug 30, 2011 06:41 PM

(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.


RE: Texture in OpenGL ES 2 looks pixelated - Frogblast - Aug 30, 2011 09:44 PM

(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.