Fixed unwanted tileing

This commit is contained in:
k 2025-05-03 20:47:23 -04:00
parent c582fd133c
commit 761e350aed
2 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@
#include <GLFW/glfw3.h>
#include <iostream>
#include <random>
#include <thread>
#include <utility>
#include <vector>
@ -42,12 +43,10 @@ GLuint linkProgram(std::vector<GLuint> shaders) {
return program;
}
void resizeCall(GLFWwindow *window, int width, int height) {
glViewport(0, 0, width, height);
}
int main() {
if (!glfwInit())
return -1;
@ -76,10 +75,12 @@ int main() {
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, X, Y);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
/*rnd noise*/
std::vector<GLubyte> data(GRID_SIZE*4);
std::vector<GLubyte> data(GRID_SIZE * 4);
std::mt19937 rng;
std::uniform_int_distribution<int> dist(0, 1);
for (int i = 0; i < GRID_SIZE; ++i) {
@ -148,6 +149,7 @@ int main() {
glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, (void *)0);
std::this_thread::sleep_for(std::chrono::duration<double>(.05));
glfwSwapBuffers(w);
std::swap(ri, wi);

View File

@ -44,7 +44,7 @@ out vec2 TexCoord;
void main()
{
gl_Position = vec4(aPos, 1.0);
TexCoord = aTexCoord;
TexCoord = aTexCoord + vec2(1,1);
}
)glsl";
@ -58,7 +58,7 @@ uniform sampler2D tex0;
void main()
{
FragColor = texture(tex0, TexCoord);
FragColor = texture(tex0, TexCoord/vec2(2,2));
}
)glsl";