Ver código fonte

Enable linear filtering for font texture

Thomas Buck 11 anos atrás
pai
commit
65322cea33
5 arquivos alterados com 11 adições e 42 exclusões
  1. 4
    1
      ChangeLog
  2. 1
    1
      Makefile
  3. 0
    3
      src/GLString.cpp
  4. 0
    35
      src/SDLSystem.cpp
  5. 6
    2
      src/Texture.cpp

+ 4
- 1
ChangeLog Ver arquivo

@@ -6,9 +6,12 @@
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8 8
 	[ 20140119 ]
9
+	* Enabled linear texture filtering for fonts, resulting in nicer
10
+	  looking down scaling
9 11
 	* Removed unused TGA font parts of GLString with slight API changes
10 12
 	* Modified GLString Unit Test to work with new GLString
11
-	* Removed unused glDrawGrid & glDrawAxis from SDLSystem
13
+	* Removed unused glDrawGrid, glDrawAxis, glPrintf2d, glPrintf3d
14
+	  from SDLSystem
12 15
 	* Silenced many more warnings
13 16
 
14 17
 	[ 20140118 ]

+ 1
- 1
Makefile Ver arquivo

@@ -110,7 +110,7 @@ LD_FLAGS=-L/usr/X11/lib -lXmu -lXt -lSM -lICE -lXext -lX11 -lXi \
110 110
 	 -lm $(BASE_LIBS)
111 111
 
112 112
 RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
113
-	-fomit-frame-pointer -O2
113
+	-fomit-frame-pointer -O2 -Wall
114 114
 
115 115
 DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 $(DEBUG_DEFS) $(WARNINGS)
116 116
 

+ 0
- 3
src/GLString.cpp Ver arquivo

@@ -54,9 +54,6 @@ GLString::~GLString()
54 54
 
55 55
 void GLString::Init(unsigned int max_strings)
56 56
 {
57
-	unsigned int i;
58
-
59
-
60 57
 	if (!max_strings)
61 58
 	{
62 59
 		return;

+ 0
- 35
src/SDLSystem.cpp Ver arquivo

@@ -98,41 +98,6 @@ void SDLSystem::bindKeyCommand(const char *cmd, int key, int event)
98 98
 #endif
99 99
 
100 100
 
101
-
102
-void SDLSystem::glPrintf2d(float x, float y, char *string)
103
-{
104
-#ifdef HAVE_SDL_TTF
105
-#   ifdef FIXME
106
-	//! \fixme Filler
107
-	glBindTexture(GL_TEXTURE_2D, texture);
108
-	glBegin(GL_TRIANGLE_STRIP);
109
-	glTexCoord2f(texMinX, texMinY); glVertex2i(x,   y  );
110
-	glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y  );
111
-	glTexCoord2f(texMinX, texMaxY); glVertex2i(x,   y+h);
112
-	glTexCoord2f(texMaxX, texMaxY); glVertex2i(x+w, y+h);
113
-	glEnd();
114
-#   endif
115
-#endif
116
-}
117
-
118
-
119
-void SDLSystem::glPrintf3d(float x, float y, float z, char *string)
120
-{
121
-#ifdef HAVE_SDL_TTF_FIXME
122
-	/*! \fixme Filler
123
-	 * Billboarding here requires a yaw jackass =)
124
-     */
125
-	glBindTexture(GL_TEXTURE_2D, texture);
126
-	glBegin(GL_TRIANGLE_STRIP);
127
-	glTexCoord2f(texMinX, texMinY); glVertex2i(x,   y  );
128
-	glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y  );
129
-	glTexCoord2f(texMinX, texMaxY); glVertex2i(x,   y+h);
130
-	glTexCoord2f(texMaxX, texMaxY); glVertex2i(x+w, y+h);
131
-	glEnd();
132
-#endif
133
-}
134
-
135
-
136 101
 void SDLSystem::setGrabMouse(bool on)
137 102
 {
138 103
 	SDL_WM_GrabInput(on ? SDL_GRAB_ON : SDL_GRAB_OFF);

+ 6
- 2
src/Texture.cpp Ver arquivo

@@ -183,12 +183,14 @@ void glPrint2d(float x, float y, float scale, char *string)
183 183
 		static int errors = 0;
184 184
 
185 185
 		if (errors < 10)
186
-			printf("ERROR: glPrintf2d failed, %i\n", ++errors);
186
+			printf("ERROR: glPrint2d failed, %i\n", ++errors);
187 187
 		return;
188 188
 	}
189 189
 
190 190
 	glPushMatrix();
191 191
 	glBindTexture(GL_TEXTURE_2D, font->textureId);
192
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
193
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
192 194
 	glTranslatef(x, y, 0);
193 195
 	glScalef(scale, scale, 1);
194 196
 
@@ -215,12 +217,14 @@ void glPrint3d(float x, float y, float z,
215 217
 		static int errors = 0;
216 218
 
217 219
 		if (errors < 10)
218
-			printf("ERROR: glPrintf3d failed, %i\n", ++errors);
220
+			printf("ERROR: glPrint3d failed, %i\n", ++errors);
219 221
 		return;
220 222
 	}
221 223
 
222 224
 	glPushMatrix();
223 225
 	glBindTexture(GL_TEXTURE_2D, font->textureId);
226
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
227
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
224 228
 	glTranslatef(x, y, z);
225 229
 	glRotatef(roll,  1, 0, 0);
226 230
 	glRotatef(yaw,   0, 1, 0);

Carregando…
Cancelar
Salvar