nkeynes@352: /** nkeynes@443: * $Id: gl_common.h,v 1.4 2007-10-13 04:01:02 nkeynes Exp $ nkeynes@352: * nkeynes@352: * Parent for all X11 display drivers. nkeynes@352: * nkeynes@352: * Copyright (c) 2005 Nathan Keynes. nkeynes@352: * nkeynes@352: * This program is free software; you can redistribute it and/or modify nkeynes@352: * it under the terms of the GNU General Public License as published by nkeynes@352: * the Free Software Foundation; either version 2 of the License, or nkeynes@352: * (at your option) any later version. nkeynes@352: * nkeynes@352: * This program is distributed in the hope that it will be useful, nkeynes@352: * but WITHOUT ANY WARRANTY; without even the implied warranty of nkeynes@352: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nkeynes@352: * GNU General Public License for more details. nkeynes@352: */ nkeynes@352: nkeynes@352: #ifndef video_gl_common_H nkeynes@352: #define video_gl_common_H nkeynes@352: nkeynes@352: #include "display.h" nkeynes@352: nkeynes@352: /** nkeynes@352: * Test if a specific extension is supported. From opengl.org nkeynes@352: * @param extension extension name to check for nkeynes@352: * @return TRUE if supported, otherwise FALSE. nkeynes@352: */ nkeynes@352: gboolean isGLExtensionSupported( const char *extension ); nkeynes@352: nkeynes@352: gboolean hasRequiredGLExtensions(); nkeynes@352: nkeynes@352: /** nkeynes@352: * Generic GL routine to draw the given frame buffer in the display view. nkeynes@352: */ nkeynes@352: gboolean gl_display_frame_buffer( frame_buffer_t frame ); nkeynes@352: nkeynes@352: /** nkeynes@352: * Generic GL routine to blank the display view with the specified colour. nkeynes@352: */ nkeynes@352: gboolean gl_display_blank( uint32_t colour ); nkeynes@352: nkeynes@443: /** nkeynes@443: * Copy the frame buffer contents to the specified texture id nkeynes@443: */ nkeynes@443: void gl_frame_buffer_to_tex_rectangle( frame_buffer_t frame, GLuint texid ); nkeynes@443: nkeynes@443: /** nkeynes@443: * Write a rectangular texture (GL_TEXTURE_RECTANGLE_ARB) to the display frame nkeynes@443: */ nkeynes@443: void gl_display_tex_rectangle( GLuint texid, uint32_t texwidth, uint32_t texheight, gboolean invert ); nkeynes@443: nkeynes@443: /** nkeynes@443: * Redisplay the last frame. nkeynes@443: */ nkeynes@443: void gl_redisplay_last(); nkeynes@352: nkeynes@352: /** nkeynes@352: * Generic GL read_render_buffer. This function assumes that the caller nkeynes@352: * has already set the appropriate glReadBuffer(); in other words, unless nkeynes@352: * there's only one buffer this needs to be wrapped. nkeynes@352: */ nkeynes@429: gboolean gl_read_render_buffer( render_buffer_t buffer, unsigned char *target ); nkeynes@352: nkeynes@352: nkeynes@352: /****** FBO handling (gl_fbo.c) ******/ nkeynes@352: gboolean gl_fbo_is_supported(); nkeynes@352: void gl_fbo_shutdown(); nkeynes@352: void gl_fbo_init( display_driver_t driver ); nkeynes@352: nkeynes@405: /****** Shader handling (gl_sl.c) *****/ nkeynes@405: gboolean glsl_is_supported(void); nkeynes@405: gboolean glsl_load_shaders( const char *vert_shader, const char *frag_shader ); nkeynes@405: void glsl_unload_shaders(void); nkeynes@405: nkeynes@405: extern const char *glsl_vertex_shader_src; nkeynes@405: extern const char *glsl_fragment_shader_src; nkeynes@405: nkeynes@352: #endif /* !video_gl_common_H */