Permalink
Browse files

mipmapping

  • Loading branch information...
1 parent 050ae65 commit cfe5ef9b7b375a19f3e4b5eb5e3d83b81a2b6b30 @dividuum committed Feb 26, 2012
Showing with 15 additions and 6 deletions.
  1. +3 −2 image.c
  2. +4 −2 video.c
  3. +6 −2 vnc.c
  4. +2 −0 vnc.h
View
@@ -254,10 +254,11 @@ static int load_png(const char *filename, int *width, int *height) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, *width, *height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ glGenerateMipmap(GL_TEXTURE_2D);
free(pixels);
glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
View
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <unistd.h>
+#include <GL/glew.h>
#include <GL/gl.h>
#include <lauxlib.h>
#include <lualib.h>
@@ -271,6 +272,7 @@ static int video_next(lua_State *L) {
GL_UNSIGNED_BYTE,
video->buffer
);
+ glGenerateMipmap(GL_TEXTURE_2D);
lua_pushboolean(L, 1);
return 1;
@@ -323,8 +325,8 @@ int video_load(lua_State *L, const char *path, const char *name) {
glGenTextures(1, &video.tex);
glBindTexture(GL_TEXTURE_2D, video.tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(
GL_TEXTURE_2D,
0,
View
8 vnc.c
@@ -1,3 +1,5 @@
+/* See Copyright Notice in LICENSE.txt */
+
#define _BSD_SOURCE
#include <assert.h>
#include <stdlib.h>
@@ -10,6 +12,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <GL/glew.h>
#include <GL/gl.h>
#include <lauxlib.h>
#include <lualib.h>
@@ -215,6 +218,7 @@ static int vnc_decode(vnc_t *vnc, const unsigned char *pixels) {
GL_UNSIGNED_BYTE,
converted
);
+ glGenerateMipmap(GL_TEXTURE_2D);
return 1;
}
@@ -389,8 +393,8 @@ static void vnc_read_server_init(vnc_t *vnc) {
glGenTextures(1, &vnc->tex);
glBindTexture(GL_TEXTURE_2D, vnc->tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(
GL_TEXTURE_2D,
0,
View
2 vnc.h
@@ -1,3 +1,5 @@
+/* See Copyright Notice in LICENSE.txt */
+
#ifndef VNC_H
#define VNC_H

0 comments on commit cfe5ef9

Please sign in to comment.