- Timestamp:
- 11/18/08 16:24:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3135 r3136 420 420 /////////////////// 421 421 422 string aaParams[] = {"colors", "normals" };423 sCgAntiAliasingProgram->AddParameters(aaParams, 0, 2);422 string aaParams[] = {"colors", "normals", "offsets"}; 423 sCgAntiAliasingProgram->AddParameters(aaParams, 0, 3); 424 424 425 425 ///////////////////// … … 658 658 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 659 659 GLuint colorsTex = colorBuffer->GetTexture(); 660 GLuint normalsTex = fbo->GetColorBuffer( 2)->GetTexture();660 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 661 661 662 662 //FrameBufferObject::Release(); … … 664 664 // read the second buffer, write to the first buffer 665 665 FlipFbos(fbo); 666 666 667 // the neighbouring texels 668 float xOffs = 1.0f / fbo->GetWidth(); 669 float yOffs = 1.0f / fbo->GetHeight(); 667 670 668 671 sCgAntiAliasingProgram->SetTexture(0, colorsTex); 669 672 sCgAntiAliasingProgram->SetTexture(1, normalsTex); 670 673 671 sCgAntiAliasingProgram->Bind(); 672 673 glBegin(GL_QUADS); 674 675 // the neighbouring texels 676 float x_offs = 1.0f / mWidth; 677 float y_offs = 1.0f / mHeight; 678 679 SetVertex(0, 0, x_offs, y_offs); 680 SetVertex(1, 0, x_offs, y_offs); 681 SetVertex(1, 1, x_offs, y_offs); 682 SetVertex(0, 1, x_offs, y_offs); 683 684 glEnd(); 674 float offsets[16]; 675 int i = 0; 676 677 offsets[i] = -xOffs; offsets[i + 1] = yOffs; i += 2; // left top 678 offsets[i] = xOffs; offsets[i + 1] = -yOffs; i += 2; // right bottom 679 offsets[i] = xOffs; offsets[i + 1] = yOffs; i += 2; // right top 680 offsets[i] = -xOffs; offsets[i + 1] = -yOffs; i += 2; // left bottom 681 offsets[i] = -xOffs; offsets[i + 1] = .0f; i += 2; // left 682 offsets[i] = xOffs; offsets[i + 1] = .0f; i += 2; // right 683 offsets[i] = .0f; offsets[i + 1] = yOffs; i += 2; // top 684 offsets[i] = .0f; offsets[i + 1] = -yOffs; i += 2; // bottom 685 686 sCgAntiAliasingProgram->SetArray2f(2, offsets, 8); 687 688 DrawQuad(sCgAntiAliasingProgram); 685 689 686 690 PrintGLerror("antialiasing");
Note: See TracChangeset
for help on using the changeset viewer.