|
@ -81,23 +81,23 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
originalProgram.DetectAttribute("texcoord"); |
|
|
originalProgram.DetectAttribute("texcoord"); |
|
|
originalProgram.DetectUniform("U_MainTexture"); |
|
|
originalProgram.DetectUniform("U_MainTexture"); |
|
|
|
|
|
|
|
|
//init erosion program
|
|
|
|
|
|
GPUProgram erosionProgram; |
|
|
|
|
|
erosionProgram.AttachShader(GL_VERTEX_SHADER, "res/shader/fullscreenquad.vs"); |
|
|
|
|
|
erosionProgram.AttachShader(GL_FRAGMENT_SHADER, "res/shader/fullscreenquad_erosion.fs"); |
|
|
|
|
|
erosionProgram.Link(); |
|
|
|
|
|
erosionProgram.DetectAttribute("pos"); |
|
|
|
|
|
erosionProgram.DetectAttribute("texcoord"); |
|
|
|
|
|
erosionProgram.DetectUniform("U_MainTexture"); |
|
|
|
|
|
|
|
|
|
|
|
//init dilation program
|
|
|
|
|
|
GPUProgram dilationProgram; |
|
|
|
|
|
dilationProgram.AttachShader(GL_VERTEX_SHADER, "res/shader/fullscreenquad.vs"); |
|
|
|
|
|
dilationProgram.AttachShader(GL_FRAGMENT_SHADER, "res/shader/fullscreenquad_dilation.fs"); |
|
|
|
|
|
dilationProgram.Link(); |
|
|
|
|
|
dilationProgram.DetectAttribute("pos"); |
|
|
|
|
|
dilationProgram.DetectAttribute("texcoord"); |
|
|
|
|
|
dilationProgram.DetectUniform("U_MainTexture"); |
|
|
|
|
|
|
|
|
//init vertical program
|
|
|
|
|
|
GPUProgram verticalProgram; |
|
|
|
|
|
verticalProgram.AttachShader(GL_VERTEX_SHADER, "res/shader/fullscreenquad.vs"); |
|
|
|
|
|
verticalProgram.AttachShader(GL_FRAGMENT_SHADER, "res/shader/fullscreenquad_gaussian_vertical.fs"); |
|
|
|
|
|
verticalProgram.Link(); |
|
|
|
|
|
verticalProgram.DetectAttribute("pos"); |
|
|
|
|
|
verticalProgram.DetectAttribute("texcoord"); |
|
|
|
|
|
verticalProgram.DetectUniform("U_MainTexture"); |
|
|
|
|
|
|
|
|
|
|
|
//init horizontal program
|
|
|
|
|
|
GPUProgram horizontalProgram; |
|
|
|
|
|
horizontalProgram.AttachShader(GL_VERTEX_SHADER, "res/shader/fullscreenquad.vs"); |
|
|
|
|
|
horizontalProgram.AttachShader(GL_FRAGMENT_SHADER, "res/shader/fullscreenquad_gaussian_horizontal.fs"); |
|
|
|
|
|
horizontalProgram.Link(); |
|
|
|
|
|
horizontalProgram.DetectAttribute("pos"); |
|
|
|
|
|
horizontalProgram.DetectAttribute("texcoord"); |
|
|
|
|
|
horizontalProgram.DetectUniform("U_MainTexture"); |
|
|
|
|
|
|
|
|
//init dilation program
|
|
|
//init dilation program
|
|
|
GPUProgram gaussianProgram; |
|
|
GPUProgram gaussianProgram; |
|
@ -245,11 +245,11 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
fsq.DrawToLeftTop(originalProgram.GetLocation("pos"), originalProgram.GetLocation("texcoord")); |
|
|
fsq.DrawToLeftTop(originalProgram.GetLocation("pos"), originalProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glUseProgram(erosionProgram.mProgram); |
|
|
|
|
|
fsq.DrawToRightTop(erosionProgram.GetLocation("pos"), erosionProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
glUseProgram(verticalProgram.mProgram); |
|
|
|
|
|
fsq.DrawToRightTop(verticalProgram.GetLocation("pos"), verticalProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
glUseProgram(dilationProgram.mProgram); |
|
|
|
|
|
fsq.DrawToLeftBottom(dilationProgram.GetLocation("pos"), dilationProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
glUseProgram(horizontalProgram.mProgram); |
|
|
|
|
|
fsq.DrawToLeftBottom(horizontalProgram.GetLocation("pos"), horizontalProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
glUseProgram(gaussianProgram.mProgram); |
|
|
glUseProgram(gaussianProgram.mProgram); |
|
|
glBindTexture(GL_TEXTURE_2D, fbo2.GetBuffer("color")); |
|
|
glBindTexture(GL_TEXTURE_2D, fbo2.GetBuffer("color")); |
|
|