WindML updates (Stephane Raimbault)
This commit is contained in:
parent
30230a9cd1
commit
306933046c
|
@ -12,6 +12,7 @@ gives better performance than double buffer software so if you can
|
||||||
compile your WindML driver with this option, just do it. I/O
|
compile your WindML driver with this option, just do it. I/O
|
||||||
redirection is adviced in target server.
|
redirection is adviced in target server.
|
||||||
|
|
||||||
|
|
||||||
Tested on
|
Tested on
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -53,6 +54,9 @@ ld < c:\Tornado\target\lib\objMesaGLU.o
|
||||||
ld < c:\Tornado\target\lib\objGLUTshapes.o
|
ld < c:\Tornado\target\lib\objGLUTshapes.o
|
||||||
ld < c:\Tornado\target\lib\objMesaOS.o
|
ld < c:\Tornado\target\lib\objMesaOS.o
|
||||||
|
|
||||||
|
You can put the previous lines in a file and use:
|
||||||
|
< filename
|
||||||
|
|
||||||
6. Download the application modules.
|
6. Download the application modules.
|
||||||
|
|
||||||
7. In WindShell, run:
|
7. In WindShell, run:
|
||||||
|
@ -82,18 +86,16 @@ input driver), you must do the following to use the UGL/Mesa interface:
|
||||||
|
|
||||||
5. Before the UGL is destroyed, call MesaDestroyContext().
|
5. Before the UGL is destroyed, call MesaDestroyContext().
|
||||||
|
|
||||||
6. Before exiting, call if required uglEventQDestroy and then uglDeinitialize();
|
6. Before exiting, call if required uglEventQDestroy and then
|
||||||
|
uglDeinitialize();
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
I found the following limitations in my driver :
|
I found the following limitations in my driver :
|
||||||
- Color Indexed management is only in 8 bits
|
- Color Indexed management is only in 8 bits
|
||||||
- The front and the back buffer must have the structure (mode and
|
- It's possible to mix UGL/OpenGL application with a software
|
||||||
size). A structure umc->buffer is requisite if the front and back
|
double buffer
|
||||||
buffers are different.
|
|
||||||
- It isn't possible to mix UGL/OpenGL application with a software
|
|
||||||
double buffer (to fix)
|
|
||||||
|
|
||||||
Modifications
|
Modifications
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -48,47 +48,55 @@ extern "C" {
|
||||||
* Values for display mode of uglMesaCreateContext ()
|
* Values for display mode of uglMesaCreateContext ()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UGL_MESA_SINGLE 0x00
|
/*
|
||||||
#define UGL_MESA_DOUBLE 0x01
|
* With these mask values, it's possible to test double buffer mode
|
||||||
#define UGL_MESA_DOUBLE_SW 0x02
|
* with UGL_MESA_DOUBLE mask
|
||||||
#define UGL_MESA_DOUBLE_HW 0x03
|
*
|
||||||
|
* SINGLE 0000 0001
|
||||||
|
* DOUBLE 0000 0110
|
||||||
|
* - SOFT 0000 0010
|
||||||
|
* - HARD 0000 0100
|
||||||
|
* WINDML 0001 0000
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define UGL_MESA_SINGLE 0x01
|
||||||
|
#define UGL_MESA_DOUBLE 0x06
|
||||||
|
#define UGL_MESA_DOUBLE_SOFTWARE 0x02
|
||||||
|
#define UGL_MESA_DOUBLE_HARDWARE 0x04
|
||||||
|
|
||||||
|
#define UGL_MESA_WINDML_EXCLUSIVE 0x10
|
||||||
|
|
||||||
#define UGL_MESA_FULLSCREEN_WIDTH 0x0
|
#define UGL_MESA_FULLSCREEN_WIDTH 0x0
|
||||||
#define UGL_MESA_FULLSCREEN_HEIGHT 0x0
|
#define UGL_MESA_FULLSCREEN_HEIGHT 0x0
|
||||||
|
|
||||||
/*
|
|
||||||
* Pixel format
|
|
||||||
*/
|
|
||||||
#define UGL_MESA_ARGB8888 0x01
|
|
||||||
#define UGL_MESA_RGB565 0x02
|
|
||||||
#define UGL_MESA_RGB888 0x03
|
|
||||||
#define UGL_MESA_ARGB4444 0x04
|
|
||||||
#define UGL_MESA_CI 0x05
|
|
||||||
#define UGL_MESA_DITHER_RGB 0x10
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uglMesaPixelStore() parameters:
|
* uglMesaPixelStore() parameters:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UGL_MESA_ROW_LENGTH 0x10
|
#define UGL_MESA_ROW_LENGTH 0x20
|
||||||
#define UGL_MESA_Y_UP 0x11
|
#define UGL_MESA_Y_UP 0x21
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accepted by uglMesaGetIntegerv:
|
* Accepted by uglMesaGetIntegerv:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UGL_MESA_LEFT_X 0x18
|
#define UGL_MESA_LEFT_X 0x01
|
||||||
#define UGL_MESA_TOP_Y 0x19
|
#define UGL_MESA_TOP_Y 0x02
|
||||||
#define UGL_MESA_WIDTH 0x20
|
#define UGL_MESA_WIDTH 0x03
|
||||||
#define UGL_MESA_HEIGHT 0x21
|
#define UGL_MESA_HEIGHT 0x04
|
||||||
#define UGL_MESA_DISPLAY_WIDTH 0x22
|
#define UGL_MESA_DISPLAY_WIDTH 0x05
|
||||||
#define UGL_MESA_DISPLAY_HEIGHT 0x23
|
#define UGL_MESA_DISPLAY_HEIGHT 0x06
|
||||||
#define UGL_MESA_COLOR_FORMAT 0x24
|
#define UGL_MESA_COLOR_FORMAT 0x07
|
||||||
#define UGL_MESA_COLOR_MODEL 0x25
|
#define UGL_MESA_COLOR_MODEL 0x08
|
||||||
#define UGL_MESA_PIXEL_FORMAT 0x26
|
#define UGL_MESA_PIXEL_FORMAT 0x09
|
||||||
#define UGL_MESA_TYPE 0x27
|
#define UGL_MESA_TYPE 0x0A
|
||||||
#define UGL_MESA_RGB 0x28
|
#define UGL_MESA_RGB 0x0B
|
||||||
#define UGL_MESA_COLOR_INDEXED 0x29
|
#define UGL_MESA_COLOR_INDEXED 0x0C
|
||||||
|
#define UGL_MESA_SINGLE_BUFFER 0x0D
|
||||||
|
#define UGL_MESA_DOUBLE_BUFFER 0x0E
|
||||||
|
#define UGL_MESA_DOUBLE_BUFFER_SOFTWARE 0x0F
|
||||||
|
#define UGL_MESA_DOUBLE_BUFFER_HARDWARE 0x10
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* typedefs
|
* typedefs
|
||||||
|
@ -96,44 +104,10 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct uglMesaContext * UGL_MESA_CONTEXT;
|
typedef struct uglMesaContext * UGL_MESA_CONTEXT;
|
||||||
|
|
||||||
/*
|
UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum mode,
|
||||||
* Create an Mesa/UGL rendering context. The attributes needed are
|
|
||||||
* double buffer flag and a context sharelist.
|
|
||||||
*
|
|
||||||
* It's necessary to first call this function before use uglMakeCurrentContext.
|
|
||||||
* This function provides neither stencil nor accumulation buffer only
|
|
||||||
* a depth buffer to reduce memory footprint.
|
|
||||||
*
|
|
||||||
* Input: db_mode - UGL_MESA_SINGLE = single buffer mode
|
|
||||||
* UGL_MESA_DOUBLE = double buffer mode (HW fallback -> SW)
|
|
||||||
* UGL_MESA_DOUBLE_SW = double buffer software
|
|
||||||
* UGL_MESA_DOUBLE_HW = double buffer hardware
|
|
||||||
* share_list - specifies another UGL_MESA_CONTEXT with which to share
|
|
||||||
* display lists. NULL indicates no sharing.
|
|
||||||
*
|
|
||||||
* Return: a UGL_MESA_CONTEXT, or zero if error
|
|
||||||
*/
|
|
||||||
|
|
||||||
UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum db_mode,
|
|
||||||
UGL_MESA_CONTEXT share_list);
|
UGL_MESA_CONTEXT share_list);
|
||||||
|
|
||||||
/*
|
UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode,
|
||||||
* Create an UGL/Mesa rendering context and specify desired
|
|
||||||
* size of depth buffer, stencil buffer and accumulation buffer.
|
|
||||||
* If you specify zero for depth_bits, stencil_bits,
|
|
||||||
* accum_[red|gren|blue]_bits, you can save some memory.
|
|
||||||
*
|
|
||||||
* INPUT: db_mode - double buffer mode
|
|
||||||
* depth_bits - depth buffer size
|
|
||||||
* stencil_bits - stencil buffer size
|
|
||||||
* accum_red_bits - accumulation red buffer size
|
|
||||||
* accum_green_bits - accumulation green buffer size
|
|
||||||
* accum_blue_bits -accumulation blue buffer size
|
|
||||||
* accum_alpha_bits -accumulation alpha buffer size
|
|
||||||
* share_list - specifies another UGL_MESA_CONTEXT with which to share
|
|
||||||
* display lists. NULL indicates no sharing.
|
|
||||||
*/
|
|
||||||
UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum db_flag,
|
|
||||||
GLint depth_bits,
|
GLint depth_bits,
|
||||||
GLint stencil_bits,
|
GLint stencil_bits,
|
||||||
GLint accum_red_bits,
|
GLint accum_red_bits,
|
||||||
|
@ -142,175 +116,34 @@ UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum db_flag,
|
||||||
GLint accum_alpha_bits,
|
GLint accum_alpha_bits,
|
||||||
UGL_MESA_CONTEXT share_list);
|
UGL_MESA_CONTEXT share_list);
|
||||||
|
|
||||||
/*
|
|
||||||
* Bind an UGL_MESA_CONTEXT to an image buffer. The image buffer is
|
|
||||||
* just a block of memory which the client provides. Its size must be
|
|
||||||
* at least as large as width*height*sizeof(type). Its address should
|
|
||||||
* be a multiple of 4 if using RGBA mode.
|
|
||||||
*
|
|
||||||
* Image data is stored in the order of glDrawPixels: row-major order
|
|
||||||
* with the lower-left image pixel stored in the first array position
|
|
||||||
* (ie. bottom-to-top).
|
|
||||||
*
|
|
||||||
* Since the only type initially supported is GL_UNSIGNED_BYTE, if the
|
|
||||||
* context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
|
|
||||||
* value. If the context is in color indexed mode, each pixel will be
|
|
||||||
* stored as a 1-byte value.
|
|
||||||
*
|
|
||||||
* If the context's viewport hasn't been initialized yet, it will now be
|
|
||||||
* initialized to (0, 0, width, height).
|
|
||||||
*
|
|
||||||
* Input: umc - a rendering context
|
|
||||||
* left, top - coordinates in pixels of (left,top) pixel
|
|
||||||
* (0,0) in fullscreen mode.
|
|
||||||
* width, height - size of image buffer in pixels, at least 1
|
|
||||||
* else fullscreen dimensions are used (UGL_MESA_DISPLAY_WIDTH
|
|
||||||
* and UGL_MESA_DISPLAY_HEIGHT).
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, GL_FALSE if error because of invalid umc,
|
|
||||||
* width<1, height<1, width>internal limit or height>internal limit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc,
|
GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc,
|
||||||
GLsizei left, GLsizei top,
|
GLsizei left, GLsizei top,
|
||||||
GLsizei width, GLsizei height);
|
GLsizei width, GLsizei height);
|
||||||
|
|
||||||
/*
|
|
||||||
* Move an OpenGL window by a delta value
|
|
||||||
*
|
|
||||||
* Input: dx, dy - delta values in pixels
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, GL_FALSE if error because of invalid
|
|
||||||
* coordinates.
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy);
|
GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy);
|
||||||
|
|
||||||
/*
|
|
||||||
* Move an OpenGL window to an absolute position
|
|
||||||
*
|
|
||||||
* Input: left, top - new coordinates in pixels
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, GL_FALSE if error because of invalid
|
|
||||||
* coordinates.
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top);
|
GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top);
|
||||||
|
|
||||||
/*
|
|
||||||
* Resize an OpenGL window by a delta value
|
|
||||||
*
|
|
||||||
* Input: dw, dh - delta values in pixels
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, GL_FALSE if error because of invalid
|
|
||||||
* coordinates.
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh);
|
GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh);
|
||||||
|
|
||||||
/*
|
|
||||||
* Resize an OpenGL window to an absolute size
|
|
||||||
*
|
|
||||||
* Input: width, height - new dimensions in pixels
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, GL_FALSE if error because of invalid
|
|
||||||
* coordinates.
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height);
|
GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height);
|
||||||
|
|
||||||
/*
|
|
||||||
* Destroy the current UGL/Mesa rendering context
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void uglMesaDestroyContext (void);
|
void uglMesaDestroyContext (void);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the current UGL/Mesa context
|
|
||||||
*
|
|
||||||
* Return: a UGL/Mesa context, or NULL if error
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UGL_MESA_CONTEXT uglMesaGetCurrentContext (void);
|
UGL_MESA_CONTEXT uglMesaGetCurrentContext (void);
|
||||||
|
|
||||||
/*
|
|
||||||
* Swap front and back buffers in double buffering mode. This
|
|
||||||
* function is a no-op if there's no back buffer. In case of software
|
|
||||||
* double buffering a copy occurs from off-screen buffer to front
|
|
||||||
* buffer. Works faster with an hardware support.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void uglMesaSwapBuffers (void);
|
void uglMesaSwapBuffers (void);
|
||||||
|
|
||||||
/*
|
|
||||||
* Set pixel store/packing parameters for the current context. This
|
|
||||||
* is similar to glPixelStore. UGL uses Y coordinates increase
|
|
||||||
* downward.
|
|
||||||
*
|
|
||||||
* Input: pname - UGL_MESA_ROW_LENGTH
|
|
||||||
* zero, same as image width (default).
|
|
||||||
* value specify actual pixels per row in image buffer
|
|
||||||
* UGL_MESA_Y_UP:
|
|
||||||
* zero = Y coordinates increase downward (default)
|
|
||||||
* non-zero = Y coordinates increase upward
|
|
||||||
* value - value for the parameter pname
|
|
||||||
*/
|
|
||||||
|
|
||||||
void uglMesaPixelStore (GLint pname, GLint value);
|
void uglMesaPixelStore (GLint pname, GLint value);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return an integer value like glGetIntegerv.
|
|
||||||
*
|
|
||||||
* Input: pname - UGL_MESA_LEFT_X return the x axis value
|
|
||||||
* of the most left pixel
|
|
||||||
* UGL_MESA_TOP_Y return the y axis value
|
|
||||||
* of the topper pixel
|
|
||||||
* UGL_MESA_WIDTH return current image width
|
|
||||||
* UGL_MESA_HEIGHT return current image height
|
|
||||||
* UGL_MESA_COLOR_FORMAT return image color format
|
|
||||||
* UGL_MESA_COLOR_MODEL return image color model
|
|
||||||
* UGL_MESA_PIXEL_FORMAT return pixel format
|
|
||||||
* UGL_MESA_ROW_LENGTH return row length in pixels
|
|
||||||
* UGL_MESA_RGB return true if RGB
|
|
||||||
* UGL_MESA_COLOR_INDEXED return true if color indexed
|
|
||||||
* value - pointer to integer in which to return result.
|
|
||||||
*/
|
|
||||||
void uglMesaGetIntegerv (GLint pname, GLint *value);
|
void uglMesaGetIntegerv (GLint pname, GLint *value);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the depth buffer associated with an UGL/Mesa context.
|
|
||||||
*
|
|
||||||
* Output: width, height - size of buffer in pixels
|
|
||||||
* bytesPerValue - bytes per depth value (2 or 4)
|
|
||||||
* buffer - pointer to depth buffer values
|
|
||||||
* Return: GL_TRUE or GL_FALSE to indicate success or failure.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height,
|
GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height,
|
||||||
GLint *bytesPerValue, void **buffer);
|
GLint *bytesPerValue, void **buffer);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the color buffer associated with an UGL/Mesa context.
|
|
||||||
* Input: c - the UGL/Mesa context
|
|
||||||
* Output: width, height - size of buffer in pixels
|
|
||||||
* format - buffer format (UGLMESA_FORMAT)
|
|
||||||
* buffer - pointer to color buffer values
|
|
||||||
* Return: GL_TRUE or GL_FALSE to indicate success or failure.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height,
|
GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height,
|
||||||
GLint *format, void **buffer);
|
GLint *format, void **buffer);
|
||||||
|
|
||||||
/*
|
|
||||||
* Color allocation in indexed mode.
|
|
||||||
* This function does nothing in RGB mode.
|
|
||||||
*
|
|
||||||
* Input: index - Value for the current color index
|
|
||||||
* red - Red component (between 0 and 1)
|
|
||||||
* green - Green component (between 0 and 1)
|
|
||||||
* blue - Blue component (between 0 and 1)
|
|
||||||
*
|
|
||||||
* Return: GL_TRUE if success, or GL_FALSE if index<0 or * clutSize<index,
|
|
||||||
* red, green and blue are not between 0.0 and 1.0.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLboolean uglMesaSetColor (GLubyte index, GLfloat red,
|
GLboolean uglMesaSetColor (GLubyte index, GLfloat red,
|
||||||
GLfloat green, GLfloat blue);
|
GLfloat green, GLfloat blue);
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -185,15 +185,15 @@ UGL_LOCAL int getEvent(void)
|
||||||
return(retVal);
|
return(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLAccum (void);
|
void windMLAccum (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglaccum (void)
|
void uglaccum (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tAccum", 210, VX_FP_TASK, 100000,
|
taskSpawn("tAccum", 210, VX_FP_TASK, 100000,
|
||||||
(FUNCPTR)windMLAccum, 0,1,2,3,4,5,6,7,8,9);
|
(FUNCPTR)windMLAccum,UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLAccum(void)
|
void windMLAccum (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
|
@ -206,11 +206,20 @@ void windMLAccum(void)
|
||||||
|
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
umc = uglMesaCreateNewContextExt(GL_TRUE,
|
if (windMLMode)
|
||||||
16,
|
umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE
|
||||||
0,
|
| UGL_MESA_WINDML_EXCLUSIVE,
|
||||||
8,8,8,0,
|
16,
|
||||||
NULL);
|
0,
|
||||||
|
8,8,8,0,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE,
|
||||||
|
16,
|
||||||
|
0,
|
||||||
|
8,8,8,0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize();
|
uglDeinitialize();
|
||||||
|
@ -228,8 +237,9 @@ void windMLAccum(void)
|
||||||
|
|
||||||
initGL(width, height);
|
initGL(width, height);
|
||||||
|
|
||||||
while (!getEvent())
|
drawGL();
|
||||||
drawGL();
|
|
||||||
|
while (!getEvent());
|
||||||
|
|
||||||
uglEventQDestroy (eventServiceId, qId);
|
uglEventQDestroy (eventServiceId, qId);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
/*
|
/*
|
||||||
modification history
|
modification history
|
||||||
--------------------
|
--------------------
|
||||||
|
02a,29aug01,sra WindML mode added
|
||||||
01a,17jul01,sra written
|
01a,17jul01,sra written
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -38,23 +39,42 @@ DESCRIPTION
|
||||||
Show all the UGL/Mesa demos
|
Show all the UGL/Mesa demos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <vxWorks.h>
|
#include <vxWorks.h>
|
||||||
#include <taskLib.h>
|
#include <taskLib.h>
|
||||||
|
#include <ugl/ugl.h>
|
||||||
|
#include <ugl/uglinput.h>
|
||||||
|
#include <ugl/uglevent.h>
|
||||||
|
#include <ugl/uglfont.h>
|
||||||
|
|
||||||
void windMLPoint (void);
|
#define BLACK 0
|
||||||
void windMLLine (void);
|
#define RED 1
|
||||||
void windMLFlip (void);
|
|
||||||
void windMLCube (void);
|
struct _colorStruct
|
||||||
void windMLBounce (void);
|
{
|
||||||
void windMLGears (void);
|
UGL_RGB rgbColor;
|
||||||
void windMLIcoTorus (void);
|
UGL_COLOR uglColor;
|
||||||
void windMLOlympic (void);
|
}
|
||||||
void windMLTexCube (void);
|
colorTable[] =
|
||||||
void windMLTexCyl (void);
|
{
|
||||||
void windMLTeapot (void);
|
{ UGL_MAKE_RGB(0, 0, 0), 0},
|
||||||
void windMLStencil (void);
|
{ UGL_MAKE_RGB(255, 0, 0), 0},
|
||||||
void windMLDrawPix (void);
|
};
|
||||||
void windMLAccum (void);
|
|
||||||
|
void windMLPoint (UGL_BOOL windMLMode);
|
||||||
|
void windMLLine (UGL_BOOL windMLMode);
|
||||||
|
void windMLFlip (UGL_BOOL windMLMode);
|
||||||
|
void windMLCube (UGL_BOOL windMLMode);
|
||||||
|
void windMLBounce (UGL_BOOL windMLMode);
|
||||||
|
void windMLGears (UGL_BOOL windMLMode);
|
||||||
|
void windMLIcoTorus (UGL_BOOL windMLMode);
|
||||||
|
void windMLOlympic (UGL_BOOL windMLMode);
|
||||||
|
void windMLTexCube (UGL_BOOL windMLMode);
|
||||||
|
void windMLTexCyl (UGL_BOOL windMLMode);
|
||||||
|
void windMLTeapot (UGL_BOOL windMLMode);
|
||||||
|
void windMLStencil (UGL_BOOL windMLMode);
|
||||||
|
void windMLDrawPix (UGL_BOOL windMLMode);
|
||||||
|
void windMLAccum (UGL_BOOL windMLMode);
|
||||||
void windMLAllDemos (void);
|
void windMLAllDemos (void);
|
||||||
|
|
||||||
void uglalldemos (void)
|
void uglalldemos (void)
|
||||||
|
@ -65,34 +85,114 @@ void uglalldemos (void)
|
||||||
|
|
||||||
void windMLAllDemos(void)
|
void windMLAllDemos(void)
|
||||||
{
|
{
|
||||||
|
UGL_BOOL windMLFlag = UGL_FALSE;
|
||||||
|
UGL_FB_INFO fbInfo;
|
||||||
|
UGL_EVENT event;
|
||||||
|
UGL_EVENT_SERVICE_ID eventServiceId;
|
||||||
|
UGL_EVENT_Q_ID qId;
|
||||||
|
UGL_INPUT_EVENT * pInputEvent;
|
||||||
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
UGL_DEVICE_ID devId;
|
||||||
|
UGL_GC_ID gc;
|
||||||
|
UGL_FONT_ID fontId;
|
||||||
|
UGL_FONT_DEF fontDef;
|
||||||
|
UGL_FONT_DRIVER_ID fontDrvId;
|
||||||
|
UGL_ORD textOrigin = UGL_FONT_TEXT_UPPER_LEFT;
|
||||||
|
int displayHeight, displayWidth;
|
||||||
|
int textWidth, textHeight;
|
||||||
|
static UGL_CHAR * message =
|
||||||
|
"Do you want to use WindML exclusively ? (y/n) ";
|
||||||
|
|
||||||
windMLPoint();
|
uglInitialize();
|
||||||
|
|
||||||
windMLLine();
|
uglDriverFind (UGL_DISPLAY_TYPE, 0, (UGL_UINT32 *)&devId);
|
||||||
|
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||||
|
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||||
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
windMLFlip();
|
gc = uglGcCreate(devId);
|
||||||
|
|
||||||
windMLCube();
|
uglDriverFind (UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32 *)&fontDrvId);
|
||||||
|
uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin);
|
||||||
|
|
||||||
windMLBounce();
|
uglFontFindString(fontDrvId, "familyName=Helvetica; pixelSize = 18",
|
||||||
|
&fontDef);
|
||||||
|
|
||||||
windMLGears();
|
if ((fontId = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL)
|
||||||
|
{
|
||||||
|
printf("Font not found. Exiting.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
windMLIcoTorus();
|
uglInfo(devId, UGL_FB_INFO_REQ, &fbInfo);
|
||||||
|
displayWidth = fbInfo.width;
|
||||||
|
displayHeight = fbInfo.height;
|
||||||
|
|
||||||
windMLOlympic();
|
uglColorAlloc (devId, &colorTable[BLACK].rgbColor, UGL_NULL,
|
||||||
|
&colorTable[BLACK].uglColor, 1);
|
||||||
|
uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL,
|
||||||
|
&colorTable[RED].uglColor, 1);
|
||||||
|
|
||||||
windMLTexCube();
|
uglBackgroundColorSet(gc, colorTable[BLACK].uglColor);
|
||||||
|
uglForegroundColorSet(gc, colorTable[RED].uglColor);
|
||||||
|
uglFontSet(gc, fontId);
|
||||||
|
uglTextSizeGet(fontId, &textWidth, &textHeight, -1, message);
|
||||||
|
uglTextDraw(gc, (displayWidth - textWidth) / 2,
|
||||||
|
(displayHeight - textHeight) / 2 - textHeight, -1, message);
|
||||||
|
/* flushQ();
|
||||||
|
*/
|
||||||
|
if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER)
|
||||||
|
!= UGL_STATUS_Q_EMPTY)
|
||||||
|
{
|
||||||
|
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||||
|
|
||||||
windMLTexCyl();
|
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||||
|
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||||
|
{
|
||||||
|
switch(pInputEvent->type.keyboard.key)
|
||||||
|
{
|
||||||
|
case 'Y':
|
||||||
|
case 'y':
|
||||||
|
windMLFlag = UGL_TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
windMLFlag = UGL_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
windMLTeapot();
|
uglFontDestroy (fontId);
|
||||||
|
uglGcDestroy (gc);
|
||||||
|
uglEventQDestroy (eventServiceId, qId);
|
||||||
|
uglDeinitialize();
|
||||||
|
|
||||||
windMLStencil();
|
windMLPoint(windMLFlag);
|
||||||
|
|
||||||
windMLDrawPix();
|
windMLLine(windMLFlag);
|
||||||
|
|
||||||
windMLAccum();
|
windMLFlip(windMLFlag);
|
||||||
|
|
||||||
|
windMLCube(windMLFlag);
|
||||||
|
|
||||||
|
windMLBounce(windMLFlag);
|
||||||
|
|
||||||
|
windMLGears(windMLFlag);
|
||||||
|
|
||||||
|
windMLIcoTorus(windMLFlag);
|
||||||
|
|
||||||
|
windMLOlympic(windMLFlag);
|
||||||
|
|
||||||
|
windMLTexCube(windMLFlag);
|
||||||
|
|
||||||
|
windMLTexCyl(windMLFlag);
|
||||||
|
|
||||||
|
windMLTeapot(windMLFlag);
|
||||||
|
|
||||||
|
windMLStencil(windMLFlag);
|
||||||
|
|
||||||
|
windMLDrawPix(windMLFlag);
|
||||||
|
|
||||||
|
windMLAccum(windMLFlag);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,15 +200,15 @@ UGL_LOCAL int getEvent(void)
|
||||||
return(retVal);
|
return(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLBounce (void);
|
void windMLBounce (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglbounce (void)
|
void uglbounce (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tBounce", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLBounce,
|
taskSpawn("tBounce", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLBounce,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLBounce(void)
|
void windMLBounce(UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -232,7 +232,11 @@ void windMLBounce(void)
|
||||||
|
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,15 +196,15 @@ UGL_LOCAL int getEvent(void)
|
||||||
return(retVal);
|
return(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLCube (void);
|
void windMLCube (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglcube (void)
|
void uglcube (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLCube,
|
taskSpawn("tCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLCube,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLCube (void)
|
void windMLCube (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -226,7 +226,11 @@ void windMLCube (void)
|
||||||
eventServiceId = UGL_NULL;
|
eventServiceId = UGL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
/* Fullscreen */
|
/* Fullscreen */
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: ugldrawpix.c,v $
|
* $Log: ugldrawpix.c,v $
|
||||||
|
* Revision 1.2 2001/09/10 19:21:13 brianp
|
||||||
|
* WindML updates (Stephane Raimbault)
|
||||||
|
*
|
||||||
* Revision 1.1 2001/08/20 16:07:11 brianp
|
* Revision 1.1 2001/08/20 16:07:11 brianp
|
||||||
* WindML driver (Stephane Raimbault)
|
* WindML driver (Stephane Raimbault)
|
||||||
*
|
*
|
||||||
|
@ -79,7 +82,7 @@
|
||||||
|
|
||||||
#include "../util/readtex.h"
|
#include "../util/readtex.h"
|
||||||
|
|
||||||
#define IMAGE_FILE "Mesa/images/girl.rgb"
|
#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
|
||||||
|
|
||||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||||
|
@ -373,15 +376,15 @@ UGL_LOCAL void cleanUp (void)
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLDrawPix (void);
|
void windMLDrawPix (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void ugldrawpix (void)
|
void ugldrawpix (void)
|
||||||
{
|
{
|
||||||
taskSpawn ("tDrawPix", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLDrawPix,
|
taskSpawn ("tDrawPix", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLDrawPix,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLDrawPix (void)
|
void windMLDrawPix (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
GLuint ciMode;
|
GLuint ciMode;
|
||||||
|
@ -402,7 +405,12 @@ void windMLDrawPix (void)
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
/* Double buffering */
|
/* Double buffering */
|
||||||
umc = uglMesaCreateNewContext (UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
|
@ -424,6 +432,7 @@ void windMLDrawPix (void)
|
||||||
loopEvent();
|
loopEvent();
|
||||||
|
|
||||||
cleanUp();
|
cleanUp();
|
||||||
|
free(Image);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,15 +171,15 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLFlip (void);
|
void windMLFlip (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglflip (void)
|
void uglflip (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip,
|
taskSpawn ("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLFlip(void)
|
void windMLFlip (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -192,13 +192,18 @@ void windMLFlip(void)
|
||||||
|
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE_SW, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE_SOFTWARE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize();
|
uglDeinitialize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||||
|
|
||||||
|
|
|
@ -219,6 +219,8 @@ UGL_LOCAL void drawGL (void)
|
||||||
|
|
||||||
glPopMatrix ();
|
glPopMatrix ();
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
|
||||||
uglMesaSwapBuffers ();
|
uglMesaSwapBuffers ();
|
||||||
|
|
||||||
#ifdef COUNT_FRAMES
|
#ifdef COUNT_FRAMES
|
||||||
|
@ -360,15 +362,15 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLGears (void);
|
void windMLGears (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglgears (void)
|
void uglgears (void)
|
||||||
{
|
{
|
||||||
taskSpawn ("tGears", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLGears,
|
taskSpawn ("tGears", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLGears,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLGears (void)
|
void windMLGears (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -390,8 +392,12 @@ void windMLGears (void)
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
/* Double buffering */
|
/* Double buffering */
|
||||||
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext (UGL_MESA_DOUBLE, NULL);
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
|
|
|
@ -246,15 +246,15 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLIcoTorus (void);
|
void windMLIcoTorus (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglicotorus (void)
|
void uglicotorus (void)
|
||||||
{
|
{
|
||||||
taskSpawn ("tIcoTorus", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLIcoTorus,
|
taskSpawn ("tIcoTorus", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLIcoTorus,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLIcoTorus (void)
|
void windMLIcoTorus (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -279,7 +279,11 @@ void windMLIcoTorus (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Double buffering */
|
/* Double buffering */
|
||||||
umc = uglMesaCreateNewContext (UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,16 +213,16 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLLine (void);
|
void windMLLine (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglline (void)
|
void uglline (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tLine", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLLine,
|
taskSpawn("tLine", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLLine,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void windMLLine(void)
|
void windMLLine(UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -239,7 +239,11 @@ void windMLLine(void)
|
||||||
|
|
||||||
/* Double buffer */
|
/* Double buffer */
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -419,7 +419,7 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLOlympic (void);
|
void windMLOlympic (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglolympic (void)
|
void uglolympic (void)
|
||||||
{
|
{
|
||||||
|
@ -427,7 +427,7 @@ void uglolympic (void)
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
0,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLOlympic(void)
|
void windMLOlympic(UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
|
||||||
|
@ -445,7 +445,12 @@ void windMLOlympic(void)
|
||||||
eventServiceId = UGL_NULL;
|
eventServiceId = UGL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize();
|
uglDeinitialize();
|
||||||
|
|
|
@ -127,12 +127,12 @@ UGL_LOCAL void drawGL (void)
|
||||||
glRotatef(angleT, 1.0, -1.0, 0.0);
|
glRotatef(angleT, 1.0, -1.0, 0.0);
|
||||||
angleT = angleT++ % 360;
|
angleT = angleT++ % 360;
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
(rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
|
(rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
|
||||||
glVertex2f(0.75, 0.25);
|
glVertex2f(0.75, 0.25);
|
||||||
(rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
|
(rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
|
||||||
glVertex2f(0.75, 0.75);
|
glVertex2f(0.75, 0.75);
|
||||||
(rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
|
(rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
|
||||||
glVertex2f(0.25, 0.75);
|
glVertex2f(0.25, 0.75);
|
||||||
glEnd();
|
glEnd();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
@ -140,8 +140,7 @@ UGL_LOCAL void drawGL (void)
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
if(DOUBLE_BUFFER)
|
uglMesaSwapBuffers();
|
||||||
uglMesaSwapBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -175,15 +174,15 @@ UGL_LOCAL int getEvent(void)
|
||||||
return(retVal);
|
return(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLPoint (void);
|
void windMLPoint (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglpoint (void)
|
void uglpoint (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tPoint", 210, VX_FP_TASK, 100000,
|
taskSpawn ("tPoint", 210, VX_FP_TASK, 100000,
|
||||||
(FUNCPTR)windMLPoint, 0,1,2,3,4,5,6,7,8,9);
|
(FUNCPTR)windMLPoint, UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLPoint(void)
|
void windMLPoint (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLubyte pPixels[4];
|
GLubyte pPixels[4];
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
|
@ -206,9 +205,21 @@ void windMLPoint(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DOUBLE_BUFFER)
|
if (DOUBLE_BUFFER)
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
{
|
||||||
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE, NULL);
|
{
|
||||||
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,15 +177,15 @@ UGL_LOCAL int getEvent(void)
|
||||||
return(retVal);
|
return(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLStencil (void);
|
void windMLStencil (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglstencil (void)
|
void uglstencil (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tStencil", 210, VX_FP_TASK, 100000,
|
taskSpawn("tStencil", 210, VX_FP_TASK, 100000,
|
||||||
(FUNCPTR)windMLStencil, 0,1,2,3,4,5,6,7,8,9);
|
(FUNCPTR)windMLStencil,UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLStencil(void)
|
void windMLStencil(UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
GLsizei width, height;
|
GLsizei width, height;
|
||||||
|
@ -198,11 +198,20 @@ void windMLStencil(void)
|
||||||
|
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
umc = uglMesaCreateNewContextExt(GL_FALSE,
|
if (windMLMode)
|
||||||
16,
|
umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE
|
||||||
8,
|
| UGL_MESA_WINDML_EXCLUSIVE,
|
||||||
0,0,0,0,
|
16,
|
||||||
NULL);
|
8,
|
||||||
|
0,0,0,0,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE,
|
||||||
|
16,
|
||||||
|
8,
|
||||||
|
0,0,0,0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize();
|
uglDeinitialize();
|
||||||
|
|
|
@ -222,15 +222,15 @@ UGL_LOCAL void loopEvent(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLTeapot (void);
|
void windMLTeapot (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void uglteapot (void)
|
void uglteapot (void)
|
||||||
{
|
{
|
||||||
taskSpawn ("tTeapot", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTeapot,
|
taskSpawn ("tTeapot", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTeapot,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLTeapot (void)
|
void windMLTeapot (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
GLsizei displayWidth, displayHeight;
|
GLsizei displayWidth, displayHeight;
|
||||||
|
@ -252,7 +252,12 @@ void windMLTeapot (void)
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
/* Double buffering */
|
/* Double buffering */
|
||||||
umc = uglMesaCreateNewContext (UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
|
|
|
@ -47,7 +47,9 @@ Draw a textured cube
|
||||||
#include <GL/uglmesa.h>
|
#include <GL/uglmesa.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
|
||||||
#define IMAGE_FILE "Mesa/windmldemos/wrs_logo.bmp"
|
#include "../util/readtex.h"
|
||||||
|
|
||||||
|
#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
|
||||||
|
|
||||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||||
|
@ -58,103 +60,13 @@ UGL_LOCAL GLuint texture[1];
|
||||||
UGL_LOCAL GLuint theTexCube;
|
UGL_LOCAL GLuint theTexCube;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned long sizeX;
|
GLubyte *data;
|
||||||
unsigned long sizeY;
|
int width, height;
|
||||||
char *data;
|
GLenum format;
|
||||||
} TEX_IMAGE;
|
} TEX_IMAGE;
|
||||||
|
|
||||||
UGL_LOCAL void cleanUp (void);
|
UGL_LOCAL void cleanUp (void);
|
||||||
|
|
||||||
UGL_LOCAL GLboolean imageLoad(char *filename, TEX_IMAGE * texImage)
|
|
||||||
{
|
|
||||||
FILE * file = NULL;
|
|
||||||
unsigned long size;
|
|
||||||
unsigned long i;
|
|
||||||
unsigned short int planes;
|
|
||||||
unsigned short int bpp;
|
|
||||||
char temp;
|
|
||||||
|
|
||||||
if ((file = fopen(filename, "rb")) == NULL)
|
|
||||||
{
|
|
||||||
printf("File Not Found : %s\n", filename);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
fseek(file, 18, SEEK_CUR);
|
|
||||||
|
|
||||||
if ((i = fread(&texImage->sizeX, 4, 1, file)) != 1)
|
|
||||||
{
|
|
||||||
printf("Error reading width from %s.\n", filename);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Width of %s: %lu\n", filename, texImage->sizeX);
|
|
||||||
|
|
||||||
if ((i = fread(&texImage->sizeY, 4, 1, file)) != 1)
|
|
||||||
{
|
|
||||||
printf("Error reading height from %s.\n", filename);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Height of %s: %lu\n", filename, texImage->sizeY);
|
|
||||||
size = texImage->sizeX * texImage->sizeY * 3;
|
|
||||||
|
|
||||||
if ((fread(&planes, 2, 1, file)) != 1)
|
|
||||||
{
|
|
||||||
printf("Error reading planes from %s.\n", filename);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (planes != 1)
|
|
||||||
{
|
|
||||||
printf("Planes from %s is not 1: %u\n", filename, planes);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((i = fread(&bpp, 2, 1, file)) != 1)
|
|
||||||
{
|
|
||||||
printf("Error reading bpp from %s.\n", filename);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bpp != 24)
|
|
||||||
{
|
|
||||||
printf("Bpp from %s is not 24: %u\n", filename, bpp);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
fseek(file, 24, SEEK_CUR);
|
|
||||||
|
|
||||||
texImage->data = (char *) malloc(size);
|
|
||||||
|
|
||||||
if (texImage->data == NULL)
|
|
||||||
{
|
|
||||||
printf("Error allocating memory for color-corrected texImage data");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((i = fread(texImage->data, size, 1, file)) != 1)
|
|
||||||
{
|
|
||||||
printf("Error reading texImage data from %s.\n", filename);
|
|
||||||
free(texImage->data);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bgr -> rgb */
|
|
||||||
|
|
||||||
for (i=0; i<size; i+=3)
|
|
||||||
{
|
|
||||||
temp = texImage->data[i];
|
|
||||||
texImage->data[i] = texImage->data[i + 2];
|
|
||||||
texImage->data[i + 2] = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UGL_LOCAL void loadGLTexture()
|
UGL_LOCAL void loadGLTexture()
|
||||||
{
|
{
|
||||||
TEX_IMAGE * texImage=NULL;
|
TEX_IMAGE * texImage=NULL;
|
||||||
|
@ -168,9 +80,11 @@ UGL_LOCAL void loadGLTexture()
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!imageLoad(IMAGE_FILE, texImage))
|
texImage->data = LoadRGBImage(IMAGE_FILE, &texImage->width,
|
||||||
|
&texImage->height, &texImage->format);
|
||||||
|
if (!texImage->data)
|
||||||
{
|
{
|
||||||
printf("Error allocating space for image data");
|
printf("Couldn't read %s\n", IMAGE_FILE);
|
||||||
free(texImage);
|
free(texImage);
|
||||||
cleanUp();
|
cleanUp();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -180,7 +94,7 @@ UGL_LOCAL void loadGLTexture()
|
||||||
glGenTextures(1, &texture[0]);
|
glGenTextures(1, &texture[0]);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture[0]);
|
glBindTexture(GL_TEXTURE_2D, texture[0]);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, 3,
|
glTexImage2D(GL_TEXTURE_2D, 0, 3,
|
||||||
texImage->sizeX, texImage->sizeY,
|
texImage->width, texImage->height,
|
||||||
0, GL_RGB, GL_UNSIGNED_BYTE, texImage->data);
|
0, GL_RGB, GL_UNSIGNED_BYTE, texImage->data);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
@ -331,6 +245,7 @@ UGL_LOCAL void initGL(int width, int height)
|
||||||
glEnd(); /* done with the polygon */
|
glEnd(); /* done with the polygon */
|
||||||
glEndList();
|
glEndList();
|
||||||
|
|
||||||
|
glDisable(GL_DITHER);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
/* Reset the projection matrix */
|
/* Reset the projection matrix */
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
@ -403,16 +318,16 @@ UGL_LOCAL void cleanUp (void)
|
||||||
uglDeinitialize();
|
uglDeinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLTexCube (void);
|
void windMLTexCube (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void ugltexcube (void)
|
void ugltexcube (void)
|
||||||
{
|
{
|
||||||
taskSpawn("tTexCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCube,
|
taskSpawn("tTexCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCube,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void windMLTexCube(void)
|
void windMLTexCube(UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
GLuint width, height;
|
GLuint width, height;
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
|
@ -431,7 +346,11 @@ void windMLTexCube(void)
|
||||||
eventServiceId = UGL_NULL;
|
eventServiceId = UGL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: ugltexcyl.c,v $
|
* $Log: ugltexcyl.c,v $
|
||||||
|
* Revision 1.2 2001/09/10 19:21:13 brianp
|
||||||
|
* WindML updates (Stephane Raimbault)
|
||||||
|
*
|
||||||
* Revision 1.1 2001/08/20 16:07:11 brianp
|
* Revision 1.1 2001/08/20 16:07:11 brianp
|
||||||
* WindML driver (Stephane Raimbault)
|
* WindML driver (Stephane Raimbault)
|
||||||
*
|
*
|
||||||
|
@ -330,15 +333,15 @@ UGL_LOCAL void cleanUp (void)
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLTexCyl (void);
|
void windMLTexCyl (UGL_BOOL windMLMode);
|
||||||
|
|
||||||
void ugltexcyl (void)
|
void ugltexcyl (void)
|
||||||
{
|
{
|
||||||
taskSpawn ("tTexCyl", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCyl,
|
taskSpawn ("tTexCyl", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCyl,
|
||||||
0,1,2,3,4,5,6,7,8,9);
|
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void windMLTexCyl (void)
|
void windMLTexCyl (UGL_BOOL windMLMode)
|
||||||
{
|
{
|
||||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||||
GLsizei displayWidth, displayHeight;
|
GLsizei displayWidth, displayHeight;
|
||||||
|
@ -365,7 +368,12 @@ void windMLTexCyl (void)
|
||||||
qId = uglEventQCreate (eventServiceId, 100);
|
qId = uglEventQCreate (eventServiceId, 100);
|
||||||
|
|
||||||
/* Double buffering */
|
/* Double buffering */
|
||||||
umc = uglMesaCreateNewContext (UGL_MESA_DOUBLE, NULL);
|
if (windMLMode)
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||||
|
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||||
|
else
|
||||||
|
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||||
|
|
||||||
if (umc == NULL)
|
if (umc == NULL)
|
||||||
{
|
{
|
||||||
uglDeinitialize ();
|
uglDeinitialize ();
|
||||||
|
|
Loading…
Reference in New Issue