1 /*****************************************************************************
2 * vlc_opengl.h: VLC GL API
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
5 * Copyright (C) 2011 RĂ©mi Denis-Courmont
7 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
29 * This file defines GL structures and functions.
33 struct vout_window_cfg_t
;
36 * A VLC GL context (and its underlying surface)
38 typedef struct vlc_gl_t vlc_gl_t
;
42 struct vlc_common_members obj
;
44 struct vout_window_t
*surface
;
48 int (*makeCurrent
)(vlc_gl_t
*);
49 void (*releaseCurrent
)(vlc_gl_t
*);
50 void (*resize
)(vlc_gl_t
*, unsigned, unsigned);
51 void (*swap
)(vlc_gl_t
*);
52 void*(*getProcAddress
)(vlc_gl_t
*, const char *);
61 /* if ext == VLC_GL_EXT_EGL */
63 /* call eglQueryString() with current display */
64 const char *(*queryString
)(vlc_gl_t
*, int32_t name
);
65 /* call eglCreateImageKHR() with current display and context, can
67 void *(*createImageKHR
)(vlc_gl_t
*, unsigned target
, void *buffer
,
68 const int32_t *attrib_list
);
69 /* call eglDestroyImageKHR() with current display, can be NULL */
70 bool (*destroyImageKHR
)(vlc_gl_t
*, void *image
);
72 /* if ext == VLC_GL_EXT_WGL */
75 const char *(*getExtensionsString
)(vlc_gl_t
*);
85 VLC_API vlc_gl_t
*vlc_gl_Create(struct vout_window_t
*, unsigned, const char *) VLC_USED
;
86 VLC_API
void vlc_gl_Release(vlc_gl_t
*);
87 VLC_API
void vlc_gl_Hold(vlc_gl_t
*);
89 static inline int vlc_gl_MakeCurrent(vlc_gl_t
*gl
)
91 return gl
->makeCurrent(gl
);
94 static inline void vlc_gl_ReleaseCurrent(vlc_gl_t
*gl
)
96 gl
->releaseCurrent(gl
);
99 static inline void vlc_gl_Resize(vlc_gl_t
*gl
, unsigned w
, unsigned h
)
101 if (gl
->resize
!= NULL
)
102 gl
->resize(gl
, w
, h
);
105 static inline void vlc_gl_Swap(vlc_gl_t
*gl
)
110 static inline void *vlc_gl_GetProcAddress(vlc_gl_t
*gl
, const char *name
)
112 return (gl
->getProcAddress
!= NULL
) ? gl
->getProcAddress(gl
, name
) : NULL
;
115 VLC_API vlc_gl_t
*vlc_gl_surface_Create(vlc_object_t
*,
116 const struct vout_window_cfg_t
*,
117 struct vout_window_t
**) VLC_USED
;
118 VLC_API
bool vlc_gl_surface_CheckSize(vlc_gl_t
*, unsigned *w
, unsigned *h
);
119 VLC_API
void vlc_gl_surface_Destroy(vlc_gl_t
*);
121 #endif /* VLC_GL_H */