Float mosaic uniform

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 9 months ago
parent 48de98433b
commit 83f5e9bc3a
  1. 2
      C++ProjectTemplate.js
  2. BIN
      C++ProjectTemplate.wasm
  3. 6
      pixelGameEngine.h
  4. BIN
      pixelGameEngine_wasm.o

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -4872,13 +4872,13 @@ namespace olc
"layout(location = 2) in vec4 aCol;\n" "layout(location = 2) in vec4 aCol;\n"
"out vec2 oTex;\n" "out vec2 oTex;\n"
"out vec4 oCol;\n" "out vec4 oCol;\n"
"uniform float mosaic;\n" "uniform int mosaic;\n"
"\n" "\n"
"void main(){\n" "void main(){\n"
"float p = 1.0 / aPos.z;\n" "float p = 1.0 / aPos.z;\n"
"gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n" "gl_Position = p * vec4(aPos.x, aPos.y, 0.0, 1.0);\n"
"oTex = p * aTex;\n" "oTex = p * aTex;\n"
"oCol = vec4(aCol.r,mosaic,0,aCol.a);\n" "oCol = vec4(aCol.r,float(mosaic)/255.0,0,aCol.a);\n"
"}"; "}";
locShaderSource(m_nVS, 1, &strVS, NULL); locShaderSource(m_nVS, 1, &strVS, NULL);
locCompileShader(m_nVS); locCompileShader(m_nVS);
@ -4963,7 +4963,7 @@ namespace olc
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
locUseProgram(m_nQuadShader); locUseProgram(m_nQuadShader);
GLint myUniformLocation = glGetUniformLocation(m_nQuadShader, "mosaic"); GLint myUniformLocation = glGetUniformLocation(m_nQuadShader, "mosaic");
glUniform1f(myUniformLocation,1.0f); glUniform1i(myUniformLocation,0);
locBindVertexArray(m_vaQuad); locBindVertexArray(m_vaQuad);
#if defined(OLC_PLATFORM_EMSCRIPTEN) #if defined(OLC_PLATFORM_EMSCRIPTEN)

Binary file not shown.
Loading…
Cancel
Save