From 306933046cdc70e20af7facea8bc8a975812787e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Sep 2001 19:21:13 +0000 Subject: [PATCH] WindML updates (Stephane Raimbault) --- docs/README.WINDML | 14 ++- include/GL/uglmesa.h | 245 ++++++------------------------------- progs/images/wrs_logo.rgb | Bin 0 -> 37574 bytes progs/windml/uglaccum.c | 30 +++-- progs/windml/uglalldemos.c | 156 ++++++++++++++++++----- progs/windml/uglbounce.c | 14 ++- progs/windml/uglcube.c | 12 +- progs/windml/ugldrawpix.c | 21 +++- progs/windml/uglflip.c | 15 ++- progs/windml/uglgears.c | 14 ++- progs/windml/uglicotorus.c | 14 ++- progs/windml/uglline.c | 12 +- progs/windml/uglolympic.c | 11 +- progs/windml/uglpoint.c | 39 +++--- progs/windml/uglstencil.c | 27 ++-- progs/windml/uglteapot.c | 13 +- progs/windml/ugltexcube.c | 129 ++++--------------- progs/windml/ugltexcyl.c | 18 ++- 18 files changed, 361 insertions(+), 423 deletions(-) create mode 100644 progs/images/wrs_logo.rgb diff --git a/docs/README.WINDML b/docs/README.WINDML index a227d42b4db..e42d48dd3fc 100644 --- a/docs/README.WINDML +++ b/docs/README.WINDML @@ -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 redirection is adviced in target server. + 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\objMesaOS.o +You can put the previous lines in a file and use: +< filename + 6. Download the application modules. 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(). -6. Before exiting, call if required uglEventQDestroy and then uglDeinitialize(); +6. Before exiting, call if required uglEventQDestroy and then + uglDeinitialize(); Limitations ----------- I found the following limitations in my driver : - Color Indexed management is only in 8 bits - - The front and the back buffer must have the structure (mode and - size). A structure umc->buffer is requisite if the front and back - buffers are different. - - It isn't possible to mix UGL/OpenGL application with a software - double buffer (to fix) + - It's possible to mix UGL/OpenGL application with a software + double buffer Modifications ------------ diff --git a/include/GL/uglmesa.h b/include/GL/uglmesa.h index 44f8fc035ee..a70a0ae9129 100644 --- a/include/GL/uglmesa.h +++ b/include/GL/uglmesa.h @@ -48,92 +48,66 @@ extern "C" { * Values for display mode of uglMesaCreateContext () */ -#define UGL_MESA_SINGLE 0x00 -#define UGL_MESA_DOUBLE 0x01 -#define UGL_MESA_DOUBLE_SW 0x02 -#define UGL_MESA_DOUBLE_HW 0x03 +/* + * With these mask values, it's possible to test double buffer mode + * with UGL_MESA_DOUBLE mask + * + * 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_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: */ -#define UGL_MESA_ROW_LENGTH 0x10 -#define UGL_MESA_Y_UP 0x11 +#define UGL_MESA_ROW_LENGTH 0x20 +#define UGL_MESA_Y_UP 0x21 /* * Accepted by uglMesaGetIntegerv: */ -#define UGL_MESA_LEFT_X 0x18 -#define UGL_MESA_TOP_Y 0x19 -#define UGL_MESA_WIDTH 0x20 -#define UGL_MESA_HEIGHT 0x21 -#define UGL_MESA_DISPLAY_WIDTH 0x22 -#define UGL_MESA_DISPLAY_HEIGHT 0x23 -#define UGL_MESA_COLOR_FORMAT 0x24 -#define UGL_MESA_COLOR_MODEL 0x25 -#define UGL_MESA_PIXEL_FORMAT 0x26 -#define UGL_MESA_TYPE 0x27 -#define UGL_MESA_RGB 0x28 -#define UGL_MESA_COLOR_INDEXED 0x29 - +#define UGL_MESA_LEFT_X 0x01 +#define UGL_MESA_TOP_Y 0x02 +#define UGL_MESA_WIDTH 0x03 +#define UGL_MESA_HEIGHT 0x04 +#define UGL_MESA_DISPLAY_WIDTH 0x05 +#define UGL_MESA_DISPLAY_HEIGHT 0x06 +#define UGL_MESA_COLOR_FORMAT 0x07 +#define UGL_MESA_COLOR_MODEL 0x08 +#define UGL_MESA_PIXEL_FORMAT 0x09 +#define UGL_MESA_TYPE 0x0A +#define UGL_MESA_RGB 0x0B +#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 */ typedef struct uglMesaContext * UGL_MESA_CONTEXT; -/* - * 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 uglMesaCreateNewContext (GLenum mode, UGL_MESA_CONTEXT share_list); -/* - * 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, +UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode, GLint depth_bits, GLint stencil_bits, GLint accum_red_bits, @@ -142,175 +116,34 @@ UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum db_flag, GLint accum_alpha_bits, 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, GLsizei left, GLsizei top, 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); -/* - * 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); -/* - * 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); -/* - * 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); -/* - * Destroy the current UGL/Mesa rendering context - * - */ void uglMesaDestroyContext (void); -/* - * Return the current UGL/Mesa context - * - * Return: a UGL/Mesa context, or NULL if error - * - */ 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); -/* - * 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); -/* - * 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); -/* - * 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, 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, 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 * clutSizeaDKk4@CgO~p=B#@9!NW#y+0KNsEg4aQB&<3~?5?=+*g9Bg#SOTKJ z4`4JH44wq-K?_3Ste^-S0-Jyd#Db~dAK)GEEa(J$2#FQIRd5t+1u0-A2nFN8``|_J zDDVg9nV1{kB-jB~g1JBqz62kGS3q|V0OW*3mx9w^H&_D}0zLQ!3P^Vb=%=JwnKgVz385 zwlmO%8P5SPLZ%l2$Z&c%7zR+s=`g=($3Zec+0#(ww049{JqSK0ho?cA#dZ@Tj=vQ&Jyza+k_0bM93@n?Mvl^^oM+2K;JwMc|F&UkY^z8 zr(YuE$+d*^gRJ@uC8RI

G7}LP#H!*9Y?NeG{NPy~lxPfhQroE`s&I06qba1N3Fj zW55D_0)qhB)}sQT4LwlzCs3d6kj3LBLLQ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Op2a0^8n%m?WIRV#lfmR>TnXR9cL?;U+!K(0zhYa+gH`b-Lc94^m}Q^~Q8 zHGglZh#(WUd)MvU)bx21{_shaN7A75yji#YM1`Y7vF_+y52iq-O>o27j99yIDCW?3 zFh$^`9D%k%1IwEh>bSSsO^QYS_smKirpGF!apPs$T2j?Ec@73jg%3iy!hR_`MQ+wx zRvx%P9fh)Ipfq~S2b|c&T=-CSw^?k-nlA#e%aU-O!`9UbGyq4Nl#J8ME<@|%u?Z?a zJ(|tYmAaLu5cLOO|L)y|Yb$O@C_MpPVmrTor6m~;%Sg#Cbew;W!slixIt*9Mo*OrH zXg36P7BDSqYl13CM*teoTM4!s3;`iDxR8)_R)yKG*w^Kky@ zUk~kGhdWBblT4}G3vi$IUFGTbyW^Q4m=PHfeaQSiFyCNt_+90xi*&F_Y`xP(q#j|9 zOc~Sodb*p*xciyMQnDi#up+yF?Jx+HK5Kkhf_Q31-xk;+CU55P_EfsP|`ymy?8|1^B$aPuup?_=Dz@m*9qoNGUS|GFVEM=QVP z6IEK)T%$Zu9ggP4aNQCYdU9_p8A4huN_;ecXdh2Z#NU<-=YC8~oHg3r@vEohi7NbE z#XFDC$Bk?EY2j|jdai-n{RItde+6%BUqC{tble1f46he3AfA2*G6|xz7q^%$<@(dQ z-~gigfzltK3E^279>l$F?74u$aBjEXWpbaE+}F5w;m2tm(rosh)l@iuB5jrOwFm3z#jD_TQ3{Pk*E ziGt~iq>=5yBljKBDZ0W5Kka6 zhSJRb;tsLr7HNt@cODgYU#2}A)}(G(NJrO8=SrK_4IYP&4KDX{>D)?*W(PVX^9H53 zrF<_PS(iQWU%M9UY^k0Aq(D*7YWMxY}Dhz343_>Kf3xpWGvSwQKs z01^=(;4vgr?96Nh8>DOrbyR_=Sfja3kG@T7BBWZnAP!I2+nHM u{$^9kf9)aO|Kg #include #include +#include +#include +#include +#include -void windMLPoint (void); -void windMLLine (void); -void windMLFlip (void); -void windMLCube (void); -void windMLBounce (void); -void windMLGears (void); -void windMLIcoTorus (void); -void windMLOlympic (void); -void windMLTexCube (void); -void windMLTexCyl (void); -void windMLTeapot (void); -void windMLStencil (void); -void windMLDrawPix (void); -void windMLAccum (void); +#define BLACK 0 +#define RED 1 + +struct _colorStruct + { + UGL_RGB rgbColor; + UGL_COLOR uglColor; + } +colorTable[] = + { + { UGL_MAKE_RGB(0, 0, 0), 0}, + { UGL_MAKE_RGB(255, 0, 0), 0}, + }; + +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 uglalldemos (void) @@ -65,34 +85,114 @@ void uglalldemos (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) "; + + uglInitialize(); + + 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); + + gc = uglGcCreate(devId); + + uglDriverFind (UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32 *)&fontDrvId); + uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin); + + uglFontFindString(fontDrvId, "familyName=Helvetica; pixelSize = 18", + &fontDef); - windMLPoint(); + if ((fontId = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL) + { + printf("Font not found. Exiting.\n"); + return; + } - windMLLine(); + uglInfo(devId, UGL_FB_INFO_REQ, &fbInfo); + displayWidth = fbInfo.width; + displayHeight = fbInfo.height; + + uglColorAlloc (devId, &colorTable[BLACK].rgbColor, UGL_NULL, + &colorTable[BLACK].uglColor, 1); + uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL, + &colorTable[RED].uglColor, 1); + + 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; + + 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; + } + } + } + + uglFontDestroy (fontId); + uglGcDestroy (gc); + uglEventQDestroy (eventServiceId, qId); + uglDeinitialize(); + + windMLPoint(windMLFlag); + + windMLLine(windMLFlag); - windMLFlip(); + windMLFlip(windMLFlag); - windMLCube(); + windMLCube(windMLFlag); - windMLBounce(); + windMLBounce(windMLFlag); - windMLGears(); + windMLGears(windMLFlag); - windMLIcoTorus(); + windMLIcoTorus(windMLFlag); - windMLOlympic(); + windMLOlympic(windMLFlag); - windMLTexCube(); + windMLTexCube(windMLFlag); - windMLTexCyl(); + windMLTexCyl(windMLFlag); - windMLTeapot(); + windMLTeapot(windMLFlag); - windMLStencil(); + windMLStencil(windMLFlag); - windMLDrawPix(); + windMLDrawPix(windMLFlag); - windMLAccum(); + windMLAccum(windMLFlag); return; } diff --git a/progs/windml/uglbounce.c b/progs/windml/uglbounce.c index bcabf449632..287015a4131 100644 --- a/progs/windml/uglbounce.c +++ b/progs/windml/uglbounce.c @@ -200,15 +200,15 @@ UGL_LOCAL int getEvent(void) return(retVal); } -void windMLBounce (void); +void windMLBounce (UGL_BOOL windMLMode); void uglbounce (void) { 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; UGL_INPUT_DEVICE_ID keyboardDevId; @@ -231,8 +231,12 @@ void windMLBounce(void) uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId); 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) { diff --git a/progs/windml/uglcube.c b/progs/windml/uglcube.c index 9080ba1fb98..e701d8db462 100644 --- a/progs/windml/uglcube.c +++ b/progs/windml/uglcube.c @@ -196,15 +196,15 @@ UGL_LOCAL int getEvent(void) return(retVal); } -void windMLCube (void); +void windMLCube (UGL_BOOL windMLMode); void uglcube (void) { 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; UGL_INPUT_DEVICE_ID keyboardDevId; @@ -226,7 +226,11 @@ void windMLCube (void) 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 */ diff --git a/progs/windml/ugldrawpix.c b/progs/windml/ugldrawpix.c index 678f423d2e3..b33be2c6aee 100644 --- a/progs/windml/ugldrawpix.c +++ b/progs/windml/ugldrawpix.c @@ -8,6 +8,9 @@ /* * $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 * WindML driver (Stephane Raimbault) * @@ -79,7 +82,7 @@ #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_Q_ID qId; @@ -373,15 +376,15 @@ UGL_LOCAL void cleanUp (void) uglDeinitialize (); } -void windMLDrawPix (void); +void windMLDrawPix (UGL_BOOL windMLMode); void ugldrawpix (void) { 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; GLuint ciMode; @@ -402,7 +405,12 @@ void windMLDrawPix (void) qId = uglEventQCreate (eventServiceId, 100); /* 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) { uglDeinitialize (); @@ -424,6 +432,7 @@ void windMLDrawPix (void) loopEvent(); cleanUp(); - + free(Image); + return; } diff --git a/progs/windml/uglflip.c b/progs/windml/uglflip.c index ffc6ece2db1..0ca068f417d 100644 --- a/progs/windml/uglflip.c +++ b/progs/windml/uglflip.c @@ -171,15 +171,15 @@ UGL_LOCAL void loopEvent(void) } } -void windMLFlip (void); +void windMLFlip (UGL_BOOL windMLMode); void uglflip (void) { - taskSpawn("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip, - 0,1,2,3,4,5,6,7,8,9); + taskSpawn ("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip, + UGL_FALSE,1,2,3,4,5,6,7,8,9); } -void windMLFlip(void) +void windMLFlip (UGL_BOOL windMLMode) { UGL_INPUT_DEVICE_ID keyboardDevId; @@ -192,13 +192,18 @@ void windMLFlip(void) 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) { uglDeinitialize(); return; } + uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH, UGL_MESA_FULLSCREEN_HEIGHT); diff --git a/progs/windml/uglgears.c b/progs/windml/uglgears.c index fe750a57d8d..468fe899806 100644 --- a/progs/windml/uglgears.c +++ b/progs/windml/uglgears.c @@ -219,6 +219,8 @@ UGL_LOCAL void drawGL (void) glPopMatrix (); + glFlush(); + uglMesaSwapBuffers (); #ifdef COUNT_FRAMES @@ -360,15 +362,15 @@ UGL_LOCAL void loopEvent(void) } } -void windMLGears (void); +void windMLGears (UGL_BOOL windMLMode); void uglgears (void) { 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; UGL_INPUT_DEVICE_ID keyboardDevId; @@ -390,8 +392,12 @@ void windMLGears (void) qId = uglEventQCreate (eventServiceId, 100); /* 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) { uglDeinitialize (); diff --git a/progs/windml/uglicotorus.c b/progs/windml/uglicotorus.c index 46226f1e82c..c09b6d1b520 100644 --- a/progs/windml/uglicotorus.c +++ b/progs/windml/uglicotorus.c @@ -246,15 +246,15 @@ UGL_LOCAL void loopEvent(void) } } -void windMLIcoTorus (void); +void windMLIcoTorus (UGL_BOOL windMLMode); void uglicotorus (void) { 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; UGL_INPUT_DEVICE_ID keyboardDevId; @@ -279,8 +279,12 @@ void windMLIcoTorus (void) } /* 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) { uglDeinitialize (); diff --git a/progs/windml/uglline.c b/progs/windml/uglline.c index fd100fff4b4..e58f071ea4b 100644 --- a/progs/windml/uglline.c +++ b/progs/windml/uglline.c @@ -213,16 +213,16 @@ UGL_LOCAL void loopEvent(void) } } -void windMLLine (void); +void windMLLine (UGL_BOOL windMLMode); void uglline (void) { 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; @@ -239,7 +239,11 @@ void windMLLine(void) /* 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) { diff --git a/progs/windml/uglolympic.c b/progs/windml/uglolympic.c index de7c278b1a7..282558dacbd 100644 --- a/progs/windml/uglolympic.c +++ b/progs/windml/uglolympic.c @@ -419,7 +419,7 @@ UGL_LOCAL void loopEvent(void) } } -void windMLOlympic (void); +void windMLOlympic (UGL_BOOL windMLMode); void uglolympic (void) { @@ -427,7 +427,7 @@ void uglolympic (void) 0,1,2,3,4,5,6,7,8,9); } -void windMLOlympic(void) +void windMLOlympic(UGL_BOOL windMLMode) { UGL_INPUT_DEVICE_ID keyboardDevId; @@ -444,8 +444,13 @@ void windMLOlympic(void) { eventServiceId = UGL_NULL; } + + 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) { uglDeinitialize(); diff --git a/progs/windml/uglpoint.c b/progs/windml/uglpoint.c index e184eaa7550..49c432c3a41 100644 --- a/progs/windml/uglpoint.c +++ b/progs/windml/uglpoint.c @@ -127,12 +127,12 @@ UGL_LOCAL void drawGL (void) glRotatef(angleT, 1.0, -1.0, 0.0); angleT = angleT++ % 360; glBegin(GL_TRIANGLES); - (rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED); - glVertex2f(0.75, 0.25); - (rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN); - glVertex2f(0.75, 0.75); - (rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE); - glVertex2f(0.25, 0.75); + (rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED); + glVertex2f(0.75, 0.25); + (rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN); + glVertex2f(0.75, 0.75); + (rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE); + glVertex2f(0.25, 0.75); glEnd(); glPopMatrix(); @@ -140,8 +140,7 @@ UGL_LOCAL void drawGL (void) glFlush(); - if(DOUBLE_BUFFER) - uglMesaSwapBuffers(); + uglMesaSwapBuffers(); } /************************************************************************ @@ -175,15 +174,15 @@ UGL_LOCAL int getEvent(void) return(retVal); } -void windMLPoint (void); +void windMLPoint (UGL_BOOL windMLMode); void uglpoint (void) { - taskSpawn("tPoint", 210, VX_FP_TASK, 100000, - (FUNCPTR)windMLPoint, 0,1,2,3,4,5,6,7,8,9); + taskSpawn ("tPoint", 210, VX_FP_TASK, 100000, + (FUNCPTR)windMLPoint, UGL_FALSE,1,2,3,4,5,6,7,8,9); } -void windMLPoint(void) +void windMLPoint (UGL_BOOL windMLMode) { GLubyte pPixels[4]; GLsizei width, height; @@ -206,9 +205,21 @@ void windMLPoint(void) } 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 - 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) { diff --git a/progs/windml/uglstencil.c b/progs/windml/uglstencil.c index 94e9f502596..07e8fc626f3 100644 --- a/progs/windml/uglstencil.c +++ b/progs/windml/uglstencil.c @@ -177,15 +177,15 @@ UGL_LOCAL int getEvent(void) return(retVal); } -void windMLStencil (void); +void windMLStencil (UGL_BOOL windMLMode); void uglstencil (void) { 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; GLsizei width, height; @@ -197,12 +197,21 @@ void windMLStencil(void) uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId); qId = uglEventQCreate (eventServiceId, 100); - - umc = uglMesaCreateNewContextExt(GL_FALSE, - 16, - 8, - 0,0,0,0, - NULL); + + if (windMLMode) + umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE + | UGL_MESA_WINDML_EXCLUSIVE, + 16, + 8, + 0,0,0,0, + NULL); + else + umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE, + 16, + 8, + 0,0,0,0, + NULL); + if (umc == NULL) { uglDeinitialize(); diff --git a/progs/windml/uglteapot.c b/progs/windml/uglteapot.c index 26c766d8346..651fe0990e1 100644 --- a/progs/windml/uglteapot.c +++ b/progs/windml/uglteapot.c @@ -222,15 +222,15 @@ UGL_LOCAL void loopEvent(void) } } -void windMLTeapot (void); +void windMLTeapot (UGL_BOOL windMLMode); void uglteapot (void) { 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; GLsizei displayWidth, displayHeight; @@ -252,7 +252,12 @@ void windMLTeapot (void) qId = uglEventQCreate (eventServiceId, 100); /* 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) { uglDeinitialize (); diff --git a/progs/windml/ugltexcube.c b/progs/windml/ugltexcube.c index 1ce6666b65a..62b0306e647 100644 --- a/progs/windml/ugltexcube.c +++ b/progs/windml/ugltexcube.c @@ -47,7 +47,9 @@ Draw a textured cube #include #include -#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_Q_ID qId; @@ -58,103 +60,13 @@ UGL_LOCAL GLuint texture[1]; UGL_LOCAL GLuint theTexCube; typedef struct { - unsigned long sizeX; - unsigned long sizeY; - char *data; - } TEX_IMAGE; + GLubyte *data; + int width, height; + GLenum format; + } TEX_IMAGE; 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; idata[i]; - texImage->data[i] = texImage->data[i + 2]; - texImage->data[i + 2] = temp; - } - - fclose(file); - - return GL_TRUE; - } - - UGL_LOCAL void loadGLTexture() { TEX_IMAGE * texImage=NULL; @@ -167,10 +79,12 @@ UGL_LOCAL void loadGLTexture() cleanUp(); 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); cleanUp(); exit(1); @@ -180,7 +94,7 @@ UGL_LOCAL void loadGLTexture() glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, 3, - texImage->sizeX, texImage->sizeY, + texImage->width, texImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, texImage->data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -330,7 +244,8 @@ UGL_LOCAL void initGL(int width, int height) glEnd(); /* done with the polygon */ glEndList(); - + + glDisable(GL_DITHER); glMatrixMode(GL_PROJECTION); /* Reset the projection matrix */ glLoadIdentity(); @@ -403,16 +318,16 @@ UGL_LOCAL void cleanUp (void) uglDeinitialize(); } -void windMLTexCube (void); +void windMLTexCube (UGL_BOOL windMLMode); void ugltexcube (void) { 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; UGL_INPUT_DEVICE_ID keyboardDevId; @@ -430,8 +345,12 @@ void windMLTexCube(void) { 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) { diff --git a/progs/windml/ugltexcyl.c b/progs/windml/ugltexcyl.c index d83c20b2f38..d2fe687b926 100644 --- a/progs/windml/ugltexcyl.c +++ b/progs/windml/ugltexcyl.c @@ -8,6 +8,9 @@ /* * $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 * WindML driver (Stephane Raimbault) * @@ -309,7 +312,7 @@ UGL_LOCAL void initGL(void) glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, -70.0 ); - + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); @@ -330,15 +333,15 @@ UGL_LOCAL void cleanUp (void) uglDeinitialize (); } -void windMLTexCyl (void); +void windMLTexCyl (UGL_BOOL windMLMode); void ugltexcyl (void) { 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; GLsizei displayWidth, displayHeight; @@ -365,7 +368,12 @@ void windMLTexCyl (void) qId = uglEventQCreate (eventServiceId, 100); /* 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) { uglDeinitialize (); -- 2.30.2