Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clamp textures.

avoids artefacts on texture borders.
  • Loading branch information...
commit 8897707a9f59cf4f4f005cb9e5eebccce7aa88d1 1 parent 6a8a345
@dividuum authored
Showing with 4 additions and 0 deletions.
  1. +2 −0  framebuffer.c
  2. +2 −0  image.c
View
2  framebuffer.c
@@ -53,6 +53,8 @@ void make_framebuffer(int width, int height, GLuint *tex, GLuint *fbo) {
glBindTexture(GL_TEXTURE_2D, *tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_INT, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, *tex, 0);
View
2  image.c
@@ -85,6 +85,8 @@ int image_from_current_framebuffer(lua_State *L, int width, int height, int mipm
GLint filter = mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
Please sign in to comment.
Something went wrong with that request. Please try again.