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