Search
lxdream.org :: lxdream/src/drivers/video_gl.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_gl.h
changeset 1299:645ccec8dfb0
prev1298:d0eb2307b847
author nkeynes
date Wed May 27 09:42:24 2015 +1000 (8 years ago)
permissions -rw-r--r--
last change Fix stack alignment when calling the end-block callback (broken on OS X)
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * Common GL code that doesn't depend on a specific implementation
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef lxdream_video_gl_H
    20 #define lxdream_video_gl_H 1
    22 #ifdef __cplusplus
    23 extern "C" {
    24 #endif
    26 extern uint32_t video_width, video_height;
    28 /**
    29  * Set the video size used by the frame blits
    30  */
    31 void gl_set_video_size( uint32_t width, uint32_t height, int flipped );
    33 /**
    34  * Generic GL routine to draw the given frame buffer into a texture
    35  */
    36 void gl_frame_buffer_to_tex( frame_buffer_t frame, int tex_id );
    38 /**
    39  * Reset the GL state to its initial values
    40  */
    41 void gl_reset_state();
    44 /**
    45  * Generic GL routine to draw the given frame buffer into a (texture-backed)
    46  * render buffer.
    47  */
    48 void gl_load_frame_buffer( frame_buffer_t frame, render_buffer_t buf );
    50 /**
    51  * Generic GL routine to blank the display view with the specified colour.
    52  */
    53 void gl_display_blank( uint32_t colour );
    55 /**
    56  * Write a rectangular texture (GL_TEXTURE_2D) to the display frame
    57  */
    58 void gl_display_render_buffer( render_buffer_t buffer );
    60 /**
    61  * Write a rectangular texture (GL_TEXTURE_2D) to the display frame
    62  */
    63 void gl_texture_window( int width, int height, int tex_id, gboolean inverted );
    65 /**
    66  * Convert window coordinates to dreamcast device coords (640x480) using the 
    67  * same viewable area as gl_texture_window.
    68  * If the coordinates are outside the viewable area, the result is -1,-1.
    69  */ 
    70 void gl_window_to_system_coords( int *x, int *y );
    72 /**
    73  * Generic GL read_render_buffer. This function assumes that the caller
    74  * has already set the appropriate glReadBuffer(); in other words, unless
    75  * there's only one buffer this needs to be wrapped.
    76  */
    77 gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer, 
    78                                 int rowstride, int colour_format );
    81 void gl_framebuffer_setup(void);
    82 void gl_framebuffer_cleanup(void);
    83 /****** FBO handling (gl_fbo.c) ******/
    84 gboolean gl_fbo_is_supported();
    85 void gl_fbo_shutdown();
    86 void gl_fbo_init( display_driver_t driver );
    87 void gl_fbo_detach();
    89 /** VBO/VAR handling (gl_vbo.c) ******/
    90 void gl_vbo_init( display_driver_t driver );
    92 /* Set the fallback vertex buffer handling, for drivers with no GL */
    93 void gl_vbo_fallback_init( display_driver_t driver );
    95 /** Initialize and load SL shaders */
    96 gboolean glsl_init( display_driver_t driver );
    98 /** Initialise common GL functionality (FBO, SL, VBO)
    99  * @param driver driver to be updated with appropriate calls
   100  * @param need_fbo if TRUE, FBOs are required (ie main driver has no other way
   101  * to construct an off-screen buffer)
   102  * @return TRUE on success, FALSE if we couldn't setup a working context
   103  */
   104 gboolean gl_init_driver( display_driver_t driver, gboolean need_fbo );
   106 #ifdef __cplusplus
   107 }
   108 #endif
   110 #endif /* !lxdream_video_gl_H */
.