]> git.vomp.tv Git - vompclient.git/blob - surfaceopengl.h
Preparations for dynamic mode switching
[vompclient.git] / surfaceopengl.h
1 /*\r
2     Copyright 2006, 2011-2012 Marten Richter\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef SURFACEOPENGL_H\r
22 #define SURFACEOPENGL_H\r
23 \r
24 #include "defines.h"\r
25 #include "surface.h"\r
26 #include "mutex.h"\r
27 #include <GLES2/gl2.h>\r
28 \r
29 class SurfaceOpenGL : public Surface\r
30 {\r
31   public:\r
32     SurfaceOpenGL(int id = 0);\r
33     virtual ~SurfaceOpenGL();\r
34 \r
35     int create(UINT width, UINT height);\r
36     void display();\r
37 \r
38     void startFastDraw();\r
39     void endFastDraw();\r
40 \r
41     int fillblt(int x, int y, int width, int height, const DrawStyle& c);\r
42 \r
43     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);\r
44     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);\r
45     void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region);\r
46     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);\r
47     void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);\r
48     void screenShot(const char* fileName);\r
49   void ReleaseSurface();\r
50     int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);\r
51   void drawJpeg(const char *fileName,int x, int y,int *width, int *height);\r
52 /*  void drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/\r
53 \r
54     GLuint getTexture() {return gltexture;};\r
55 \r
56 \r
57 \r
58   private:\r
59     GLuint  gltexture;\r
60     UINT sheight,swidth;\r
61     char * data;\r
62 \r
63 \r
64 \r
65     Mutex srf_mutex;\r
66   protected:\r
67     void drawPixel(int x, int y, Colour& c, bool fastdraw=false);\r
68     void drawPixel(int x, int y, unsigned int c, bool fastdraw=false);\r
69 \r
70 };\r
71 \r
72 #endif\r