diff options
-rw-r--r-- | bin/SDL2.dll | bin | 771072 -> 771072 bytes | |||
-rw-r--r-- | bin/cembed.exe | bin | 11264 -> 11264 bytes | |||
-rw-r--r-- | bin/jin.exe | bin | 572928 -> 572928 bytes | |||
-rw-r--r-- | bin/lua51.dll | bin | 364544 -> 364544 bytes | |||
-rw-r--r-- | samples/post-processing/main.lua | 23 | ||||
-rw-r--r-- | src/libjin/graphics/shaders/je_shader.cpp | 22 |
6 files changed, 32 insertions, 13 deletions
diff --git a/bin/SDL2.dll b/bin/SDL2.dll Binary files differindex 9859a9c..0015b07 100644 --- a/bin/SDL2.dll +++ b/bin/SDL2.dll diff --git a/bin/cembed.exe b/bin/cembed.exe Binary files differindex d3c0e2f..fa1f590 100644 --- a/bin/cembed.exe +++ b/bin/cembed.exe diff --git a/bin/jin.exe b/bin/jin.exe Binary files differindex dc7d697..ece88fa 100644 --- a/bin/jin.exe +++ b/bin/jin.exe diff --git a/bin/lua51.dll b/bin/lua51.dll Binary files differindex b054a3f..66f6326 100644 --- a/bin/lua51.dll +++ b/bin/lua51.dll diff --git a/samples/post-processing/main.lua b/samples/post-processing/main.lua index 5ed54bc..8577432 100644 --- a/samples/post-processing/main.lua +++ b/samples/post-processing/main.lua @@ -30,6 +30,8 @@ local noise = nil local radial = nil local glow = nil +local panel_shader = nil + function jin.core.onLoad() jin.log.info("=============== Start Game ===============") @@ -114,7 +116,21 @@ function jin.core.onLoad() } #END_FRAGMENT_SHADER ]] - + panel_shader = jin.graphics.newShader[[ + #VERTEX_SHADER + Vertex vert(Vertex v) + { + return v; + } + #END_VERTEX_SHADER + #FRAGMENT_SHADER + Color frag(Color col, Texture tex, Vertex v) + { + col.a *= v.uv.x; + return col; + } + #END_FRAGMENT_SHADER + ]] pp = jin.graphics.newShaderf("./shaders/curling.jsl") pixel = jin.graphics.newShaderf("./shaders/pixel.jsl") @@ -144,6 +160,7 @@ function jin.core.onLoad() </test> ]] jin.log.info(xml.test["@one"]) + jin.graphics.showWindow() end @@ -201,8 +218,8 @@ function jin.core.onDraw() jin.graphics.rect(jin.graphics.RenderMode.FILL, 300, 300, 100, 50) jin.graphics.unuseShader() - jin.graphics.setColor(100, 100, 100, 100) - jin.graphics.useShader(jin.graphics.Shaders.Shape) + jin.graphics.setColor(100, 100, 100, 255) + jin.graphics.useShader(panel_shader) jin.graphics.rect(jin.graphics.RenderMode.FILL, 440, 0, 140, 150) jin.graphics.unuseShader() jin.graphics.setColor(255, 255, 255, 255) diff --git a/src/libjin/graphics/shaders/je_shader.cpp b/src/libjin/graphics/shaders/je_shader.cpp index 4fa3b9e..6235128 100644 --- a/src/libjin/graphics/shaders/je_shader.cpp +++ b/src/libjin/graphics/shaders/je_shader.cpp @@ -89,7 +89,9 @@ namespace JinEngine sendVec2(SHADER_RENDERTARGET_SIZE, rt->getWidth(), rt->getHeight()); } // Reset attribute index. - mAttributeIndex = 0; + for(; mAttributeIndex > 0; --mAttributeIndex) + glDisableVertexAttribArray(mAttributeIndex); + return *this; } @@ -103,15 +105,15 @@ namespace JinEngine return false; } - #define glsl(SHADER_MODE, SHADER, SRC) \ - do{ \ - const GLchar* src = SRC.c_str(); \ - glShaderSource(SHADER, 1, &src, NULL); \ - glCompileShader(SHADER); \ - GLint success; \ - glGetShaderiv(SHADER, GL_COMPILE_STATUS, &success); \ - if (success == GL_FALSE) \ - return false; \ + #define glsl(SHADER_MODE, SHADER, SRC) \ + do{ \ + const GLchar* src = SRC.c_str(); \ + glShaderSource(SHADER, 1, &src, NULL); \ + glCompileShader(SHADER); \ + GLint success; \ + glGetShaderiv(SHADER, GL_COMPILE_STATUS, &success); \ + if (success == GL_FALSE) \ + return false; \ }while(0) // Compile vertex shader. |