Bladeren bron

Enable linear filtering for font texture

Thomas Buck 11 jaren geleden
bovenliggende
commit
65322cea33
5 gewijzigde bestanden met toevoegingen van 11 en 42 verwijderingen
  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 Bestand weergeven

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

+ 1
- 1
Makefile Bestand weergeven

110
 	 -lm $(BASE_LIBS)
110
 	 -lm $(BASE_LIBS)
111
 
111
 
112
 RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
112
 RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
113
-	-fomit-frame-pointer -O2
113
+	-fomit-frame-pointer -O2 -Wall
114
 
114
 
115
 DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 $(DEBUG_DEFS) $(WARNINGS)
115
 DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 $(DEBUG_DEFS) $(WARNINGS)
116
 
116
 

+ 0
- 3
src/GLString.cpp Bestand weergeven

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

+ 0
- 35
src/SDLSystem.cpp Bestand weergeven

98
 #endif
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
 void SDLSystem::setGrabMouse(bool on)
101
 void SDLSystem::setGrabMouse(bool on)
137
 {
102
 {
138
 	SDL_WM_GrabInput(on ? SDL_GRAB_ON : SDL_GRAB_OFF);
103
 	SDL_WM_GrabInput(on ? SDL_GRAB_ON : SDL_GRAB_OFF);

+ 6
- 2
src/Texture.cpp Bestand weergeven

183
 		static int errors = 0;
183
 		static int errors = 0;
184
 
184
 
185
 		if (errors < 10)
185
 		if (errors < 10)
186
-			printf("ERROR: glPrintf2d failed, %i\n", ++errors);
186
+			printf("ERROR: glPrint2d failed, %i\n", ++errors);
187
 		return;
187
 		return;
188
 	}
188
 	}
189
 
189
 
190
 	glPushMatrix();
190
 	glPushMatrix();
191
 	glBindTexture(GL_TEXTURE_2D, font->textureId);
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
 	glTranslatef(x, y, 0);
194
 	glTranslatef(x, y, 0);
193
 	glScalef(scale, scale, 1);
195
 	glScalef(scale, scale, 1);
194
 
196
 
215
 		static int errors = 0;
217
 		static int errors = 0;
216
 
218
 
217
 		if (errors < 10)
219
 		if (errors < 10)
218
-			printf("ERROR: glPrintf3d failed, %i\n", ++errors);
220
+			printf("ERROR: glPrint3d failed, %i\n", ++errors);
219
 		return;
221
 		return;
220
 	}
222
 	}
221
 
223
 
222
 	glPushMatrix();
224
 	glPushMatrix();
223
 	glBindTexture(GL_TEXTURE_2D, font->textureId);
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
 	glTranslatef(x, y, z);
228
 	glTranslatef(x, y, z);
225
 	glRotatef(roll,  1, 0, 0);
229
 	glRotatef(roll,  1, 0, 0);
226
 	glRotatef(yaw,   0, 1, 0);
230
 	glRotatef(yaw,   0, 1, 0);

Laden…
Annuleren
Opslaan