-
Notifications
You must be signed in to change notification settings - Fork 1
/
ogl.hpp
82 lines (63 loc) · 1.82 KB
/
ogl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef OGL_HPP
#define OGL_HPP
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
#include <GL/glu.h>
#include <stdint.h>
#include "displayopq.hpp"
#include "displayop.hpp"
class OpcodeState {
private:
static void load_tex( GLenum tnum, GLuint tex,
uint width, uint height, uint8_t *data );
public:
Display *display;
Window window;
GLXContext context;
uint width, height; /* window size on screen */
uint framewidth, frameheight; /* luma matrix dimensions */
uint dispwidth, dispheight; /* MPEG-2 intended display size */
double sar;
void draw( uint8_t *ycbcr );
void paint( void );
void window_setup( void );
void reset_viewport( void );
void dofullscreen( void );
void unfullscreen( void );
void load_matrix_coefficients( double green[ 3 ],
double blue[ 3 ],
double red[ 3 ] );
GLuint Y_tex, Cb_tex, Cr_tex;
Bool (*GetSync)(Display*, GLXDrawable, int64_t*, int64_t*, int64_t*);
int64_t last_mbc;
int64_t last_us;
};
class OpenGLDisplay {
private:
OpcodeState state;
GLuint shader;
void init_context( void );
static void init_tex( GLenum tnum, GLint internalformat, GLuint *tex,
uint width, uint height, GLint interp );
pthread_t thread_handle;
Queue<DisplayOperation> opq;
public:
OpenGLDisplay( char *display_name, double movie_sar,
uint s_framewidth, uint s_frameheight,
uint s_dispwidth, uint s_dispheight );
~OpenGLDisplay();
bool getevent( bool block, XEvent *ev );
void makeevent( void );
void loop( void );
Queue<DisplayOperation> *get_queue() { return &opq; }
static void GLcheck( const char *where ) {
GLenum GLerror;
if ( (GLerror = glGetError()) != GL_NO_ERROR ) {
fprintf( stderr, "GL error (%x) at (%s) (%s).\n", GLerror, where,
gluErrorString( GLerror ) );
}
}
};
#endif