Solution

Files changed (1) hide show
  1. lab2-textures/lab2_main.cpp +6 -4
lab2-textures/lab2_main.cpp CHANGED
@@ -136,10 +136,12 @@ void initialize()
136
136
  glGenTextures(1, &texture);
137
137
  glBindTexture(GL_TEXTURE_2D, texture);
138
138
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
139
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
140
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
141
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
142
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
139
+ glGenerateMipmap(GL_TEXTURE_2D);
140
+ // Sets the type of filtering to be used on magnifying and
141
+ // minifying the active texture. These are the nicest available options.
142
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
143
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
144
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
143
145
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
144
146
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
145
147
  glBindTexture(GL_TEXTURE_2D, 0);