1
- /*
2
-
3
- This file is based on Portable ZX-Spectrum emulator.
4
- Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5
-
6
- C++ to C code conversion by Pate
7
-
8
- Modified by DPR for gpsp for Raspberry Pi
9
-
10
- This program is free software: you can redistribute it and/or modify
11
- it under the terms of the GNU General Public License as published by
12
- the Free Software Foundation, either version 3 of the License, or
13
- (at your option) any later version.
14
-
15
- This program is distributed in the hope that it will be useful,
16
- but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- GNU General Public License for more details.
19
-
20
- You should have received a copy of the GNU General Public License
21
- along with this program. If not, see <http://www.gnu.org/licenses/>.
22
-
23
- */
1
+ /*
2
+ *
3
+ * This file is based on Portable ZX-Spectrum emulator.
4
+ * Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5
+ *
6
+ * C++ to C code conversion by Pate
7
+ *
8
+ * Modified by DPR for gpsp for Raspberry Pi
9
+ *
10
+ * This program is free software: you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation, either version 3 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
22
+ *
23
+ */
24
24
25
25
#include "bcm_host.h"
26
26
#include "GLES/gl.h"
@@ -57,16 +57,8 @@ static const char* fragment_shader =
57
57
"void main() \n"
58
58
"{ \n"
59
59
" gl_FragColor = texture2D(u_texture, v_texcoord); \n"
60
- "} \n" ;
61
- /*
62
- static const GLfloat vertices[] =
63
- {
64
- -0.5f, -0.5f, 0.0f,
65
- +0.5f, -0.5f, 0.0f,
66
- +0.5f, +0.5f, 0.0f,
67
- -0.5f, +0.5f, 0.0f,
68
- };
69
- */
60
+ "} \n" ;
61
+
70
62
static const GLfloat vertices [] =
71
63
{
72
64
-0.5f , -0.5f , 0.0f ,
@@ -259,8 +251,6 @@ void video_init(uint32_t _width, uint32_t _height, uint32_t filter)
259
251
260
252
frame_width = _width ;
261
253
frame_height = _height ;
262
-
263
- //bcm_host_init();
264
254
265
255
// get an EGL display connection
266
256
display = eglGetDisplay (EGL_DEFAULT_DISPLAY );
@@ -364,7 +354,6 @@ static void SetOrtho(GLfloat m[4][4], GLfloat left, GLfloat right, GLfloat botto
364
354
m [3 ][2 ] = - (far + near )/(far - near );
365
355
m [3 ][3 ] = 1 ;
366
356
}
367
- #define RGB15 (r , g , b ) (((r) << (5+6)) | ((g) << 6) | (b))
368
357
369
358
static void gles2_Draw ( uint16_t * pixels )
370
359
{
@@ -375,7 +364,7 @@ static void gles2_Draw( uint16_t *pixels)
375
364
376
365
glUseProgram (shader .program );
377
366
378
- glBindTexture (GL_TEXTURE_2D , textures [0 ]);
367
+ glBindTexture (GL_TEXTURE_2D , textures [0 ]);
379
368
glTexSubImage2D (GL_TEXTURE_2D , 0 , 0 , 0 , frame_width , frame_height , GL_RGB , GL_UNSIGNED_SHORT_5_6_5 , pixels );
380
369
glActiveTexture (GL_TEXTURE0 );
381
370
glUniform1i (shader .u_texture , 0 );
@@ -397,13 +386,11 @@ static void gles2_Draw( uint16_t *pixels)
397
386
398
387
glBindBuffer (GL_ARRAY_BUFFER , 0 );
399
388
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER , 0 );
400
- //glFlush();
401
389
}
402
390
403
391
void video_close ()
404
392
{
405
393
gles2_destroy ();
406
- // Release OpenGL resources
407
394
eglMakeCurrent ( display , EGL_NO_SURFACE , EGL_NO_SURFACE , EGL_NO_CONTEXT );
408
395
eglDestroySurface ( display , surface );
409
396
eglDestroyContext ( display , context );
0 commit comments