comparison render_sdl.c @ 1167:e758ddbf0624

Initial work on emulating top and bottom border area
author Michael Pavone <pavone@retrodev.com>
date Sun, 15 Jan 2017 15:07:24 -0800
parents 928a65750345
children b1147418254a
comparison
equal deleted inserted replaced
1166:73e36dac5be7 1167:e758ddbf0624
185 } 185 }
186 return ret; 186 return ret;
187 } 187 }
188 #endif 188 #endif
189 189
190 static uint32_t texture_buf[512 * 256]; 190 static uint32_t texture_buf[512 * 513];
191 static void render_alloc_surfaces() 191 static void render_alloc_surfaces()
192 { 192 {
193 static uint8_t texture_init; 193 static uint8_t texture_init;
194 194
195 if (texture_init) { 195 if (texture_init) {
208 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 208 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
209 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 209 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
210 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 210 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
211 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 211 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
212 if (i < 2) { 212 if (i < 2) {
213 //TODO: Fixme for PAL + invalid display mode
213 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 256, 0, GL_BGRA, GL_UNSIGNED_BYTE, texture_buf); 214 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 256, 0, GL_BGRA, GL_UNSIGNED_BYTE, texture_buf);
214 } else { 215 } else {
215 uint32_t blank = 255 << 24; 216 uint32_t blank = 255 << 24;
216 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, &blank); 217 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, &blank);
217 } 218 }
240 un_width = glGetUniformLocation(program, "width"); 241 un_width = glGetUniformLocation(program, "width");
241 at_pos = glGetAttribLocation(program, "pos"); 242 at_pos = glGetAttribLocation(program, "pos");
242 } else { 243 } else {
243 #endif 244 #endif
244 245
245 //height=480 to fit interlaced output 246 //TODO: Fixme for PAL + invalid display mode
246 sdl_textures[0] = sdl_textures[1] = SDL_CreateTexture(main_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 480); 247 sdl_textures[0] = sdl_textures[1] = SDL_CreateTexture(main_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 480);
247 #ifndef DISABLE_OPENGL 248 #ifndef DISABLE_OPENGL
248 } 249 }
249 #endif 250 #endif
250 } 251 }