Search
lxdream.org :: lxdream/src/video.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/video.h
changeset 103:9b9cfc5855e0
prev94:8d80d9c7cc7d
next106:9048bac046c3
author nkeynes
date Mon Mar 13 12:39:07 2006 +0000 (16 years ago)
permissions -rw-r--r--
last change More rendering work in progress. Almost there now...
file annotate diff log raw
1.1 --- a/src/video.h Sun Feb 05 04:05:27 2006 +0000
1.2 +++ b/src/video.h Mon Mar 13 12:39:07 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video.h,v 1.4 2006-02-05 04:05:27 nkeynes Exp $
1.6 + * $Id: video.h,v 1.5 2006-03-13 12:39:03 nkeynes Exp $
1.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -27,10 +27,18 @@
1.11 extern "C" {
1.12 #endif
1.13
1.14 -#define COLFMT_RGB15 0x00000000
1.15 -#define COLFMT_RGB16 0x00000004
1.16 -#define COLFMT_RGB24 0x00000008
1.17 -#define COLFMT_RGB32 0x0000000C
1.18 +/**
1.19 + * Supported colour formats. Note that ARGB4444 is only ever used for texture
1.20 + * rendering (it's not valid for display purposes).
1.21 + */
1.22 +#define COLFMT_RGB565 1
1.23 +#define COLFMT_RGB888 4
1.24 +#define COLFMT_ARGB1555 0
1.25 +#define COLFMT_ARGB8888 5
1.26 +#define COLFMT_ARGB4444 2
1.27 +#define COLFMT_YUV422 3 /* 8-bit YUV (texture source only) */
1.28 +#define COLFMT_INDEX4 6 /* 4 bit indexed colour (texture source only) */
1.29 +#define COLFMT_INDEX8 7 /* 8-bit indexed colour (texture source only) */
1.30
1.31 typedef struct video_buffer {
1.32 uint32_t hres;
1.33 @@ -40,15 +48,69 @@
1.34 char *data;
1.35 } *video_buffer_t;
1.36
1.37 +/**
1.38 + * Core video driver - expected to directly support an OpenGL context
1.39 + */
1.40 typedef struct video_driver {
1.41 char *name;
1.42 - gboolean (*set_output_format)( uint32_t hres, uint32_t vres,
1.43 - int colour_fmt );
1.44 + /**
1.45 + * Initialize the driver. This is called only once at startup time, and
1.46 + * is guaranteed to be called before any other methods.
1.47 + * @return TRUE if the driver was successfully initialized, otherwise
1.48 + * FALSE.
1.49 + */
1.50 + gboolean (*init_driver)(void);
1.51 +
1.52 + /**
1.53 + * Cleanly shutdown the driver. Normally only called at system shutdown
1.54 + * time.
1.55 + */
1.56 + void (*shutdown_driver)(void);
1.57 +
1.58 + /**
1.59 + * Set the current display format to the specified values. This is
1.60 + * called immediately prior to any display frame call where the
1.61 + * parameters have changed from the previous frame
1.62 + */
1.63 + gboolean (*set_display_format)( uint32_t hres, uint32_t vres,
1.64 + int colour_fmt );
1.65 +
1.66 + /**
1.67 + * Set the current rendering format to the specified values. This is
1.68 + * called immediately prior to starting rendering of a frame where the
1.69 + * parameters have changed from the previous frame. Note that the driver
1.70 + * is not required to precisely support the requested colour format.
1.71 + *
1.72 + * This method is also responsible for setting up an appropriate GL
1.73 + * context for the main engine to render into.
1.74 + *
1.75 + * @param hres The horizontal resolution (ie 640)
1.76 + * @param vres The vertical resolution (ie 480)
1.77 + * @param colour_fmt The colour format of the buffer (ie COLFMT_ARGB4444)
1.78 + * @param texture Flag indicating that the frame being rendered is a
1.79 + * texture, rather than a display frame.
1.80 + */
1.81 + gboolean (*set_render_format)( uint32_t hres, uint32_t vres,
1.82 + int colour_fmt, gboolean texture );
1.83 + /**
1.84 + * Display a single frame using the supplied pixmap data. Is assumed to
1.85 + * invalidate the current GL front buffer (but not the back buffer).
1.86 + */
1.87 gboolean (*display_frame)( video_buffer_t buffer );
1.88 +
1.89 + /**
1.90 + * Display a single blanked frame using a fixed colour for the
1.91 + * entire frame (specified in RGB888 format). Is assumed to invalidate
1.92 + * the current GL front buffer (but not the back buffer).
1.93 + */
1.94 gboolean (*display_blank_frame)( uint32_t rgb );
1.95 +
1.96 + /**
1.97 + * Promote the current render back buffer to the front buffer
1.98 + */
1.99 + void (*display_back_buffer)( void );
1.100 } *video_driver_t;
1.101
1.102 -
1.103 void video_open( void );
1.104 void video_update_frame( void );
1.105 void video_update_size( int, int, int );
.