PDA

View Full Version : relating to opengl graphics pipeline



zero_t9
01-11-2005, 10:09 PM
Hi,

In DirectX, we have TextureStageStates which is very easy to understand the whole blend processes. In opengl, suppose I have a rect. It has 4 vertices (from Nehe lesson 8) as below. It is easy to get the color of four vertices. My questions are
1. how does OpenGL calculate the colors for pixels within the rect?
2. if I enalbe blend, for one face, how many blend stages will OpenGL have? Does it have 2 phases
phase 1: background + vertices
phase 2: phase 1 + texture ?
3. If I enable blend, will all 6 faces be drawn with transparency or just those face viewers?

thanks,

tSb

glColor4f(1.0f, 1.0f, 1.0f, 0.5);
glBegin(GL_QUADS);
// Front Face
glNormal3f( 0.0f, 0.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);

zeckensack
01-11-2005, 11:20 PM
Originally posted by /* tSb */:
1. how does OpenGL calculate the colors for pixels within the rect?
2. if I enalbe blend, for one face, how many blend stages will OpenGL have? Does it have 2 phases
phase 1: background + vertices
phase 2: phase 1 + texture ?Blending, in GL terminology, only refers to framebuffer blending aka alpha blending. That's the last color blending step before the framebuffer update.
All other "blend stages" are referred to as texture environments. In a multitexturing scenario, each texture unit has its own texture environment, which can operate in one of several modes. These are daisy chained together. If the implementation doesn't support multitexturing, there's only one texture environment.

ASCII art warning
3. If I enable blend, will all 6 faces be drawn with transparency or just those face viewers?Not sure what you mean. Every fragment that doesn't get discarded by any of the tests (depth test, stencil test, alpha test) will be subject to blending.
If you mean face culling, faces that are discarded in the culling stage will not make it that far, so obviously they can't (and won't) be blended.