From 3ac3f0324239cf9a7161f8aa90a7589eeb8607a5 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Wed, 4 Jun 2014 13:49:12 +0200 Subject: [PATCH] dey-examples: add opengl example apps for mx6 https://jira.digi.com/browse/DEL-804 Signed-off-by: Javier Viguera --- .../dey-examples/dey-examples-opengles.bb | 24 +- .../mx5/opengles/Makefile | 16 + .../mx5}/opengles/es11_example.c | 2 +- .../mx5}/opengles/es20_example.c | 2 +- .../mx5}/opengles/lib/fslutil/fslutil.c | 0 .../mx5}/opengles/lib/glu3/glu3.c | 0 .../mx5}/opengles/lib/include/FSL/c2d_api.h | 0 .../mx5}/opengles/lib/include/FSL/fslutil.h | 0 .../mx5}/opengles/lib/include/GLU3/glu3.h | 0 .../mx5}/opengles/texture.bmp | Bin .../mx6/opengles/Makefile | 27 + .../mx6/opengles/common/inc/FSL/fsl_egl.h | 50 + .../mx6/opengles/common/inc/FSL/fslutil.h | 224 +++ .../mx6/opengles/common/inc/GLU3/glu3.h | 1365 +++++++++++++++++ .../opengles/common/inc/GLU3/glu3_scalar.h | 396 +++++ .../mx6/opengles/common/src/fsl_egl.c | 475 ++++++ .../mx6/opengles/common/src/fslutil.c | 935 +++++++++++ .../mx6/opengles/common/src/glu3.c | 334 ++++ .../mx6/opengles/es11_example.c | 419 +++++ .../mx6/opengles/es20_example.c | 488 ++++++ .../mx6/opengles/texture.bmp | Bin 0 -> 196664 bytes .../packagegroup-dey-examples.bb | 1 + 22 files changed, 4743 insertions(+), 15 deletions(-) create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/Makefile rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/es11_example.c (99%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/es20_example.c (99%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/lib/fslutil/fslutil.c (100%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/lib/glu3/glu3.c (100%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/lib/include/FSL/c2d_api.h (100%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/lib/include/FSL/fslutil.h (100%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/lib/include/GLU3/glu3.h (100%) rename meta-digi-dey/recipes-digi/dey-examples/{files => dey-examples-opengles/mx5}/opengles/texture.bmp (100%) create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/Makefile create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fsl_egl.h create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fslutil.h create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3.h create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3_scalar.h create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fsl_egl.c create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fslutil.c create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/glu3.c create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es11_example.c create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es20_example.c create mode 100644 meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/texture.bmp diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb index 392b93682..0fcf08a47 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb @@ -5,7 +5,7 @@ SECTION = "examples" LICENSE = "GPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" -DEPENDS = "virtual/egl virtual/libgles1 virtual/libgles2 virtual/kernel" +DEPENDS = "virtual/egl virtual/libgles1 virtual/libgles2" PR = "${DISTRO}.r0" @@ -13,21 +13,19 @@ SRC_URI = "file://opengles" S = "${WORKDIR}/opengles" -do_compile() { - ${CC} -O2 -Wall -Ilib/include es20_example.c lib/fslutil/fslutil.c -lm -lEGL -lGLESv2 -o es20_example - ${CC} -O2 -Wall -Ilib/include es11_example.c lib/fslutil/fslutil.c lib/glu3/glu3.c -lm -lEGL -lGLESv1_CM -o es11_example +EXTRA_OEMAKE = "" +EXTRA_OEMAKE_mx6 = "EGL_FLAVOUR=${@base_conditional('HAVE_GUI', '1' , 'x11', 'fb', d)}" + +do_install () { + oe_runmake DEST_DIR="${D}" install } -do_install() { - install -d ${D}${bindir} ${D}/usr/share/wallpapers - install -m 0755 es20_example es11_example ${D}${bindir} - install -m 0644 texture.bmp ${D}/usr/share/wallpapers -} +FILES_${PN} = "/opt/${PN}" +FILES_${PN}-dbg += "/opt/${PN}/.debug" -FILES_${PN} += "/usr/share/wallpapers/texture.bmp" - -RDEPENDS_${PN} = "lib2dz160-mx51 lib2dz430-mx51" +RDEPENDS_${PN}_mx5 = "lib2dz160-mx51 lib2dz430-mx51" +RDEPENDS_${PN}_mx6 = "libopenvg-mx6" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx51js|ccimx53js)" +COMPATIBLE_MACHINE = "(ccimx51js|ccimx53js|ccimx6adpt|ccimx6sbc)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/Makefile b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/Makefile new file mode 100644 index 000000000..47c86d7c5 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/Makefile @@ -0,0 +1,16 @@ +CFLAGS += -O2 -Ilib/include +VPATH = lib/fslutil lib/glu3 +BINARIES = es20_example es11_example + +all: $(BINARIES) + +es11_example: fslutil.o glu3.o + $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv1_CM $@.c -o $@ + +es20_example: fslutil.o + $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv2 $@.c -o $@ + +install: $(BINARIES) + -mkdir -p $(DEST_DIR)/opt/dey-examples-opengles + install -m 0755 $^ $(DEST_DIR)/opt/dey-examples-opengles + install -m 0644 texture.bmp $(DEST_DIR)/opt/dey-examples-opengles diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/es11_example.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es11_example.c similarity index 99% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/es11_example.c rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es11_example.c index 5f239ecc7..6408c17b5 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/es11_example.c +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es11_example.c @@ -51,7 +51,7 @@ int LoadGLTextures() } /* Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit */ - if (ImageLoad("/usr/share/wallpapers/texture.bmp", image1)) { + if (ImageLoad("texture.bmp", image1)) { /* Create The Texture */ glGenTextures(1, texture); /* Typical Texture Generation Using Data From The Bitmap */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/es20_example.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es20_example.c similarity index 99% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/es20_example.c rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es20_example.c index e0f46c500..1f4325e71 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/es20_example.c +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/es20_example.c @@ -231,7 +231,7 @@ int LoadGLTextures() } /* Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit */ - if (ImageLoad("/usr/share/wallpapers/texture.bmp", image1)) { + if (ImageLoad("texture.bmp", image1)) { /* Create The Texture */ glGenTextures(1, texture); /* Typical Texture Generation Using Data From The Bitmap */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/fslutil/fslutil.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/fslutil/fslutil.c similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/fslutil/fslutil.c rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/fslutil/fslutil.c diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/glu3/glu3.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/glu3/glu3.c similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/glu3/glu3.c rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/glu3/glu3.c diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/FSL/c2d_api.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/FSL/c2d_api.h similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/FSL/c2d_api.h rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/FSL/c2d_api.h diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/FSL/fslutil.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/FSL/fslutil.h similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/FSL/fslutil.h rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/FSL/fslutil.h diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/GLU3/glu3.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/GLU3/glu3.h similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/lib/include/GLU3/glu3.h rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/lib/include/GLU3/glu3.h diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/opengles/texture.bmp b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/texture.bmp similarity index 100% rename from meta-digi-dey/recipes-digi/dey-examples/files/opengles/texture.bmp rename to meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx5/opengles/texture.bmp diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/Makefile b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/Makefile new file mode 100644 index 000000000..ea8c73bbc --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/Makefile @@ -0,0 +1,27 @@ +CFLAGS += -O2 -Icommon/inc -DLINUX +VPATH = common/src +BINARIES = es20_example es11_example + +ifeq ($(EGL_FLAVOUR),fb) +$(info BUILDING FOR FB) +CFLAGS += -DEGL_API_FB +else ifeq ($(EGL_FLAVOUR),x11) +$(info BUILDING FOR X11) +CFLAGS += -DEGL_USE_X11 +X11LIBS = -lX11 +else +$(error Platform not recognized) +endif + +all: $(BINARIES) + +es11_example: fsl_egl.o fslutil.o glu3.o + $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv1_CM $(X11LIBS) $@.c -o $@ + +es20_example: fsl_egl.o fslutil.o + $(CC) $(CFLAGS) $^ -lm -lEGL -lGLESv2 $(X11LIBS) $@.c -o $@ + +install: $(BINARIES) + -mkdir -p $(DEST_DIR)/opt/dey-examples-opengles + install -m 0755 $^ $(DEST_DIR)/opt/dey-examples-opengles + install -m 0644 texture.bmp $(DEST_DIR)/opt/dey-examples-opengles diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fsl_egl.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fsl_egl.h new file mode 100644 index 000000000..06f9144aa --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fsl_egl.h @@ -0,0 +1,50 @@ +/**************************************************************************** +* Copyright (c) 2012 Freescale Semiconductor, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* * Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* * Neither the name of the Freescale Semiconductor, Inc. nor the names of +* its contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Labels parameters + +*****************************************************************************/ + +#ifndef _FSL_EGL_H_ +#define _FSL_EGL_H_ +#ifdef __cplusplus +extern "C" { +#endif +#include + + EGLNativeDisplayType fsl_getNativeDisplay(); + EGLNativeWindowType fsl_createwindow(EGLDisplay egldisplay, EGLNativeDisplayType eglNativeDisplayType); + void fsl_destroywindow(EGLNativeWindowType eglNativeWindowType,EGLNativeDisplayType eglNativeDisplayType); + + +#ifdef __cplusplus +} +#endif +#endif //_FSL_EGL_H_ + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fslutil.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fslutil.h new file mode 100644 index 000000000..bac2327bc --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/FSL/fslutil.h @@ -0,0 +1,224 @@ +/**************************************************************************** +* Copyright (c) 2012 Freescale Semiconductor, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* * Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* * Neither the name of the Freescale Semiconductor, Inc. nor the names of +* its contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Labels parameters + +*****************************************************************************/ +#ifndef _FSLUTIL_H_ +#define _FSLUTIL_H_ +#ifdef __cplusplus +extern "C" { +#endif + +// Values for reading in ATC compressed texture files +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_AMD 0x8C93 +#define ATC_SIGNATURE 0xCCC40002 +#define ATI1N_SIGNATURE 0x31495441 +#define ATI2N_SIGNATURE 0x32495441 +#define ETC_SIGNATURE 0xEC000001 +#define ATC_RGB 0x00000001 +#define ATC_RGBA 0x00000002 +#define ATC_TILED 0X00000004 +#define ATC_ALPHA_INTERPOLATED 0X00000010 + +#define PI_OVER_360 0.00872664f + +#ifndef fslBool +#define fslBool int +#define FSL_FALSE 0 +#define FSL_TRUE !FSL_FALSE +#endif + +#define FSL_POINTER_MAX 10000 + + +/* Image type - contains height, width, and data */ +typedef struct Image_s { + unsigned long sizeX; + unsigned long sizeY; + char *data; + int Format; +} Image; + + +typedef enum fslStatus_e +{ + FSL_STATUS_DEVICE_ERROR = -5, //could not open a hardware device driver + FSL_STATUS_NO_CONTEXT = -4, //something has caused a device to fail and loose context + FSL_STATUS_BAD_PARAMETER = -3, + FSL_STATUS_ALLOCATION_ISSUE = -2, + FSL_STATUS_UNSUPPORTED_FEATURE = -1, + FSL_STATUS_GENERAL_ERROR = 0, + FSL_STATUS_SUCCESS = 1, + FSL_FSLSTATUS_END = 0xFFFFFFFF, //This forces the data type for binary lib compatipility +} fslStatus; + +typedef enum fslAxis_e +{ + FSL_X_AXIS, FSL_Y_AXIS, FSL_Z_AXIS +} fslAxis; + +typedef enum fslInputType_e +{ + FSL_INPUT_KEYPRESS =1000, + FSL_INPUT_KEYRELEASE =1500, + FSL_INPUT_POINTERDOWN =2000, + FSL_INPUT_POINTERUP =3000, + FSL_INPUT_POINTERMOVE =4000, + FSL_INPUT_STOP =5000, + FSL_INPUT_PLAY =5001, + FSL_INPUT_PAUSE =5002, + FSL_INPUT_REW =5003, + FSL_INPUT_FFWD =5004, + FSL_INPUT_SEEK =5005, + FSL_INPUT_CLOSEWINDOW =6000, + FSL_INPUTTYPE_END =0xFFFFFFFF, +} fslInputType; + +typedef struct fslInputEventType_s +{ + fslInputType input; + unsigned int signalA; //X, keystroke 1 Coordinates range from 0 to FSL_POINTER_MAX; 0,0 lower left corner + unsigned int signalB; //Y, keystroke 2 + unsigned int signalC; //undefined, could be pointer enumerator for multi-touch / secondary input + long time; //in microseconds +} fslInputEventType; + +typedef enum fslInputDevice_e +{ + FSL_INPUTDEVICE_TOUCHSCREEN =1000, + FSL_INPUTDEVICETYPE_END =0xFFFFFFFF, +} fslInputDevice; + +typedef void* fslDeviceHandle; + +#define FSL_UTIL_MAX_FILE_NAME_LENGTH 1024 // This is arbitrary +#define FSL_INPUT_MAX_EVENTS 64 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef FSL_EGL_USE_X11 +#include +#include +#include +#include +#include +#include +#endif + + +//-------------------------------------------------------------------------------------- +// Name: fslLoadCTES +// Desc: Helper function to load an compressed image file (ATC, ETC, etc.) from the compressenator +//-------------------------------------------------------------------------------------- +char* fslLoadCTES( char* strFileName, unsigned int* pWidth, unsigned int* pHeight, unsigned int* nFormat, unsigned int* nSize ); + +//fslLoadBMP +fslBool fslInit2DBMPTextureGL(char *,unsigned int *pTextureHandle); + +//fslLoadTGA +fslBool fslInit2DTGATextureGL(char* strFileName, unsigned int *pTextureHandle); + +//-------------------------------------------------------------------------------------- +// Name: fslEGLCheck +// Desc: Helper function to print EGL errors and exits application +//-------------------------------------------------------------------------------------- +fslBool fslEGLCheck( fslBool bExitOnFailure ); + +//-------------------------------------------------------------------------------------- +// Name: fslInit2DCTESTextureGL +// Desc: Helper function to load a CTES texture file and bind it to a given GL texture handle +//-------------------------------------------------------------------------------------- +fslBool fslInit2DCTESTextureGL( char* strFileName, unsigned int *pTextureHandle ); + +#ifdef FSL_EGL_USE_X11 +//-------------------------------------------------------------------------------------- +// Name: fslLoadFontX +// Desc: Helper function to load a X11 font into given struct +//-------------------------------------------------------------------------------------- +void fslLoadFontX( Display *display, XFontStruct **font_info ); + +//-------------------------------------------------------------------------------------- +// Name: fslErrorHandlerX +// Desc: Helper function to print incoming X11 server errors +//-------------------------------------------------------------------------------------- +int fslErrorHandlerX( Display *display, XErrorEvent *error ); +#endif + +//-------------------------------------------------------------------------------------- +// Name: fslGetTickCount +// Desc: Helper function to get current time +//-------------------------------------------------------------------------------------- +unsigned int fslGetTickCount(); + +//-------------------------------------------------------------------------------------- +// Name: fslMulMatrix4x4 +// Desc: 4x4 Matix Muliply DEPRECATED for GLU +//-------------------------------------------------------------------------------------- +void fslMultMatrix4x4( float *matC, float *matA, float *matB); + +fslBool fslInvertMatrix4x4( float *matA, float *matC); + +void fslPerspectiveMatrix4x4 ( float *m, float fov, float aspect, float zNear, float zFar); + +void fslMultMatrix4x4Vec4x1 ( float *matA, float *vecA, float *vecB ); + +void fslRotateMatrix4x4 (float *m, float angle, fslAxis axis); + +void fslTranslateMatrix4x4 (float *m, float transX, float transY, float transZ); + +void fslScaleMatrix4x4 (float *m, float scaleX, float scaleY, float scaleZ); +void fslNormalize(float *v); +void fslLoadIdentityMatrix4x4 (float *m); +void fslPrintMatrix4x4(float *m); +fslBool fslUnProject(float winx,float winy, float winz, float modelMatrix[16], float projMatrix[16], int viewport[4], float *objx, float *objy, float *objz); +void fslCrossProduct(float *result, float *b, float* c); +void fslDirectionVector(float *result, float *endPoint, float *startPoint); +float fslInnerProduct( float *v, float *q); +int fslRayIntersectsTriangle(float *p, float *d,float *v0, float *v1, float *v2); +int LoadBMP(char *filename, Image *image); +int LoadTGA(const char *textureFileName, Image *image); +void fslCalculateNormals(float *triArray, int size, float *normArray); + +#ifdef __cplusplus +} +#endif +#endif //_FSLUTIL_H_ + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3.h new file mode 100644 index 000000000..1a897ba1d --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3.h @@ -0,0 +1,1365 @@ +/* + * Copyright © 2009 Ian D. Romanick + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __glu3_h__ +#define __glu3_h__ + +/** + * \file glu3.h + * Interface definitions for GLU3 library. + */ + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#include +#include +#ifdef USE_GL20 +#include +#include +#elif USE_MX31 +#include +#else +#include +#include +#endif + +#ifdef HAVE_STDBOOL_H +# include +#else +# ifndef HAVE__BOOL +# ifdef __cplusplus +typedef bool _Bool; +# else +# define _Bool signed char +# endif +# endif +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +#endif + +#define GLU3_VERSION_0_1 +#define GLU3_VERSION_0_9 + +#ifndef GLchar +#define GLchar GLubyte +#endif + +#ifndef GLdouble +#define GLdouble GLfloat +#endif + +struct GLUmat4; + +/** + * Basic four-component vector type. + */ +struct GLUvec4 { + /** Data values of the vector. */ + GLfloat values[4]; + +#ifdef __cplusplus + /** Default constructor. Data values are uninitialized. */ + inline GLUvec4(void) + { + } + + /** Initialize vector from one float value. */ + inline GLUvec4(GLfloat v) + { + values[0] = v; + values[1] = v; + values[2] = v; + values[3] = v; + } + + /** Initialize vector from four float values. */ + inline GLUvec4(GLfloat x , GLfloat y, GLfloat z, GLfloat w) + { + values[0] = x; + values[1] = y; + values[2] = z; + values[3] = w; + } + + /** Initialize vector from another vector. */ + inline GLUvec4(const GLUvec4 &v) + { + values[0] = v.values[0]; + values[1] = v.values[1]; + values[2] = v.values[2]; + values[3] = v.values[3]; + } + + /** + * Multiply a vector with a matrix. + * + * Multiply a row-vector with a 4x4 matrix resulting in a + * row-vector. + */ + GLUvec4 operator *(const GLUmat4 &) const; + + /** + * Component-wise multiplication with a vec4. + * + * \sa gluMult4v_4v + */ + GLUvec4 operator *(const GLUvec4 &) const; + + /** + * Multiply with a scalar. + * + * \sa gluMult4v_f + */ + GLUvec4 operator *(GLfloat) const; + + /** Component-wise addition with a vec4. */ + GLUvec4 operator +(const GLUvec4 &) const; + + /** Component-wise subtraction with a vec4. */ + GLUvec4 operator -(const GLUvec4 &) const; +#endif /* __cplusplus */ +}; + + +#ifdef __cplusplus +inline GLUvec4 operator *(GLfloat f, const GLUvec4 &v) +{ + return v * f; +} + +inline GLUvec4 &operator +=(GLUvec4 &l, const GLUvec4 &r) +{ + l = l + r; + return l; +} + +inline GLUvec4 &operator -=(GLUvec4 &l, const GLUvec4 &r) +{ + l = l - r; + return l; +} + +inline GLUvec4 &operator *=(GLUvec4 &l, const GLUvec4 &r) +{ + l = l * r; + return l; +} + +inline GLUvec4 &operator *=(GLUvec4 &l, GLfloat r) +{ + l = l * r; + return l; +} +#endif /* __cplusplus */ + + +/** + * Basic 4x4 matrix type. + */ +struct GLUmat4 { + /** Columns of the matrix. */ + struct GLUvec4 col[4]; + +#ifdef __cplusplus + /** Default constructor. Columns are uninitialized. */ + inline GLUmat4(void) + { + } + + /** Initialize a matrix from four vec4 inputs. + * Each vec4 is a column in the resulting matrix. + */ + inline GLUmat4(const GLUvec4 & c0, const GLUvec4 & c1, + const GLUvec4 & c2, const GLUvec4 & c3) + { + col[0] = c0; + col[1] = c1; + col[2] = c2; + col[3] = c3; + } + + /** Initialize a matrix from another matrix. */ + inline GLUmat4(const GLUmat4 &m) + { + col[0] = m.col[0]; + col[1] = m.col[1]; + col[2] = m.col[2]; + col[3] = m.col[3]; + } + + + /** + * Multiply a vector with a matrix. + * + * Multiply as a column-vector with a 4x4 matrix resulting in a + * column-vector. + * + * \sa gluMult4m_4v + */ + GLUvec4 operator *(const GLUvec4 &) const; + + /** + * Matrix multiply with a 4x4 matrix. + * + * \sa gluMult4m_4m + */ + GLUmat4 operator *(const GLUmat4 &) const; + + /** Multiply with a scalar. */ + GLUmat4 operator *(GLfloat) const; + + /** Component-wise addition with a mat4. */ + GLUmat4 operator +(const GLUmat4 &) const; + + /** Component-wise subtraction with a mat4. */ + GLUmat4 operator -(const GLUmat4 &) const; +#endif /* __cplusplus */ +}; + +#define GLU_MAX_STACK_DEPTH 32 + +struct GLUmat4Stack { + struct GLUmat4 stack[GLU_MAX_STACK_DEPTH]; + unsigned top; + +#ifdef __cplusplus + GLUmat4Stack() : top(0) + { + /* empty */ + } +#endif /* __cplusplus */ +}; + + +struct GLUarcball { + /** + * Base location of the viewport. + */ + /*@{*/ + unsigned viewport_x; + unsigned viewport_y; + /*@}*/ + + /** + * Dimensions of the viewport. + */ + /*@{*/ + unsigned viewport_width; + unsigned viewport_height; + /*@}*/ + + /** + * Screen X/Y location of initial mouse click. + */ + /*@{*/ + unsigned click_x; + unsigned click_y; + /*@}*/ + + +#ifdef __cplusplus + void viewport(unsigned x, unsigned y, unsigned width, unsigned height) + { + viewport_x = x; + viewport_y = y; + viewport_width = width; + viewport_height = height; + } + + void click(unsigned x, unsigned y) + { + click_x = x; + click_y = y; + } + + GLUmat4 drag(unsigned end_x, unsigned end_y); +#endif /* __cplusplus */ +}; + + +#if 0 +/** + * Consumer for shape data generated by a GLUshapeProducer object + * + * Objects of this class and its descenents are used to consume data generated + * by \c GLUshapeProducer. The \c GLUshapeProducer object is responsible for + * the format of the data generate, and the \c GLUshapeConsumer object is + * repsonsible for storing that data. + * + * This splits the functionality of the classic GLU's \c GLUquadric structure. + * + * \sa GLUshapeProducer + */ +class GLUshapeConsumer { +public: + /** + * Emit an individual vertex + * + * \param position Object-space position of the vertex. + * \param normal Object-space normal of the vertex. + * \param tangent Object-space tangent of the vertex. + * \param uv Parameter-space position of the vertex. The + * per-vertex values will range from (0,0,0,0) to + * (1, 1, 0, 0). + */ + virtual void vertex(const GLUvec4 &position, + const GLUvec4 &normal, + const GLUvec4 &tangent, + const GLUvec4 &uv) = 0; + + /** + * Start a new indexed primitive. + * + * \param mode GL primitive drawing mode used for this primitive + */ + virtual void begin_primitive(GLenum mode) = 0; + + /** + * Emit an element index for drawing + */ + virtual void index(unsigned idx) = 0; + + /** + * End an index primitive previously started with begin_primitive + */ + virtual void end_primitive(void) = 0; +}; + + +/** + * Base class of a shape generators. + * + * Base class defines the interface for all shape generators. Each concrete + * subclass is responsible for providing the pure virtual query and data + * generation methods. Data produced by a shape generator is pushed to a + * \c GLUshapeConsumer as it is generated. + * + * \sa GLUshapeConsumer + */ +class GLUshapeProducer { +public: + virtual ~GLUshapeProducer() + { + } + + /** + * Select the orientation of generated normals + * + * \param outside Set to true if normals should point towards the + * outside of the object. + */ + void orientation(bool outside); + + /** + * Get the number of vertices in the shape + * + * This can be used in the constructor for derived classes, for + * example, to determine how much storage to allocate for vertex data. + */ + virtual unsigned vertex_count(void) const = 0; + + /** + * Get the number of elements used to draw primitives for the shape + * + * This can be used in the constructor for derived classes, for + * example, to determine how much storage to allocate for element data. + */ + virtual unsigned element_count(void) const = 0; + + /** + * Get the number of primitves used to draw the shape + * + * This can be used in the constructor for derived classes, for + * example, to determine the primitive count for a call to + * \c glMultiDrawElements or to determine how much padding to allocate + * for restart values used with primitive restart. + */ + virtual unsigned primitive_count(void) const = 0; + + /** + * Generate the primitive + * + * Causes the data for the primitive to be generated. This will result + * in the \c vertex, \c begin_primitive, \c index, and \c end_primitive + * methods of \c consumer being invoked with the data as it is + * generated. + */ + virtual void generate(GLUshapeConsumer *consumer) const = 0; + +protected: + GLUshapeProducer(void) : + normals_point_out(true) + { + } + + bool normals_point_out; +}; + + +/** + * Shape generator that generates a sphere. + */ +class GLUsphereProducer : public GLUshapeProducer { +public: + /** + * Construct a new sphere shape generator + * + * \param radius Specifies the radius of the sphere. + * \param slices Specifies the number of subdivisions around the + * z-axis. These subdivisions are analogous to the + * slices of an orange. These also match longitude + * lines on the globe. + * \param stacks Specifies the number of subdivisions along the + * z-axis. These match the latitude lines on the globe. + */ + GLUsphereProducer(GLdouble radius, GLint slices, GLint stacks); + virtual unsigned vertex_count(void) const; + virtual unsigned element_count(void) const; + virtual unsigned primitive_count(void) const; + virtual void generate(GLUshapeConsumer *consumer) const; + +private: + double radius; + unsigned slices; + unsigned stacks; +}; + + +/** + * Shape generator that generates a cube. + */ +class GLUcubeProducer : public GLUshapeProducer { +public: + /** + * Construct a new cube shape generator + * + * \param radius Distance from the center of the cube to the center + * of one of the axis-aligned faces. + */ + GLUcubeProducer(GLdouble radius); + virtual unsigned vertex_count(void) const; + virtual unsigned element_count(void) const; + virtual unsigned primitive_count(void) const; + virtual void generate(GLUshapeConsumer *consumer) const; + +private: + double radius; +}; +#endif + +#ifndef __cplusplus +typedef struct GLUvec4 GLUvec4; +typedef struct GLUmat4 GLUmat4; +typedef struct GLUmat4Stack GLUmat4Stack; +typedef struct GLUarcball GLUarcball; +#endif /* __cplusplus */ + + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * Four component dot product from vec4 sources. + * + * \sa gluDot4 (C++) + */ +GLfloat gluDot4_4v(const GLUvec4 *, const GLUvec4 *); + +/** + * Three component dot product from vec4 sources. + * + * \sa gluDot3 (C++) + */ +GLfloat gluDot3_4v(const GLUvec4 *, const GLUvec4 *); + +/** + * Two component dot product from vec4 sources. + * + * \sa gluDot2 (C++) + */ +GLfloat gluDot2_4v(const GLUvec4 *, const GLUvec4 *); + +/** + * Cross product from vec4 sources + * + * The 3-dimensional cross product of \c u and \c v is calculated. The result + * is stored in the first three components of \c result. The fourth component + * is set to 0.0. + * + * \sa gluCross (C++) + */ +void gluCross4v(GLUvec4 *result, const GLUvec4 *u, const GLUvec4 *v); + +/** + * Normalize a vec4 + * + * The 4-dimensional normalization of \c u is stored in \c result. + * + * \sa gluNormalize (C++) + */ +void gluNormalize4v(GLUvec4 *result, const GLUvec4 *u); + +/** + * Calculate the length of a vec4 + * + * The length (magnitude) the 4-dimensional vector \c u is returned. + * + * \sa gluLength (C++) + */ +GLfloat gluLength4v(const GLUvec4 *u); + +/** + * Calculate the squared length of a vec4 + * + * The squared length (magnitude) the 4-dimensional vector \c u is returned. + * + * \sa gluLengthSqr (C++) + */ +GLfloat gluLengthSqr4v(const GLUvec4 *); + +/** + * Calculate the four dimensional outer product of two vec4 sources + * + * Assuing \c u and \c v are column vectors, the outer product is: + * + * \f$\left( \begin{tabular}{cccc} + * $u_x v_x$ & $u_x v_y$ & $u_x v_y$ & $u_x v_w$ \\ + * $u_y v_x$ & $u_y v_y$ & $u_y v_y$ & $u_y v_w$ \\ + * $u_z v_x$ & $u_z v_y$ & $u_z v_y$ & $u_z v_w$ \\ + * $u_w v_x$ & $u_w v_y$ & $u_w v_y$ & $u_w v_w$ \\ + * \end{tabular} \right)\f$ + */ +void gluOuter4v(GLUmat4 *result, const GLUvec4 *u, const GLUvec4 *v); + + +/** + * Component-wise multiply two vec4s + * + * \sa GLUvec4::operator* + */ +void gluMult4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *); + +/** + * Component-wise divide two vec4s + */ +void gluDiv4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *); + +/** + * Component-wise add two vec4s + * + * \sa GLUvec4::operator+ + */ +void gluAdd4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *); + +/** + * Component-wise subtract two vec4s + * + * \sa GLUvec4::operator- + */ +void gluSub4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *); + +/** + * Multiply with a scalar. + * + * \sa GLUvec4::operator* + */ +void gluMult4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat); + +/** Divide components of a vector by a scalar. */ +void gluDiv4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat); + +/** Add a scalar to each of the components of a vector. */ +void gluAdd4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat); + +/** Subtract a scalar from each of the components of a vector. */ +void gluSub4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat); + +/** + * Matrix multiply with a 4x4 matrix. + * + * \sa GLUmat4::operator* + */ +void gluMult4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *); + +/** + * Component-wise addition with a mat4. + * + * \sa GLUmat4::operator+ + */ +void gluAdd4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *); + +/** + * Component-wise subtraction with a mat4. + * + * \sa GLUmat4::operator- + */ +void gluSub4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *); + +/** + * Multiply a vector with a matrix. + * + * Multiply as a column-vector with a 4x4 matrix resulting in a + * column-vector. + * + * \sa GLUmat4::operator* + */ +void gluMult4m_4v(GLUvec4 *result, const GLUmat4 *m, const GLUvec4 *v); + +/** + * Multiply each component of a matrix with a scalar + * + * \sa GLUmat4::operator* + */ +void gluMult4m_f(GLUmat4 *result, const GLUmat4 *, GLfloat); + +/** + * Calculate a scaling transformation matrix from a vector + * + * A scaling transformation matrix is created using the x, y, and z + * components of \c u. Specifically, the matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $u_x$ & $0$ & $0$ & $0$ \\ + * $0$ & $u_y$ & $0$ & $0$ \\ + * $0$ & $0$ & $u_z$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluScale (C++) + */ +void gluScale4v(GLUmat4 *result, const GLUvec4 *u); + +/** \name Translation matrix + */ +/*@{*/ +/** + * Calculate a translation matrix using x, y, and z offsets + * + * The matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $x$ \\ + * $0$ & $1$ & $0$ & $y$ \\ + * $0$ & $0$ & $1$ & $z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluTranslate (C++) + */ +void gluTranslate3f(GLUmat4 *result, GLfloat x, GLfloat y, GLfloat z); + +/** + * Calculate a translation matrix using components of a vector + * + * The matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $v_x$ \\ + * $0$ & $1$ & $0$ & $v_y$ \\ + * $0$ & $0$ & $1$ & $v_z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluTranslate (C++) + */ +void gluTranslate4v(GLUmat4 *result, const GLUvec4 *v); +/*@}*/ + +/** + * Calculate a rotation matrix around an arbitrary axis + * + * \param axis Axis, based at the origin, around which to rotate + * \param angle Angle of rotation in radians + * + * If the specificed axis is not unit length, the vector will be normalized. + * + * \sa gluRotate (C++) + */ +void gluRotate4v(GLUmat4 *result, const GLUvec4 *axis, GLfloat angle); + +/** + * Calculate a viewing transformation + * + * \param eye Position, in 3-dimensional space, of the eye point. + * \param center Position, in 3-dimensional space, that the eye is looking at. + * \param up Direction of the up vector. + * \param result Storage for the resulting matrix. + * + * Calculates a transformation matrix that maps the eye point to the origin + * and the \c center to the negative Z axis. The direction defined by \c up + * is projected onto the X/Y plane an is mapped to the positive Y axis. + * + * The calculated matrix is: + * + * \f{eqnarray*}{ + * f &=& c - e \\ + * f' &=& f \over |f| \\ + * u' &=& u \over |u| \\ + * s &=& f \times u \\ + * u'' &=& s \times f \\ + * M &=& + * \left( \begin{tabular}{cccc} + * $s_x$ & $s_y$ & $s_z$ & $0$ \\ + * $u''_x$ & $u''_y$ & $u''_z$ & $0$ \\ + * $-f'_x$ & $-f'_y$ & $-f'_z$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) + * \times + * \left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $-e_x$ \\ + * $0$ & $1$ & $0$ & $-e_y$ \\ + * $0$ & $0$ & $1$ & $-e_z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) \\ + * \f} + * + * \sa gluLookAt (C++) + */ +void gluLookAt4v(GLUmat4 *result, const GLUvec4 *eye, const GLUvec4 *center, + const GLUvec4 *up); + +/** + * \name Projection matrix + * + * Functions that generate various common projection matrixes. + */ +/*@{*/ +/** + * Generate a perspective projection matrix + * + * \param result Location to store the calculated matrix + * \param left Coordinate for the left clipping plane + * \param right Coordinate for the right clipping plane + * \param top Coordinate for the top clipping plane + * \param bottom Coordinate for the bottom clipping plane + * \param near Distance to the near plane + * \param far Distance to the far plane + * + * The matrix calculated is: + * + * \f{eqnarray*}{ + * M &=& + * \left( \begin{tabular}{cccc} + * ${2 * near} \over {right - left}$ & $0$ & $ {{right + left} \over {right - left}}$ & $0$\\ + * $0$ & ${2 * near} \over {top - bottom}$ & $ {{top + bottom} \over {top - bottom}}$ & $0$ \\ + * $0$ & $0$ & $-{{far + near} \over {far - near}}$ & $-{{2 * far * near} \over {far - near}}$ \\ + * $0$ & $0$ & $-1$ & $0$ \\ + * \end{tabular} \right) \\ + * \f} + * + * If \c left = \c right, \c top = \c bottom, or \c near = \c far, the function + * returns without writing any value to \c result. + * + * If either\c near or \c far are negative, the function returns without + * writing any value to \c result. + */ +void gluFrustum6f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top, GLfloat near, GLfloat far); + +/** + * Calculate a perspective projection matrix + * + * \param result Storage for the resulting matrix. + * \param fovy Field-of-view in the Y direction, measured in radians + * \param aspect The ratio of the size in the X direction to the size in the + * Y direction. This is used to calculate the field-of-view in + * the X direction. + * \param near Distance to the near plane + * \param far Distance to the far plane + * + * The matrix calculated is: + * + * \f{eqnarray*}{ + * f &=& cotangent {\left({fovy \over 2} \right)} \\ + * M &=& + * \left( \begin{tabular}{cccc} + * $f \over aspect$ & $0$ & $0$ & $0$ \\ + * $0$ & $f$ & $0$ & $0$ \\ + * $0$ & $0$ & ${far + near} \over {near - far}$ & ${2 \times far \times near} \over {near - far}$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) \\ + * \f} + */ +void gluPerspective4f(GLUmat4 *result, GLfloat fovy, GLfloat aspect, + GLfloat near, GLfloat far); + +/** + * Generate an orthographic projection matrix + * + * \param result Location to store the calculated matrix + * \param left Coordinate for the left clipping plane + * \param right Coordinate for the right clipping plane + * \param top Coordinate for the top clipping plane + * \param bottom Coordinate for the bottom clipping plane + * + * The matrix calculated is: + * + * \f{eqnarray*}{ + * M &=& + * \left( \begin{tabular}{cccc} + * $2 \over {right - left}$ & $0$ & $0$ & $-{{right + left} \over {right - left}}$ \\ + * $0$ & $2 \over {top - bottom}$ & $0$ & $-{{top + bottom} \over {top - bottom}}$ \\ + * $0$ & $0$ & $-1$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) \\ + * \f} + * + * If \c left = \c right or \c top = \c bottom the function returns without + * writing any value to \c result. + * + * This function is identical to calling \c gluOrtho6f with \c near = -1 and + * \c far = 1. + * + * \sa gluOrtho6f + */ +void gluOrtho4f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top); + +/** + * Generate an orthographic projection matrix + * + * \param result Location to store the calculated matrix + * \param left Coordinate for the left clipping plane + * \param right Coordinate for the right clipping plane + * \param top Coordinate for the top clipping plane + * \param bottom Coordinate for the bottom clipping plane + * \param near Distance to the near plane + * \param far Distance to the far plane + * + * The matrix calculated is: + * + * \f{eqnarray*}{ + * M &=& + * \left( \begin{tabular}{cccc} + * $2 \over {right - left}$ & $0$ & $0$ & $-{{right + left} \over {right - left}}$ \\ + * $0$ & $2 \over {top - bottom}$ & $0$ & $-{{top + bottom} \over {top - bottom}}$ \\ + * $0$ & $0$ & $-2 \over {far - near}$ & $-{{far + near} \over {far - near}}$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) \\ + * \f} + * + * If \c left = \c right, \c top = \c bottom, or \c near = \c far, the function + * returns without writing any value to \c result. + * + * \s gluOrtho4f + */ +void gluOrtho6f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top, GLfloat near, GLfloat far); +/*@}*/ + +/** + * Calculate the transpose of a matrix. + */ +void gluTranspose4m(GLUmat4 *result, const GLUmat4 *m); + +/** + * Calculate the determinant of a matrix. + * + * \sa gluDeterminant4 (C++) + */ +GLfloat gluDeterminant4_4m(const GLUmat4 *m); + +/** + * Calculate the inverse of a matrix. + * + * Inverts the matrix \c m and stores the result in \c result. If \c m is + * not invertable, \c result is not modified + * + * \return + * If the matrix is invertable (i.e., the determinant is not zero), \c GL_TRUE + * is returned. Otherwise GL_FALSE is returned. + * + * \sa gluInverse4 (C++) + */ +GLboolean gluInverse4_4m(GLUmat4 *result, const GLUmat4 *m); + + +/** + * Identity matrix + * + * Global constant containing the matrix: + * + * \f$\left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $0$ \\ + * $0$ & $1$ & $0$ & $0$ \\ + * $0$ & $0$ & $1$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + */ +extern const GLUmat4 gluIdentityMatrix; + +/** + * Load a text file from disk + * + * \param file_name Name of the file to be loaded + * + * Loads data from a named text file and returns a pointer to that data to the + * caller. This may be useful, for example, for loading shader code from flies + * on disk. + * + * The pointer returned by this function should later be released by calling + * \c gluUnloadTextFile. + * + * \note + * The data pointed to by the return value if this function really is + * constant. On some systems this function may be implemented by creating a + * read-only mapping of the file. Writes to such data will result in program + * termination. + * + * \sa gluUnloadTextFile + */ +extern const GLchar *gluLoadTextFile(const char *file_name); + +/** + * Release data previously loaded with gluLoadTextFile. + * + * \sa gluLoadTextFile + */ +extern void gluUnloadTextFile(const GLchar *text); + +extern void gluArcballViewport(GLUarcball *ball, unsigned x, unsigned y, + unsigned width, unsigned height); + +extern void gluArcballClick(GLUarcball *ball, unsigned start_x, + unsigned start_y); + +extern void gluArcballDrag(GLUarcball *ball, GLUmat4 *transformation, + unsigned end_x, unsigned end_y); + +#ifdef __cplusplus +}; +#endif + +#ifdef __cplusplus +/** + * Four component dot product from vec4 sources. + * + * \sa gluDot4_4v + */ +GLfloat gluDot4(const GLUvec4 &, const GLUvec4 &); + +/** + * Three component dot product from vec4 sources. + * + * \sa gluDot3_4v + */ +GLfloat gluDot3(const GLUvec4 &, const GLUvec4 &); + +/** + * Two component dot product from vec4 sources. + * + * \sa gluDot2_4v + */ +GLfloat gluDot2(const GLUvec4 &, const GLUvec4 &); + +/** + * Cross product from vec4 sources + * + * The 3-dimensional cross product of \c u and \c v is calculated. The result + * is stored in the first three components of \c result. The fourth component + * is set to 0.0. + * + * \sa gluCross4v + */ +inline GLUvec4 gluCross(const GLUvec4 &u, const GLUvec4 &v) +{ + GLUvec4 t; + + gluCross4v(& t, & u, & v); + return t; +} + +/** + * Normalize a vec4 + * + * The 4-dimensional normalization of \c u is stored in \c result. + * + * \sa gluNormalize4v + */ +inline GLUvec4 gluNormalize(const GLUvec4 &v) +{ + GLUvec4 t; + + gluNormalize4v(& t, & v); + return t; +} + +/** + * Calculate the length of a vec4 + * + * The length (magnitude) the 4-dimensional vector \c u is returned. + * + * \sa gluLength4v + */ +inline GLfloat gluLength(const GLUvec4 &u) +{ + return gluLength4v(& u); +} + +/** + * Calculate the squared length of a vec4 + * + * The squared length (magnitude) the 4-dimensional vector \c u is returned. + * + * \sa gluLengthSqr4v + */ +inline GLfloat gluLengthSqr(const GLUvec4 &u) +{ + return gluLengthSqr4v(& u); +} + +/** + * Calculate a scaling transformation matrix from a vector + * + * A scaling transformation matrix is created using the x, y, and z + * components of \c u. Specifically, the matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $u_x$ & $0$ & $0$ & $0$ \\ + * $0$ & $u_y$ & $0$ & $0$ \\ + * $0$ & $0$ & $u_z$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluScale4v + */ +inline GLUmat4 gluScale(const GLUvec4 &u) +{ + GLUmat4 result; + + gluScale4v(& result, & u); + return result; +} + +/** + * Calculate a scaling transformation matrix from a vector + * + * A scaling transformation matrix is created using the x, y, and z + * components of \c u. Specifically, the matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $x$ & $0$ & $0$ & $0$ \\ + * $0$ & $y$ & $0$ & $0$ \\ + * $0$ & $0$ & $z$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluScale4v + */ +inline GLUmat4 gluScale(GLfloat x, GLfloat y, GLfloat z) +{ + GLUvec4 u(x, y, z, 1.0); + GLUmat4 result; + + gluScale4v(& result, & u); + return result; +} + +/** \name Translation matrix + */ +/*@{*/ +/** + * Calculate a translation matrix using x, y, and z offsets + * + * The matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $x$ \\ + * $0$ & $1$ & $0$ & $y$ \\ + * $0$ & $0$ & $1$ & $z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluTranslate3f + */ +inline GLUmat4 gluTranslate(GLfloat x, GLfloat y, GLfloat z) +{ + GLUmat4 result; + + gluTranslate3f(& result, x, y, z); + return result; +} + +/** + * Calculate a translation matrix using components of a vector + * + * The matrix generated is: + * + * \f$\left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $v_x$ \\ + * $0$ & $1$ & $0$ & $v_y$ \\ + * $0$ & $0$ & $1$ & $v_z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right)\f$ + * + * \sa gluTranslate4v + */ +inline GLUmat4 gluTranslate(const GLUvec4 &v) +{ + GLUmat4 result; + + gluTranslate4v(& result, & v); + return result; +} +/*@}*/ + +/** + * Calculate a rotation matrix around an arbitrary axis + * + * \param axis Axis, based at the origin, around which to rotate + * \param angle Angle of rotation in radians + * + * If the specificed axis is not unit length, the vector will be normalized. + * + * \sa gluRotate4v + */ +inline GLUmat4 gluRotate(const GLUvec4 &axis, GLfloat angle) +{ + GLUmat4 result; + + gluRotate4v(& result, & axis, angle); + return result; +} + +/** + * Calculate a viewing transformation + * + * \param eye Position, in 3-dimensional space, of the eye point. + * \param center Position, in 3-dimensional space, that the eye is looking at. + * \param up Direction of the up vector. + * \param result Storage for the resulting matrix. + * + * Calculates a transformation matrix that maps the eye point to the origin + * and the \c center to the negative Z axis. The direction defined by \c up + * is projected onto the X/Y plane an is mapped to the positive Y axis. + * + * The calculated matrix is: + * + * \f{eqnarray*}{ + * f &=& c - e \\ + * f' &=& f \over |f| \\ + * u' &=& u \over |u| \\ + * s &=& f \times u \\ + * u'' &=& s \times f \\ + * M &=& + * \left( \begin{tabular}{cccc} + * $s_x$ & $s_y$ & $s_z$ & $0$ \\ + * $u''_x$ & $u''_y$ & $u''_z$ & $0$ \\ + * $-f'_x$ & $-f'_y$ & $-f'_z$ & $0$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) + * \times + * \left( \begin{tabular}{cccc} + * $1$ & $0$ & $0$ & $-e_x$ \\ + * $0$ & $1$ & $0$ & $-e_y$ \\ + * $0$ & $0$ & $1$ & $-e_z$ \\ + * $0$ & $0$ & $0$ & $1$ \\ + * \end{tabular} \right) \\ + * \f} + * + * \sa gluLookAt4v + */ +inline GLUmat4 gluLookAt(const GLUvec4 &eye, const GLUvec4 ¢er, + const GLUvec4 &up) +{ + GLUmat4 result; + + gluLookAt4v(& result, & eye, & center, & up); + return result; +} + +/** + * Calculate the determinant of a matrix. + * + * \sa gluDeterminant4_4m + */ +inline GLfloat gluDeterminant4(const GLUmat4 &m) +{ + return gluDeterminant4_4m(& m); +} + +/** + * Calculate the inverse of a matrix. + * + * Inverts the matrix \c m and stores the result in \c result. If \c m is + * not invertable, \c result is not modified + * + * \return + * If the matrix is invertable (i.e., the determinant is not zero), \c GL_TRUE + * is returned. Otherwise GL_FALSE is returned. + * + * \sa gluInverse4_4m + */ +inline GLboolean gluInverse4(GLUmat4 &result, const GLUmat4 &m) +{ + return gluInverse4_4m(& result, & m); +} + +/** + * Calculate the inverse of a matrix. + * + * \return + * The inverse of the matrix \c m. If \c m is not invertable, the return + * result is undefined. + * + * \warning + * This function is really only safe when the input matrix is known to be + * invertable. Nearly all well behaved transformation matrices fall into this + * category. + * + * \sa gluInverse4_4m + */ +inline GLUmat4 gluInverse4(const GLUmat4 &m) +{ + GLUmat4 result; + + gluInverse4_4m(& result, & m); + return result; +} + + +inline GLUmat4 GLUarcball::drag(unsigned end_x, unsigned end_y) +{ + GLUmat4 result; + + gluArcballDrag(this, & result, end_x, end_y); + return result; +} +#endif /* __cplusplus */ + +#if defined(__cplusplus) +extern "C" { +#endif +/** + * \name Shading language helper functions + */ +/*@{*/ +/** + * Initialize the GLSL compiler infrastructure + * + * This function \b must be called before any of the GLU3 GLSL helper functions + * can be used. On Windows, this function must be called each time a context + * with a different color depth is made current. + * + * It is the responsibility of the caller to verify that the required version + * of GLSL and the required shader targets (e.g., geometry) are supported. + * + * \return + * If GLSL is available, \c true is returned. Otherwise \c false is returned. + */ +extern bool gluInitializeCompiler(void); + +/** + * Compile a shader + * + * Creates a new shader object for the specified target and compiles the + * supplied code into that shader object. If \c log_ptr is not \c NULL, a + * buffer will be allocated and filled with diagnostic messages from the + * shading language compiler. A pointer to this buffer will stored in + * \c log_ptr. + * + * The pointer stored in \c log_ptr must be later released with + * \c gluReleaseInfoLog. + * + * \param target Shader execution unit (e.g., \c GL_VERTEX_SHADER) + * \param code Shader source code + * \param log_ptr Location to store a pointer to the compiler generate info log + * + * \return + * If compilation was successful, the shader object is returned. On failure + * zero is returned. + * + * \sa gluReleaseInfoLog + */ +extern GLint gluCompileShader(GLenum target, const char *code, char **log_ptr); + +/** + * Link a shader program + * + * Links the specified shader program. If \c log_ptr is not \c NULL, a buffer + * will be allocated and filled with diagnostic messages from the shading + * language linker. A pointer to this buffer will stored in \c log_ptr. + * + * The pointer stored in \c log_ptr must be later released with + * \c gluReleaseInfoLog. + * + * \param prog Shading language program to be linked + * \param log_ptr Location to store a pointer to the compiler generate info log + * + * \return + * If linking was successful, \c true is returned. Otherwise \c false is + * returned. + * + * \sa gluReleaseInfoLog + */ +extern bool gluLinkProgram(GLuint prog, char **log_ptr); + +/** + * Attach a list of shader objects to a program + * + * Attaches a zero-terminated list of shader objects to a program object. + * + * \param prog Shading language program to which shaders will be attached + * \param shader First shader to be attached to the program + */ +extern void gluAttachShaders(GLuint prog, GLuint shader, ...); + +/** + * Bind a set of shader program attributes to locations + * + * Bind the locations of a set of attributes. The list of attributes is + * terminate by a \c NULL \c name pointer. + * + * \param prog Shading language program whose attribute locations will + * be set + * \param name Name of the first attribute to set + * \param location Location of the first attribute + */ +extern void gluBindAttributes(GLuint prog, const char *name, unsigned location, + ...); + +/** + * Release an info log + * + * Release an info log generated by a call to \c gluLinkProgram or + * \c gluCompileShader. + * + * \param log Info log buffer to be released + * + * \sa gluCompileShader, gluLinkProgram + */ +extern void gluReleaseInfoLog(char *log); +/*@}*/ +#if defined(__cplusplus) +}; +#endif + +#include "glu3_scalar.h" + +#endif /* __glu3_h__ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3_scalar.h b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3_scalar.h new file mode 100644 index 000000000..d4fc03422 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/inc/GLU3/glu3_scalar.h @@ -0,0 +1,396 @@ +/* + * Copyright © 2009 Ian D. Romanick + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#ifdef _MSC_VER +# define INLINE __forceinline +#elif defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__) +# define INLINE inline __attribute__((gnu_inline)) +#else +# define INLINE inline +#endif + +extern INLINE void gluMult4v_4v(GLUvec4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + result->values[0] = v1->values[0] * v2->values[0]; + result->values[1] = v1->values[1] * v2->values[1]; + result->values[2] = v1->values[2] * v2->values[2]; + result->values[3] = v1->values[3] * v2->values[3]; +} + + +extern INLINE void gluDiv4v_4v(GLUvec4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + result->values[0] = v1->values[0] / v2->values[0]; + result->values[1] = v1->values[1] / v2->values[1]; + result->values[2] = v1->values[2] / v2->values[2]; + result->values[3] = v1->values[3] / v2->values[3]; +} + + +extern INLINE void gluAdd4v_4v(GLUvec4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + result->values[0] = v1->values[0] + v2->values[0]; + result->values[1] = v1->values[1] + v2->values[1]; + result->values[2] = v1->values[2] + v2->values[2]; + result->values[3] = v1->values[3] + v2->values[3]; +} + + +extern INLINE void gluSub4v_4v(GLUvec4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + result->values[0] = v1->values[0] - v2->values[0]; + result->values[1] = v1->values[1] - v2->values[1]; + result->values[2] = v1->values[2] - v2->values[2]; + result->values[3] = v1->values[3] - v2->values[3]; +} + + +extern INLINE void gluMult4v_f(GLUvec4 *result, + const GLUvec4 *v1, GLfloat f) +{ + result->values[0] = v1->values[0] * f; + result->values[1] = v1->values[1] * f; + result->values[2] = v1->values[2] * f; + result->values[3] = v1->values[3] * f; +} + + +extern INLINE void gluDiv4v_f(GLUvec4 *result, + const GLUvec4 *v1, GLfloat f) +{ + result->values[0] = v1->values[0] / f; + result->values[1] = v1->values[1] / f; + result->values[2] = v1->values[2] / f; + result->values[3] = v1->values[3] / f; +} + + +extern INLINE void gluAdd4v_f(GLUvec4 *result, + const GLUvec4 *v1, GLfloat f) +{ + result->values[0] = v1->values[0] + f; + result->values[1] = v1->values[1] + f; + result->values[2] = v1->values[2] + f; + result->values[3] = v1->values[3] + f; +} + + +extern INLINE void gluSub4v_f(GLUvec4 *result, + const GLUvec4 *v1, GLfloat f) +{ + result->values[0] = v1->values[0] - f; + result->values[1] = v1->values[1] - f; + result->values[2] = v1->values[2] - f; + result->values[3] = v1->values[3] - f; +} + + +extern INLINE void gluMult4m_f(GLUmat4 *result, + const GLUmat4 *m, GLfloat f) +{ + GLUmat4 temp; + + gluMult4v_f(& temp.col[0], & m->col[0], f); + gluMult4v_f(& temp.col[1], & m->col[1], f); + gluMult4v_f(& temp.col[2], & m->col[2], f); + gluMult4v_f(& temp.col[3], & m->col[3], f); + *result = temp; +} + + +extern INLINE void gluMult4m_4v(GLUvec4 *result, + const GLUmat4 *m, const GLUvec4 *v) +{ + GLUvec4 temp[6]; + unsigned i; + + for (i = 0; i < 4; i++) { + gluMult4v_f(& temp[i], & m->col[i], v->values[i]); + } + + gluAdd4v_4v(& temp[4], & temp[0], & temp[1]); + gluAdd4v_4v(& temp[5], & temp[2], & temp[3]); + gluAdd4v_4v(result, & temp[4], & temp[5]); +} + + +extern INLINE void gluAdd4m_4m(GLUmat4 *result, + const GLUmat4 *m1, const GLUmat4 *m2) +{ + GLUmat4 temp; + + gluAdd4v_4v(& temp.col[0], & m1->col[0], & m2->col[0]); + gluAdd4v_4v(& temp.col[1], & m1->col[1], & m2->col[1]); + gluAdd4v_4v(& temp.col[2], & m1->col[2], & m2->col[2]); + gluAdd4v_4v(& temp.col[3], & m1->col[3], & m2->col[3]); + *result = temp; +} + +extern INLINE void gluSub4m_4m(GLUmat4 *result, + const GLUmat4 *m1, const GLUmat4 *m2) +{ + GLUmat4 temp; + + gluSub4v_4v(& temp.col[0], & m1->col[0], & m2->col[0]); + gluSub4v_4v(& temp.col[1], & m1->col[1], & m2->col[1]); + gluSub4v_4v(& temp.col[2], & m1->col[2], & m2->col[2]); + gluSub4v_4v(& temp.col[3], & m1->col[3], & m2->col[3]); + *result = temp; +} + +extern INLINE GLfloat gluDot4_4v(const GLUvec4 *v1, const GLUvec4 *v2) +{ + return v1->values[0] * v2->values[0] + + v1->values[1] * v2->values[1] + + v1->values[2] * v2->values[2] + + v1->values[3] * v2->values[3]; +} + + +extern INLINE GLfloat gluDot3_4v(const GLUvec4 *v1, const GLUvec4 *v2) +{ + return v1->values[0] * v2->values[0] + + v1->values[1] * v2->values[1] + + v1->values[2] * v2->values[2]; +} + + +extern INLINE GLfloat gluDot2_4v(const GLUvec4 *v1, const GLUvec4 *v2) +{ + return v1->values[0] * v2->values[0] + + v1->values[1] * v2->values[1]; +} + + +extern INLINE void gluCross4v(GLUvec4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + GLUvec4 temp; + + temp.values[0] = (v1->values[1] * v2->values[2]) + - (v1->values[2] * v2->values[1]); + temp.values[1] = (v1->values[2] * v2->values[0]) + - (v1->values[0] * v2->values[2]); + temp.values[2] = (v1->values[0] * v2->values[1]) + - (v1->values[1] * v2->values[0]); + temp.values[3] = 0.0; + *result = temp; +} + + +extern INLINE void gluOuter4v(GLUmat4 *result, + const GLUvec4 *v1, const GLUvec4 *v2) +{ + GLUmat4 temp; + + gluMult4v_f(& temp.col[0], v1, v2->values[0]); + gluMult4v_f(& temp.col[1], v1, v2->values[1]); + gluMult4v_f(& temp.col[2], v1, v2->values[2]); + gluMult4v_f(& temp.col[3], v1, v2->values[3]); + *result = temp; +} + + +extern INLINE GLfloat gluLengthSqr4v(const GLUvec4 *v) +{ + return gluDot4_4v(v, v); +} + + +extern INLINE GLfloat gluLength4v(const GLUvec4 *v) +{ + return (GLfloat) sqrt(gluLengthSqr4v(v)); +} + + +extern INLINE void gluNormalize4v(GLUvec4 *result, const GLUvec4 *v) +{ + gluDiv4v_f(result, v, gluLength4v(v)); +} + + + +extern INLINE void gluTranspose4m(GLUmat4 *result, const GLUmat4 *m) +{ + unsigned i; + unsigned j; + GLUmat4 temp; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + temp.col[i].values[j] = m->col[j].values[i]; + } + } + + *result = temp; +} + + +extern INLINE void gluMult4m_4m(GLUmat4 *result, + const GLUmat4 *m1, const GLUmat4 *m2) +{ + GLUmat4 temp; + unsigned i; + + for (i = 0; i < 4; i++) { + gluMult4m_4v(& temp.col[i], m1, & m2->col[i]); + } + + *result = temp; +} + + + +extern INLINE void gluTranslate3f(GLUmat4 *result, + GLfloat x, GLfloat y, GLfloat z) +{ + memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); + result->col[3].values[0] = x; + result->col[3].values[1] = y; + result->col[3].values[2] = z; +} + + +#ifdef __cplusplus +extern INLINE GLfloat gluDot4(const GLUvec4 &v1, const GLUvec4 &v2) +{ + return v1.values[0] * v2.values[0] + + v1.values[1] * v2.values[1] + + v1.values[2] * v2.values[2] + + v1.values[3] * v2.values[3]; +} + + +extern INLINE GLfloat gluDot3(const GLUvec4 &v1, const GLUvec4 &v2) +{ + return v1.values[0] * v2.values[0] + + v1.values[1] * v2.values[1] + + v1.values[2] * v2.values[2]; +} + + +extern INLINE GLfloat gluDot2(const GLUvec4 &v1, const GLUvec4 &v2) +{ + return v1.values[0] * v2.values[0] + + v1.values[1] * v2.values[1]; +} + + +INLINE GLUvec4 GLUvec4::operator+(const GLUvec4 &v) const +{ + return GLUvec4(values[0] + v.values[0], + values[1] + v.values[1], + values[2] + v.values[2], + values[3] + v.values[3]); +} + + +INLINE GLUvec4 GLUvec4::operator-(const GLUvec4 &v) const +{ + return GLUvec4(values[0] - v.values[0], + values[1] - v.values[1], + values[2] - v.values[2], + values[3] - v.values[3]); +} + + +INLINE GLUvec4 GLUvec4::operator*(const GLUvec4 &v) const +{ + return GLUvec4(values[0] * v.values[0], + values[1] * v.values[1], + values[2] * v.values[2], + values[3] * v.values[3]); +} + + +INLINE GLUvec4 GLUvec4::operator*(GLfloat f) const +{ + return GLUvec4(values[0] * f, + values[1] * f, + values[2] * f, + values[3] * f); +} + + +INLINE GLUvec4 GLUvec4::operator*(const GLUmat4 &m) const +{ + return GLUvec4(gluDot4(*this, m.col[0]), + gluDot4(*this, m.col[1]), + gluDot4(*this, m.col[2]), + gluDot4(*this, m.col[3])); +} + + +INLINE GLUmat4 GLUmat4::operator+(const GLUmat4 &m) const +{ + GLUmat4 temp; + + gluAdd4m_4m(& temp, this, &m); + return temp; +} + + +INLINE GLUmat4 GLUmat4::operator-(const GLUmat4 &m) const +{ + return GLUmat4(col[0] - m.col[0], + col[1] - m.col[1], + col[2] - m.col[2], + col[3] - m.col[3]); +} + + +INLINE GLUmat4 GLUmat4::operator*(GLfloat f) const +{ + GLUmat4 temp; + + gluMult4m_f(& temp, this, f); + return temp; +} + + +INLINE GLUvec4 GLUmat4::operator*(const GLUvec4 &v) const +{ + return (col[0] * v.values[0]) + + (col[1] * v.values[1]) + + (col[2] * v.values[2]) + + (col[3] * v.values[3]); +} + + +INLINE GLUmat4 GLUmat4::operator*(const GLUmat4 &m) const +{ + GLUmat4 temp; + + gluMult4m_4m(& temp, this, &m); + return temp; +} + + +#endif /* __cplusplus */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fsl_egl.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fsl_egl.c new file mode 100644 index 000000000..f8ac3d7db --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fsl_egl.c @@ -0,0 +1,475 @@ +/**************************************************************************** +* Copyright (c) 2012 Freescale Semiconductor, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* * Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* * Neither the name of the Freescale Semiconductor, Inc. nor the names of +* its contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Labels parameters + +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#ifdef EGL_USE_X11 +#include +#include +#elif EGL_API_WL +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct geometry { + int width; + int height; +}; + +struct display; + +struct window { + struct display *display; + struct wl_egl_window *native; + struct geometry geometry, window_size; + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + EGLSurface egl_surface; + struct wl_callback *callback; + int fullscreen, configured, opaque; +}; + +struct display { + struct wl_display *display; + struct wl_registry *registry; + struct wl_compositor *compositor; + struct wl_shell *shell; + struct wl_seat *seat; + struct wl_pointer *pointer; + struct wl_keyboard *keyboard; + struct wl_shm *shm; + struct wl_cursor_theme *cursor_theme; + struct wl_cursor *default_cursor; + struct wl_surface *cursor_surface; + struct window *window; +}; + +struct display sdisplay = { 0 }; +struct window swindow = { 0 }; + +static void +create_wl_surface(VOID_ARGUMENT) +{ + struct display * display = &sdisplay; + struct window * window = &swindow; + + window->surface = wl_compositor_create_surface(display->compositor); + window->shell_surface = wl_shell_get_shell_surface(display->shell, + window->surface); + + window->native = + wl_egl_window_create(window->surface, + window->window_size.width, + window->window_size.height); + + wl_shell_surface_set_title(window->shell_surface, "3DMark for GLES2.0"); + + wl_shell_surface_set_fullscreen(window->shell_surface, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, NULL); +} + +static void +configure_callback(void *data, struct wl_callback *callback, uint32_t time) +{ + struct window *window = (struct window *)data; + + wl_callback_destroy(callback); + + window->configured = 1; +} + +static struct wl_callback_listener configure_callback_listener = { + configure_callback, +}; + +static void +handle_ping(void *data, struct wl_shell_surface *shell_surface, + uint32_t serial) +{ + wl_shell_surface_pong(shell_surface, serial); +} + +static void +handle_configure(void *data, struct wl_shell_surface *shell_surface, + uint32_t edges, int32_t width, int32_t height) +{ + struct window *window = (struct window *)data; + + if (window->native) + wl_egl_window_resize(window->native, width, height, 0, 0); + + window->geometry.width = width; + window->geometry.height = height; + + if (!window->fullscreen) + window->window_size = window->geometry; +} + +static void +handle_popup_done(void *data, struct wl_shell_surface *shell_surface) +{ +} + +static const struct wl_shell_surface_listener shell_surface_listener = { + handle_ping, + handle_configure, + handle_popup_done +}; + + +static void +toggle_fullscreen(struct window *window, int fullscreen) +{ + struct wl_callback *callback; + + window->fullscreen = fullscreen; + window->configured = 0; + + if (fullscreen) { + wl_shell_surface_set_fullscreen(window->shell_surface, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, NULL); + } else { + wl_shell_surface_set_toplevel(window->shell_surface); + handle_configure(window, window->shell_surface, 0, + window->window_size.width, + window->window_size.height); + } + + callback = wl_display_sync(window->display->display); + wl_callback_add_listener(callback, &configure_callback_listener, + window); +} + + +static void +pointer_handle_enter(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) +{ + struct display *display = (struct display *)data; + struct wl_buffer *buffer; + struct wl_cursor *cursor = display->default_cursor; + struct wl_cursor_image *image; + + if (display->window->fullscreen) + wl_pointer_set_cursor(pointer, serial, NULL, 0, 0); + else if (cursor) { + image = display->default_cursor->images[0]; + buffer = wl_cursor_image_get_buffer(image); + wl_pointer_set_cursor(pointer, serial, + display->cursor_surface, + image->hotspot_x, + image->hotspot_y); + wl_surface_attach(display->cursor_surface, buffer, 0, 0); + wl_surface_damage(display->cursor_surface, 0, 0, + image->width, image->height); + wl_surface_commit(display->cursor_surface); + } +} + +static void +pointer_handle_leave(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface) +{ +} + +static void +pointer_handle_motion(void *data, struct wl_pointer *pointer, + uint32_t time, wl_fixed_t sx, wl_fixed_t sy) +{ +} + +static void +pointer_handle_button(void *data, struct wl_pointer *wl_pointer, + uint32_t serial, uint32_t time, uint32_t button, + uint32_t state) +{ + struct display *display = (struct display *)data; + + if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) + wl_shell_surface_move(display->window->shell_surface, + display->seat, serial); +} + +static void +pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + +static const struct wl_pointer_listener pointer_listener = { + pointer_handle_enter, + pointer_handle_leave, + pointer_handle_motion, + pointer_handle_button, + pointer_handle_axis, +}; + +static void +keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, + uint32_t format, int fd, uint32_t size) +{ +} + +static void +keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface, + struct wl_array *keys) +{ +} + +static void +keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface) +{ +} + +static void +keyboard_handle_key(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t time, uint32_t key, + uint32_t state) +{ + struct display *d = (struct display *)data; + + if (key == KEY_F11 && state) + toggle_fullscreen(d->window, d->window->fullscreen ^ 1); +} + +static void +keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t mods_depressed, + uint32_t mods_latched, uint32_t mods_locked, + uint32_t group) +{ +} + +static const struct wl_keyboard_listener keyboard_listener = { + keyboard_handle_keymap, + keyboard_handle_enter, + keyboard_handle_leave, + keyboard_handle_key, + keyboard_handle_modifiers, +}; + + +static void +seat_handle_capabilities(void *data, struct wl_seat *seat, + uint32_t caps) +{ + struct display *d = (struct display *)data; + + if ((caps & WL_SEAT_CAPABILITY_POINTER) && !d->pointer) { + d->pointer = wl_seat_get_pointer(seat); + wl_pointer_add_listener(d->pointer, &pointer_listener, d); + } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && d->pointer) { + wl_pointer_destroy(d->pointer); + d->pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !d->keyboard) { + d->keyboard = wl_seat_get_keyboard(seat); + wl_keyboard_add_listener(d->keyboard, &keyboard_listener, d); + } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && d->keyboard) { + wl_keyboard_destroy(d->keyboard); + d->keyboard = NULL; + } +} + +static const struct wl_seat_listener seat_listener = { + seat_handle_capabilities, +}; + + +static void +registry_handle_global(void *data, struct wl_registry *registry, + uint32_t name, const char *interface, uint32_t version) +{ + struct display *d = (struct display *)data; + + if (strcmp(interface, "wl_compositor") == 0) { + d->compositor = + (struct wl_compositor*)wl_registry_bind(registry, name,&wl_compositor_interface, 1); + } else if (strcmp(interface, "wl_shell") == 0) { + d->shell = (struct wl_shell *)wl_registry_bind(registry, name, + &wl_shell_interface, 1); + } else if (strcmp(interface, "wl_seat") == 0) { + d->seat = (struct wl_seat *)wl_registry_bind(registry, name, + &wl_seat_interface, 1); + wl_seat_add_listener(d->seat, &seat_listener, d); + } else if (strcmp(interface, "wl_shm") == 0) { + d->shm = (struct wl_shm *)wl_registry_bind(registry, name, + &wl_shm_interface, 1); + d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm); + d->default_cursor = + wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr"); + } +} + +static const struct wl_registry_listener registry_listener = { + registry_handle_global +}; +#endif + +EGLNativeDisplayType fsl_getNativeDisplay() +{ + EGLNativeDisplayType eglNativeDisplayType = NULL; +#if (defined EGL_USE_X11) + eglNativeDisplayType = XOpenDisplay(NULL); + assert(eglNativeDisplayType != NULL); +#elif EGL_API_WL + sdisplay.display = wl_display_connect(NULL); + sdisplay.registry = wl_display_get_registry(sdisplay.display); + wl_registry_add_listener(sdisplay.registry, + ®istry_listener, &sdisplay); + wl_display_dispatch(sdisplay.display); + + return sdisplay.display; +#elif (defined EGL_API_FB) + eglNativeDisplayType = fbGetDisplayByIndex(0); //Pass the argument as required to show the framebuffer +#else + display = EGL_DEFAULT_DISPLAY; +#endif + return eglNativeDisplayType; +} + +EGLNativeWindowType fsl_createwindow(EGLDisplay egldisplay, EGLNativeDisplayType eglNativeDisplayType) +{ + EGLNativeWindowType native_window = (EGLNativeWindowType)0; + +#if (defined EGL_USE_X11) + Window window, rootwindow; + int screen = DefaultScreen(eglNativeDisplayType); + rootwindow = RootWindow(eglNativeDisplayType,screen); + window = XCreateSimpleWindow(eglNativeDisplayType, rootwindow, 0, 0, 400, 533, 0, 0, WhitePixel (eglNativeDisplayType, screen)); + XMapWindow(eglNativeDisplayType, window); + native_window = window; +#elif EGL_API_WL + swindow.window_size.width = 800; + swindow.window_size.height = 480; + + swindow.display = &sdisplay; + sdisplay.window = &swindow; + + sdisplay.registry = wl_display_get_registry(sdisplay.display); + wl_registry_add_listener(sdisplay.registry, + ®istry_listener, &sdisplay); + wl_display_dispatch(sdisplay.display); + create_wl_surface(); + + native_window = swindow.native; + + sdisplay.cursor_surface = + wl_compositor_create_surface(sdisplay.compositor); + +#else + const char *vendor = eglQueryString(egldisplay, EGL_VENDOR); + if (strstr(vendor, "Imagination Technologies")) + native_window = (EGLNativeWindowType)0; + else if (strstr(vendor, "AMD")) + native_window = (EGLNativeWindowType) open("/dev/fb0", O_RDWR); + else if (strstr(vendor, "Vivante")) //NEEDS FIX - functs don't exist on other platforms + { +#if (defined EGL_API_FB) + native_window = fbCreateWindow(eglNativeDisplayType, 0, 0, 0, 0); +#endif + } + else + { + printf("Unknown vendor [%s]\n", vendor); + return 0; + } +#endif + return native_window; + +} + + +void fsl_destroywindow(EGLNativeWindowType eglNativeWindowType, EGLNativeDisplayType eglNativeDisplayType) +{ + (void) eglNativeWindowType; +#if (defined EGL_USE_X11) + //close x display + XCloseDisplay(eglNativeDisplayType); +#elif EGL_API_WL + struct display * display = &sdisplay; + struct window * window = &swindow; + + if(eglNativeWindowType) + { + wl_egl_window_destroy(window->native); + wl_shell_surface_destroy(window->shell_surface); + wl_surface_destroy(window->surface); + if (window->callback) + wl_callback_destroy(window->callback); + } + + wl_surface_destroy(display->cursor_surface); + + if (display->cursor_theme) + wl_cursor_theme_destroy(display->cursor_theme); + + if (display->shell) + wl_shell_destroy(display->shell); + + if (display->compositor) + wl_compositor_destroy(display->compositor); + + wl_display_flush(display->display); + wl_display_disconnect(display->display); + +#endif +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fslutil.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fslutil.c new file mode 100644 index 000000000..c98508d2a --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/fslutil.c @@ -0,0 +1,935 @@ +/**************************************************************************** +* Copyright (c) 2012 Freescale Semiconductor, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* * Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* * Neither the name of the Freescale Semiconductor, Inc. nor the names of +* its contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Labels parameters + +*****************************************************************************/ + +#define GL_FUNCS 1 + + +#include +#include + +#include +#include +#include + +int LoadBMP(char *filename, Image *image) +{ + FILE *file; + unsigned long size; // size of the image in bytes. + unsigned long i; // standard counter. + unsigned short int planes; // number of planes in image (must be 1) + unsigned short int bpp; // number of bits per pixel (must be 24) + char temp; // temporary color storage for bgr-rgb conversion. + + // make sure the file is there. + if ((file = fopen(filename, "rb"))==NULL) + { + printf("File Not Found : %s\n",filename); + return 0; + } + + // seek through the bmp header, up to the width/height: + fseek(file, 18, SEEK_CUR); + + // read the width + if ((i = fread(&image->sizeX, 4, 1, file)) != 1) + { + printf("Error reading width from %s.\n", filename); + return 0; + } + + + // read the height + if ((i = fread(&image->sizeY, 4, 1, file)) != 1) + { + printf("Error reading height from %s.\n", filename); + return 0; + } + + // calculate the size (assuming 24 bits or 3 bytes per pixel). + size = image->sizeX * image->sizeY * 3; + //printf("size is %lu\n",size); + + // read the planes + if ((fread(&planes, 2, 1, file)) != 1) + { + printf("Error reading planes from %s.\n", filename); + return 0; + } + if (planes != 1) + { + printf("Planes from %s is not 1: %u\n", filename, planes); + return 0; + } + + // read the bpp + if ((i = fread(&bpp, 2, 1, file)) != 1) + { + printf("Error reading bpp from %s.\n", filename); + return 0; + } + if (bpp != 24) + { + printf("Bpp from %s is not 24: %u\n", filename, bpp); + return 0; + } + + // seek past the rest of the bitmap header. + fseek(file, 24, SEEK_CUR); + + // read the data. + image->data = (char *) malloc(size); + if (image->data == NULL) + { + printf("Error allocating memory for color-corrected image data"); + return 0; + } + + if ((i = fread(image->data, size, 1, file)) != 1) + { + printf("Error reading image data from %s.\n", filename); + return 0; + } + + for (i=0;i rgb) + temp = image->data[i]; + image->data[i] = image->data[i+2]; + image->data[i+2] = temp; + } + + + // we're done. + return 1; +} + + +int LoadTGA(const char *textureFileName, Image *image) +{ + FILE *f = fopen(textureFileName, "rb"); +#ifdef UNDER_CE + if (f == NULL) + { + wchar_t moduleName[MAX_PATH]; + char path[MAX_PATH], * p; + GetModuleFileName(NULL, moduleName, MAX_PATH); + wcstombs(path, moduleName, MAX_PATH); + p = strrchr(path, '\\'); + strcpy(p + 1, textureFileName); + f = fopen(path, "rb"); + } +#endif + if(!f) return 0; + + unsigned short width, height; + unsigned char widthLow, widthHigh, heightLow, heightHigh; + unsigned char headerLength = 0; + unsigned char imageType = 0; + unsigned char bits = 0; + int format= 0; + int lineWidth = 0; + + fread(&headerLength, sizeof(unsigned char), 1, f); + fseek(f,1,SEEK_CUR); + fread(&imageType, sizeof(unsigned char), 1, f); + fseek(f, 9, SEEK_CUR); + fread(&widthLow, sizeof(unsigned char), 1, f); + fread(&widthHigh, sizeof(unsigned char), 1, f); + width = (widthHigh << 16) + widthLow; + fread(&heightLow, sizeof(unsigned char), 1, f); + fread(&heightHigh, sizeof(unsigned char), 1, f); + height = (heightHigh << 16) + heightLow; + fread(&bits, sizeof(unsigned char), 1, f); + + image->sizeX = width; + image->sizeY = height; + + printf("width=%d height=%d\n", width, height); + + /* Check pixel depth. */ + switch (bits) + { + case 16: + /* 16-bpp RGB. */ + image->Format = GL_UNSIGNED_SHORT_5_6_5; + break; + + case 24: + /* 24-bpp RGB. */ + image->Format = GL_RGB; + break; + + case 32: + /* 32-bpp RGB. */ + image->Format = GL_RGBA; + break; + + default: + /* Invalid pixel depth. */ + return 0; + } + fseek(f, headerLength + 1, SEEK_CUR); + char *buffer = NULL; + if(imageType != 10) + { + int y; + int i; + printf("bits=%d\n", bits); + if((bits == 24)||(bits == 32)) //added to support for LUMINANCE and RGBA textures + { + format = bits >> 3; + lineWidth = format * width; + buffer = malloc( (bits / 8) * lineWidth * height); + + for(y = 0; y < height; y++) + { + GLubyte *line = &buffer[lineWidth * y]; + fread(line, lineWidth, 1, f); + + if(format!= 1) + { + for(i=0;idata = buffer; + return 0; + } + } + fclose(f); + + image->data = buffer; + + return 1; +} + +//-------------------------------------------------------------------------------------- +// Name: fslLoadCTES +// Desc: Helper function to load an compressed image file (ATC, ETC, etc.) from the compressenator +// At exit nFormat contains the GL +//-------------------------------------------------------------------------------------- +char* fslLoadCTES( char* strFileName, unsigned int* pWidth, unsigned int* pHeight, + unsigned int* nFormat, unsigned int* nSize ) +{ + unsigned int nTotalBlocks, nBytesPerBlock, nHasAlpha; + char* pBits8; + + struct CTES_HEADER + { + unsigned int signature; + unsigned int width; + unsigned int height; + unsigned int flags; + unsigned int dataOffset; // From start of header/file + } header; + + // Read the file + FILE* file = fopen( strFileName, "rb" ); + if( NULL == file ) + { + printf("Error loading file: %s \n",strFileName); + return NULL; + } + + + if (fread( &header, sizeof(header), 1, file ) != 1) + { + printf("Error loading file : %s \n",strFileName); + fclose( file ); + return NULL; + } + + nTotalBlocks = ((header.width + 3) >> 2) * ((header.height + 3) >> 2); + nHasAlpha = header.flags & ATC_RGBA; + nBytesPerBlock = (nHasAlpha) ? 16 : 8; + + (*nSize) = nTotalBlocks * nBytesPerBlock; + (*pWidth) = header.width; + (*pHeight) = header.height; + + switch (header.signature) + { + case ATC_SIGNATURE: + if(nHasAlpha && (header.flags & ATC_ALPHA_INTERPOLATED)) + (*nFormat) = GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD; + else if(nHasAlpha) + (*nFormat) = GL_ATC_RGBA_EXPLICIT_ALPHA_AMD; + else + (*nFormat) = GL_ATC_RGB_AMD; + break; + case ATI1N_SIGNATURE: + (*nFormat) = GL_3DC_X_AMD; + break; + case ATI2N_SIGNATURE: + (*nFormat) = GL_3DC_XY_AMD; + break; + case ETC_SIGNATURE: + if(nHasAlpha) + { + printf("Unsupported texture format\n"); + return NULL; + } + (*nFormat) = GL_ETC1_RGB8_OES; + break; + + default: + printf("Unsupported texture format\n"); + return NULL; + break; + } + pBits8 = (char*)malloc(sizeof(char) * (*nSize)); + + // Read the encoded image + fseek(file, header.dataOffset, SEEK_SET); + if (fread(pBits8, *nSize, 1, file) != 1) { + printf("Error loading file : %s \n",strFileName); + fclose( file ); + free( pBits8 ); + return NULL; + } + + fclose( file ); + + return pBits8; +} + +fslBool fslUnProject(float winx,float winy, float winz, float modelMatrix[16], float projMatrix[16], int viewport[4], float *objx, float *objy, float *objz) +{ + float finalMatrix[16]; + float finalMatrixTmp[16]; + float in[4]; + float out[4]; + + fslMultMatrix4x4(finalMatrixTmp,modelMatrix,projMatrix); + + if(!fslInvertMatrix4x4( finalMatrixTmp, finalMatrix)) + { + printf("error inverting matrix \n"); + return FSL_FALSE; + } + + in[0]=winx; + in[1]=winy; + in[2]=winz; + in[3]=1.0; + //map x and y from coordinates + in[0]=(in[0]-viewport[0])/ viewport[2]; + in[1]=(in[1]-viewport[1])/ viewport[3]; + + //map range to -1 to 1 + in[0]= in[0]*2-1; + in[1]= in[1]*2-1; + in[2]= in[2]*2-1; + //printf("in: %f %f %f \n",in[0],in[1],in[2]); + fslMultMatrix4x4Vec4x1 ( finalMatrix, in, out ); + + + if(out[3]== 0.0) + return FSL_FALSE; + + + out[0] /=out[3]; + out[1] /=out[3]; + out[2] /=out[3]; + + + *objx = out[0]; + *objy = out[1]; + *objz = out[2]; + + return FSL_TRUE; + + +} + + +//-------------------------------------------------------------------------------------- +// Name: fslEGLCheck +// Desc: Helper function to print EGL errors and exits application +//-------------------------------------------------------------------------------------- +fslBool fslEGLCheck( fslBool bExitOnFailure) +{ + EGLint eglerr = eglGetError(); + + if(eglerr != EGL_SUCCESS) + { + switch(eglerr){ + case EGL_NOT_INITIALIZED: + fprintf(stdout, "EGL Fail = EGL_NOT_INITIALIZED (0x%x) \n", eglerr); + break; + case EGL_BAD_ACCESS: + fprintf(stdout, "EGL Fail = EGL_BAD_ACCESS (0x%x) \n", eglerr); + break; + case EGL_BAD_ALLOC: + fprintf(stdout, "EGL Fail = EGL_BAD_ALLOC (0x%x) \n", eglerr); + break; + case EGL_BAD_ATTRIBUTE: + fprintf(stdout, "EGL Fail = EGL_BAD_ATTRIBUTE(0x%x) \n", eglerr); + break; + case EGL_BAD_CONFIG: + fprintf(stdout, "EGL Fail = EGL_BAD_CONFIG (0x%x) \n", eglerr); + break; + case EGL_BAD_CONTEXT: + fprintf(stdout, "EGL Fail = EGL_BAD_CONTEXT (0x%x) \n", eglerr); + break; + case EGL_BAD_CURRENT_SURFACE: + fprintf(stdout, "EGL Fail = EGL_BAD_CURRENT_SURFACE (0x%x) \n", eglerr); + break; + case EGL_BAD_DISPLAY: + fprintf(stdout, "EGL Fail = EGL_BAD_DISPLAY (0x%x) \n", eglerr); + break; + case EGL_BAD_MATCH: + fprintf(stdout, "EGL Fail = EGL_BAD_MATCH (0x%x) \n", eglerr); + break; + case EGL_BAD_NATIVE_PIXMAP: + fprintf(stdout, "EGL Fail = EGL_BAD_NATIVE_PIXMAP (0x%x) \n", eglerr); + break; + case EGL_BAD_NATIVE_WINDOW: + fprintf(stdout, "EGL Fail = EGL_BAD_NATIVE_WINDOW (0x%x) \n", eglerr); + break; + case EGL_BAD_PARAMETER: + fprintf(stdout, "EGL Fail = EGL_BAD_PARAMETER (0x%x) \n", eglerr); + break; + case EGL_BAD_SURFACE: + fprintf(stdout, "EGL Fail = EGL_BAD_SURFACE (0x%x) \n", eglerr); + break; + case EGL_CONTEXT_LOST: + fprintf(stdout, "EGL Fail = EGL_CONTEXT_LOST (0x%x) \n", eglerr); + break; + default: + fprintf(stdout, "EGL Fail = 0x%x \n", eglerr); + } + + if (bExitOnFailure) + exit(EXIT_FAILURE); + else + return FSL_FALSE; + } + + return FSL_TRUE; +} + +#ifdef GL_FUNCS +fslBool fslInit2DBMPTextureGL(char* strFileName, GLuint *pTextureHandle){ + + Image *image1; + + // allocate space for texture we will use + image1 = (Image *) malloc(sizeof(Image)); + if (image1 == NULL) { + printf("Error allocating space for image"); + exit(0); + } + + if (!LoadBMP(strFileName, image1)) { + exit(1); + } + + glGenTextures( 1, pTextureHandle ); + glBindTexture( GL_TEXTURE_2D, *pTextureHandle ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,image1->sizeX,image1->sizeY,0,GL_RGB,GL_UNSIGNED_BYTE,image1->data); + free(image1); + return FSL_TRUE; + +} + + +fslBool fslInit2DTGATextureGL(char* strFileName, unsigned int *pTextureHandle){ + + Image *image1; + + // allocate space for texture we will use + image1 = (Image *) malloc(sizeof(Image)); + if (image1 == NULL) { + printf("Error allocating space for image"); + exit(0); + } + + if (!LoadTGA(strFileName, image1)) { + printf("Error loading TGA\n"); + exit(1); + } + + glGenTextures( 1, pTextureHandle ); + glBindTexture( GL_TEXTURE_2D, *pTextureHandle ); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + /* Set unpack alignment. */ + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D,0 , image1->Format, image1->sizeX,image1->sizeY,0,image1->Format,GL_UNSIGNED_BYTE,image1->data); + free(image1->data); + free(image1); + return FSL_TRUE; + +} + +//-------------------------------------------------------------------------------------- +// Name: fslInit2DCTESTextureGL +// Desc: Helper function to load a CTES texture file and bind it to a given GL texture handle +//-------------------------------------------------------------------------------------- +fslBool fslInit2DCTESTextureGL( char* strFileName, GLuint *pTextureHandle ) +{ + unsigned int nWidth, nHeight, nFormat, nSize; + char* pImageData = fslLoadCTES( strFileName, &nWidth, &nHeight, &nFormat, &nSize ); + + if( NULL == pImageData ) + { + printf("Error loading texture! \n"); + return FSL_FALSE; + } + else + { + printf("Texture [%s] succesully read (%d x %d , %d) \n",strFileName,nWidth,nHeight,nSize); + } + + glGenTextures( 1, pTextureHandle ); + glBindTexture( GL_TEXTURE_2D, *pTextureHandle ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glCompressedTexImage2D( GL_TEXTURE_2D, 0, nFormat, nWidth, nHeight, 0, nSize, pImageData ); + free(pImageData); + + return FSL_TRUE; +} +#endif + +#ifdef FSL_EGL_USE_X11 +//-------------------------------------------------------------------------------------- +// Name: fslLoadFontX +// Desc: Helper function to load a X11 font into given struct +//-------------------------------------------------------------------------------------- +void fslLoadFontX(Display *display, XFontStruct **font_info) +{ + char *fontname = "9x15"; + + if ((*font_info=XLoadQueryFont(display,fontname)) == NULL) + { + printf("stderr, basicwin: cannot open 9x15 font\n"); + exit(EXIT_FAILURE); + } +} + +//-------------------------------------------------------------------------------------- +// Name: fslErrorHandlerX +// Desc: Helper function to print incoming X11 server errors +//-------------------------------------------------------------------------------------- +int fslErrorHandlerX( Display *display, XErrorEvent *error ) +{ + char errorText[1024]; + XGetErrorText( display, error->error_code, errorText, sizeof(errorText) ); + printf( "\t --- X Error: %s ---\n", errorText ); + return 0; +} +#endif + +//-------------------------------------------------------------------------------------- +// Name: fslGetTickCount +// Desc: Helper function to get current time +//-------------------------------------------------------------------------------------- +unsigned int fslGetTickCount() +{ + struct timeval tv; + if(gettimeofday(&tv, NULL) != 0) + { + return 0; + } + + return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); +} + +//-------------------------------------------------------------------------------------- +// Name: fslMulMatrix4x4 +// Desc: 4x4 Matix Muliply +//-------------------------------------------------------------------------------------- +void fslMultMatrix4x4( float *matC, float *matA, float *matB) +{ + matC[ 0] = matA[ 0] * matB[ 0] + matA[ 1] * matB[ 4] + matA[ 2] * matB[ 8] + matA[ 3] * matB[12]; + matC[ 1] = matA[ 0] * matB[ 1] + matA[ 1] * matB[ 5] + matA[ 2] * matB[ 9] + matA[ 3] * matB[13]; + matC[ 2] = matA[ 0] * matB[ 2] + matA[ 1] * matB[ 6] + matA[ 2] * matB[10] + matA[ 3] * matB[14]; + matC[ 3] = matA[ 0] * matB[ 3] + matA[ 1] * matB[ 7] + matA[ 2] * matB[11] + matA[ 3] * matB[15]; + matC[ 4] = matA[ 4] * matB[ 0] + matA[ 5] * matB[ 4] + matA[ 6] * matB[ 8] + matA[ 7] * matB[12]; + matC[ 5] = matA[ 4] * matB[ 1] + matA[ 5] * matB[ 5] + matA[ 6] * matB[ 9] + matA[ 7] * matB[13]; + matC[ 6] = matA[ 4] * matB[ 2] + matA[ 5] * matB[ 6] + matA[ 6] * matB[10] + matA[ 7] * matB[14]; + matC[ 7] = matA[ 4] * matB[ 3] + matA[ 5] * matB[ 7] + matA[ 6] * matB[11] + matA[ 7] * matB[15]; + matC[ 8] = matA[ 8] * matB[ 0] + matA[ 9] * matB[ 4] + matA[10] * matB[ 8] + matA[11] * matB[12]; + matC[ 9] = matA[ 8] * matB[ 1] + matA[ 9] * matB[ 5] + matA[10] * matB[ 9] + matA[11] * matB[13]; + matC[10] = matA[ 8] * matB[ 2] + matA[ 9] * matB[ 6] + matA[10] * matB[10] + matA[11] * matB[14]; + matC[11] = matA[ 8] * matB[ 3] + matA[ 9] * matB[ 7] + matA[10] * matB[11] + matA[11] * matB[15]; + matC[12] = matA[12] * matB[ 0] + matA[13] * matB[ 4] + matA[14] * matB[ 8] + matA[15] * matB[12]; + matC[13] = matA[12] * matB[ 1] + matA[13] * matB[ 5] + matA[14] * matB[ 9] + matA[15] * matB[13]; + matC[14] = matA[12] * matB[ 2] + matA[13] * matB[ 6] + matA[14] * matB[10] + matA[15] * matB[14]; + matC[15] = matA[12] * matB[ 3] + matA[13] * matB[ 7] + matA[14] * matB[11] + matA[15] * matB[15]; +} + +fslBool fslInvertMatrix4x4( float *src, float *inverse) +{ + int i, j, k, swap; + double t; + double temp[4][4]; + + for (i=0; i<4; i++) { + for (j=0; j<4; j++) { + temp[i][j] = src[i*4+j]; + } + } + + inverse[ 0] = 1.0f; + inverse[ 1] = 0.0f; + inverse[ 2] = 0.0f; + inverse[ 3] = 0.0f; + inverse[ 4] = 0.0f; + inverse[ 5] = 1.0f; + inverse[ 6] = 0.0f; + inverse[ 7] = 0.0f; + inverse[ 8] = 0.0f; + inverse[ 9] = 0.0f; + inverse[10] = 1.0f; + inverse[11] = 0.0f; + inverse[12] = 0.0f; + inverse[13] = 0.0f; + inverse[14] = 0.0f; + inverse[15] = 1.0f; + + + for (i = 0; i < 4; i++) { + /* + ** Look for largest element in column + */ + swap = i; + for (j = i + 1; j < 4; j++) { + if (fabs(temp[j][i]) > fabs(temp[i][i])) { + swap = j; + } + } + + if (swap != i) { + /* + ** Swap rows. + */ + for (k = 0; k < 4; k++) { + t = temp[i][k]; + temp[i][k] = temp[swap][k]; + temp[swap][k] = t; + + t = inverse[i*4+k]; + inverse[i*4+k] = inverse[swap*4+k]; + inverse[swap*4+k] = t; + } + } + + if (temp[i][i] == 0) { + /* + ** No non-zero pivot. The matrix is singular, which shouldn't + ** happen. This means the user gave us a bad matrix. + */ + return FSL_FALSE; + } + + t = temp[i][i]; + for (k = 0; k < 4; k++) { + temp[i][k] /= t; + inverse[i*4+k] /= t; + } + for (j = 0; j < 4; j++) { + if (j != i) { + t = temp[j][i]; + for (k = 0; k < 4; k++) { + temp[j][k] -= temp[i][k]*t; + inverse[j*4+k] -= inverse[i*4+k]*t; + } + } + } + } + return FSL_TRUE; +} + +void fslPerspectiveMatrix4x4 ( float *m, float fov, float aspect, float zNear, float zFar) +{ + const float h = 1.0f/tan(fov*PI_OVER_360); + float neg_depth = zNear-zFar; + + m[0] = h / aspect; + m[1] = 0; + m[2] = 0; + m[3] = 0; + + m[4] = 0; + m[5] = h; + m[6] = 0; + m[7] = 0; + + m[8] = 0; + m[9] = 0; + m[10] = (zFar + zNear)/neg_depth; + m[11] = -1; + + m[12] = 0; + m[13] = 0; + m[14] = 2.0f*(zNear*zFar)/neg_depth; + m[15] = 0; + +} + +void fslMultMatrix4x4Vec4x1 ( float *matA, float *vecA, float *vecB ) +{ + int i; + + for ( i = 0; i < 4; i++ ) + { + vecB[i] = vecA[0] * matA[0*4+i] + vecA[1] * matA[1*4+i] + vecA[2] * matA[2*4+i] + vecA[3] * matA[3*4+i]; + } +} + +void fslRotateMatrix4x4 (float *m, float angle, fslAxis axis) +{ + float radians = PI_OVER_360*2*angle; + float rotate[16] = {0}; + + fslLoadIdentityMatrix4x4(rotate); + + switch (axis) + { + case FSL_X_AXIS: + rotate[5] = cos(radians); + rotate[6] = sin(radians); + rotate[9] = -sin(radians); + rotate[10] = cos(radians); + fslMultMatrix4x4(m, rotate, m); + break; + case FSL_Y_AXIS: + rotate[0] = cos(radians); + rotate[2] = -sin(radians); + rotate[8] = sin(radians); + rotate[10] = cos(radians); + fslMultMatrix4x4(m, rotate, m); + break; + case FSL_Z_AXIS: + rotate[0] = cos(radians); + rotate[1] = sin(radians); + rotate[4] = -sin(radians); + rotate[5] = cos(radians); + fslMultMatrix4x4(m, rotate, m); + break; + default: + printf("invalid axis \n"); + break; + + } + + +} + +void fslTranslateMatrix4x4 (float *m, float transX, float transY, float transZ) +{ + float trans[16] = {0}; + fslLoadIdentityMatrix4x4(trans); + + trans[12]=transX; + trans[13]=transY; + trans[14]=transZ; + + fslMultMatrix4x4(m, trans, m); +} + +void fslScaleMatrix4x4 (float *m, float scaleX, float scaleY, float scaleZ) +{ + float scale[16] = {0}; + fslLoadIdentityMatrix4x4(scale); + + scale[0]=scaleX; + scale[5]=scaleY; + scale[10]=scaleZ; + + fslMultMatrix4x4(m, scale, m); +} + +void fslLoadIdentityMatrix4x4 (float *m) +{ + m[0] = 1; + m[1] = 0; + m[2] = 0; + m[3] = 0; + + m[4] = 0; + m[5] = 1; + m[6] = 0; + m[7] = 0; + + m[8] = 0; + m[9] = 0; + m[10] = 1; + m[11] = 0; + + m[12] = 0; + m[13] = 0; + m[14] = 0; + m[15] = 1; +} + +float fslInnerProduct( float *v, float *q) +{ + return v[0]*q[0]+v[1]*q[1]+v[2]*q[2]; +} +//result = endpoint-startPoint +void fslDirectionVector(float *result, float *endPoint, float *startPoint) +{ + result[0]= endPoint[0]-startPoint[0]; + result[1]= endPoint[1]-startPoint[1]; + result[2]= endPoint[2]-startPoint[2]; +} +//a = crossProduct(b,c) +void fslCrossProduct(float *result, float *b, float* c) +{ + result[0]= b[1]*c[2]-c[1]*b[2]; + result[1]= b[2]*c[0]-c[2]*b[0]; + result[2]= b[0]*c[1]-c[0]*b[1]; +} +//p is the startpoint, d is the direction vector, v0,v1,v2 represent the triangle +int fslRayIntersectsTriangle(float *p, float *d,float *v0, float *v1, float *v2) +{ + float e1[3]={0.0, 0.0, 0.0}; + float e2[3]={0.0, 0.0, 0.0}; + float h[3] = {0.0, 0.0, 0.0}; + float s[3] = {0.0, 0.0, 0.0}; + float q[3] = {0.0, 0.0, 0.0}; + float a,f,u,v,t; + fslDirectionVector(e1,v1,v0); + fslDirectionVector(e2,v2,v0); + fslCrossProduct(h,d,e2); + //get the inner product + a=fslInnerProduct(e1,h); + if(a>-0.00001&& a<0.00001) + return 0; + f= 1/a; + fslDirectionVector(s,p,v0); + u=f*(fslInnerProduct(s,h)); + + if(u<0.0 || u>1.0) + return 0; + + fslCrossProduct(q,s,e1); + v = f*fslInnerProduct(d,q); + if(v< 0.0 || u+v > 1.0) + return 0; + //we can compute t to find out where the intersection point is on the line + t= f*fslInnerProduct(e2,q); + if(t > 0.00001) //ray intersection + return 1; + else + return 0; + + +} +void fslNormalize(float *v) +{ + float mag =v[0]*v[0]+v[1]*v[1]+v[2]*v[2]; + sqrt(mag); + v[0]=v[0]/mag; + v[1]=v[1]/mag; + v[2]=v[2]/mag; + //printf("vector Normalized is %f,%f,%f\n",v[0],v[1],v[2]); +} +void fslPrintMatrix4x4(float *m){ + + printf(" %f %f %f %f \n", m[0], m[1], m[2], m[3]); + printf(" %f %f %f %f \n", m[4], m[5], m[6], m[7]); + printf(" %f %f %f %f \n", m[8], m[9], m[10], m[11]); + printf(" %f %f %f %f \n", m[12], m[13], m[14], m[15]); + +} +void fslCalculateNormals(float *triangleArray, int size, float *normalArray) +{ + printf("enter fslCalculateNormals \n"); + + + int index =0; + + int i=0; + for(i=0; i< size/3; i++){ + + float v1[3]={0.0f}; + float v2[3]={0.0f}; + float v3[3]={0.0f}; + //float v4[3]={0.0f}; + + float A[3]={0.0f}; + float B[3]={0.0f}; + /*float C[3]={0.0f}; + float D[3]={0.0f};*/ + + v1[0]=triangleArray[9*i];//9 is for 9 values (3 vertices) used per loop + v1[1]=triangleArray[9*i+1]; + v1[2]=triangleArray[12*i+2]; + + v2[0]=triangleArray[9*i+3]; + v2[1]=triangleArray[9*i+4]; + v2[2]=triangleArray[9*i+5]; + + v3[0]=triangleArray[9*i+6]; + v3[1]=triangleArray[9*i+7]; + v3[2]=triangleArray[9*i+8]; + + + A[0]=v1[0]-v2[0]; + A[1]=v1[1]-v2[1]; + A[2]=v1[2]-v2[2]; + + B[0]=v2[0]-v3[0]; + B[1]=v2[1]-v3[1]; + B[2]=v2[2]-v3[2]; + float result[3]={0.0f}; + + printf("adding normal %i\n",index); + fslCrossProduct(result, A, B); + fslNormalize(result); + normalArray[3*i]=result[0]; + normalArray[3*i+1]=result[1]; + normalArray[3*i+2]=result[2]; + + printf("adding normal: %f %f %f \n",result[0],result[1],result[2]); + index++; + } +} + + + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/glu3.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/glu3.c new file mode 100644 index 000000000..77d0762bd --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/common/src/glu3.c @@ -0,0 +1,334 @@ +/* + * Copyright © 2009 Ian D. Romanick + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define DEG2RAD(d) ((d) * M_PI / 180.0) + +#ifdef __cplusplus +const GLUmat4 gluIdentityMatrix ( { 1.0f, 0.0f, 0.0f, 0.0f } , { 0.0f, 1.0f, 0.0f, 0.0f } , { 0.0f, 0.0f, 1.0f, 0.0f } , { 0.0f, 0.0f, 0.0f, 1.0f } ); +#else +const GLUmat4 gluIdentityMatrix = { + { + { { 1.0f, 0.0f, 0.0f, 0.0f } }, + { { 0.0f, 1.0f, 0.0f, 0.0f } }, + { { 0.0f, 0.0f, 1.0f, 0.0f } }, + { { 0.0f, 0.0f, 0.0f, 1.0f } } + } +}; +#endif + +void gluTranslate4v(GLUmat4 *result, const GLUvec4 *t) +{ + memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); + result->col[3] = *t; + result->col[3].values[3] = 1.0f; +} + + +void gluScale4v(GLUmat4 *result, const GLUvec4 *t) +{ + memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); + result->col[0].values[0] = t->values[0]; + result->col[1].values[1] = t->values[1]; + result->col[2].values[2] = t->values[2]; +} + +void gluLookAt4v(GLUmat4 *result, const GLUvec4 *_eye, const GLUvec4 *_center, const GLUvec4 *_up) +{ +#ifdef __cplusplus + static const GLUvec4 col3( 0.0f, 0.0f, 0.0f, 1.0f ); + const GLUvec4 e( -_eye->values[0], -_eye->values[1], -_eye->values[2], 0.0f ); +#else + static const GLUvec4 col3 = { { 0.0f, 0.0f, 0.0f, 1.0f } }; + const GLUvec4 e = { + { -_eye->values[0], -_eye->values[1], -_eye->values[2], 0.0f } + }; + +#endif + GLUmat4 translate; + GLUmat4 rotate; + GLUmat4 rotateT; + GLUvec4 f; + GLUvec4 s; + GLUvec4 u; + GLUvec4 center, up; + + center = *_center; + center.values[3] = 0; + up = *_up; + up.values[3] = 0; + + gluAdd4v_4v(& f, ¢er, &e); + gluNormalize4v(& f, & f); + + gluNormalize4v(& u, &up); + + gluCross4v(& s, & f, & u); + gluCross4v(& u, & s, & f); + + rotate.col[0] = s; + rotate.col[1] = u; + rotate.col[2].values[0] = -f.values[0]; + rotate.col[2].values[1] = -f.values[1]; + rotate.col[2].values[2] = -f.values[2]; + rotate.col[2].values[3] = 0.0f; + rotate.col[3] = col3; + gluTranspose4m(& rotateT, & rotate); + + gluTranslate4v(& translate, & e); + gluMult4m_4m(result, & rotateT, & translate); +} + +void gluRotate4v(GLUmat4 *result, const GLUvec4 *_axis, GLfloat angle) +{ + GLUvec4 axis; + const float c = cos(angle); + const float s = sin(angle); + const float one_c = 1.0 - c; + + float xx; + float yy; + float zz; + + float xs; + float ys; + float zs; + + float xy; + float xz; + float yz; + + + gluNormalize4v(& axis, _axis); + + xx = axis.values[0] * axis.values[0]; + yy = axis.values[1] * axis.values[1]; + zz = axis.values[2] * axis.values[2]; + + xs = axis.values[0] * s; + ys = axis.values[1] * s; + zs = axis.values[2] * s; + + xy = axis.values[0] * axis.values[1]; + xz = axis.values[0] * axis.values[2]; + yz = axis.values[1] * axis.values[2]; + + + result->col[0].values[0] = (one_c * xx) + c; + result->col[0].values[1] = (one_c * xy) + zs; + result->col[0].values[2] = (one_c * xz) - ys; + result->col[0].values[3] = 0.0; + + result->col[1].values[0] = (one_c * xy) - zs; + result->col[1].values[1] = (one_c * yy) + c; + result->col[1].values[2] = (one_c * yz) + xs; + result->col[1].values[3] = 0.0; + + + result->col[2].values[0] = (one_c * xz) + ys; + result->col[2].values[1] = (one_c * yz) - xs; + result->col[2].values[2] = (one_c * zz) + c; + result->col[2].values[3] = 0.0; + + result->col[3].values[0] = 0.0; + result->col[3].values[1] = 0.0; + result->col[3].values[2] = 0.0; + result->col[3].values[3] = 1.0; +} + +void gluFrustum6f(GLUmat4 *result, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat n, GLfloat f) +{ + if ((right == left) || (top == bottom) || (n == f) + || (n < 0.0) || (f < 0.0)) + return; + + + memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); + + result->col[0].values[0] = (2.0 * n) / (right - left); + result->col[1].values[1] = (2.0 * n) / (top - bottom); + + result->col[2].values[0] = (right + left) / (right - left); + result->col[2].values[1] = (top + bottom) / (top - bottom); + result->col[2].values[2] = -(f + n) / (f - n); + result->col[2].values[3] = -1.0; + + result->col[3].values[2] = -(2.0 * f * n) / (f - n); + result->col[3].values[3] = 0.0; +} + +void gluPerspective4f(GLUmat4 *result, + GLfloat fovy, GLfloat aspect, GLfloat n, GLfloat f) +{ + const double sine = sin(DEG2RAD(fovy / 2.0)); + const double cosine = cos(DEG2RAD(fovy / 2.0)); + const double sine_aspect = sine * aspect; + const double dz = f - n; + + + memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); + if ((sine == 0.0) || (dz == 0.0) || (sine_aspect == 0.0)) { + return; + } + + result->col[0].values[0] = cosine / sine_aspect; + result->col[1].values[1] = cosine / sine; + result->col[2].values[2] = -(f + n) / dz; + result->col[2].values[3] = -1.0; + result->col[3].values[2] = -2.0 * n * f / dz; + result->col[3].values[3] = 0.0; +} + +void gluOrtho6f(GLUmat4 *result, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat n, GLfloat f) +{ + if ((right == left) || (top == bottom) || (n == f)) + return; + + (void) memcpy(result, & gluIdentityMatrix, sizeof(*result)); + result->col[0].values[0] = 2.0 / (right - left); + result->col[1].values[1] = 2.0 / (top - bottom); + result->col[2].values[2] = -2.0 / (f - n); + + result->col[3].values[0] = -(right + left) / (right - left); + result->col[3].values[1] = -(top + bottom) / (top - bottom); + result->col[3].values[2] = -(f + n) / (f - n); +} + +void gluOrtho4f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top) +{ + gluOrtho6f(result, left, right, bottom, top, -1.0, 1.0); +} + + +static double det3(const GLUmat4 *m, unsigned i, unsigned j) +{ + unsigned r; + unsigned c; + double det = 0.0; + GLUvec4 col[6]; + + + /* Generate a 3x3 matrix from the original matrix with the ith column + * and the jth row removed. The columns of the matrix are duplicated + * to make the 'c - r' column addressing, below, work out easier. + */ + for (c = 0; c < 4; c++) { + if (c < i) { + col[c + 0] = m->col[c]; + col[c + 3] = m->col[c]; + } else if (c > i) { + col[c - 1] = m->col[c]; + col[c + 2] = m->col[c]; + } + } + + for (r = j; r < 3; r++) { + col[0].values[r] = col[0].values[r + 1]; + col[1].values[r] = col[1].values[r + 1]; + col[2].values[r] = col[2].values[r + 1]; + col[3].values[r] = col[3].values[r + 1]; + col[4].values[r] = col[4].values[r + 1]; + col[5].values[r] = col[5].values[r + 1]; + } + + + /* Calculate the determinant of the resulting 3x3 matrix. + */ + for (c = 0; c < 3; c++) { + double diag1 = col[c].values[0]; + double diag2 = col[c].values[0]; + + for (r = 1; r < 3; r++) { + diag1 *= col[(0 + c) + r].values[r]; + diag2 *= col[(3 + c) - r].values[r]; + } + + det += (diag1 - diag2); + } + + return det; +} + +GLfloat gluDeterminant4_4m(const GLUmat4 *m) +{ + double det = 0.0; + unsigned c; + + for (c = 0; c < 4; c++) { + if (m->col[c].values[3] != 0.0) { + /* The usual equation is -1**(i+j) where i and j are + * the row and column of the matrix on the range + * [1, rows] and [1, cols]. Note that r and c are on + * the range [0, rows - 1] and [0, cols - 1]. + */ + const double sign = ((c ^ 3) & 1) ? -1.0 : 1.0; + const double d = det3(m, c, 3); + + det += sign * m->col[c].values[3] * d; + } + } + + return det; +} + + +GLboolean gluInverse4_4m(GLUmat4 *result, const GLUmat4 *m) +{ + const double det = gluDeterminant4_4m(m); + double inv_det; + unsigned c; + unsigned r; + + + if (det == 0.0) + return GL_FALSE; + + inv_det = 1.0 / det; + for (c = 0; c < 4; c++) { + for (r = 0; r < 4; r++) { + /* The usual equation is -1**(i+j) where i and j are + * the row and column of the matrix on the range + * [1, rows] and [1, cols]. Note that r and c are on + * the range [0, rows - 1] and [0, cols - 1]. + */ + const double sign = ((c ^ r) & 1) ? -1.0 : 1.0; + const double d = det3(m, c, r); + + result->col[r].values[c] = sign * inv_det * d; + } + } + + return GL_TRUE; +} + + + diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es11_example.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es11_example.c new file mode 100644 index 000000000..38c1600d5 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es11_example.c @@ -0,0 +1,419 @@ +/* + * es11_example.c + * + * This code was created by Jeff Molofee '99 + * (ported to Linux by Ti Leggett '01) + * (ported to i.mx51, i.mx31 and x11 by Freescale '10) + * If you've found this code useful, please let him know. + * + * Visit Jeff at http://nehe.gamedev.net/ + * + * Description: Rotating textured 3D object (using OpenGL ES 1.1) + * + */ + +#include +#include +#include +#include +#include +#include + +#include "GLU3/glu3.h" +#include "GLES/gl.h" + +#include "EGL/egl.h" + +#include "FSL/fsl_egl.h" +#include "FSL/fslutil.h" + +EGLDisplay egldisplay; +EGLConfig eglconfig; +EGLSurface eglsurface; +EGLContext eglcontext; +EGLNativeWindowType eglNativeWindow; +EGLNativeDisplayType eglNativeDisplayType; +volatile sig_atomic_t quit = 0; + +GLfloat xrot; /* X Rotation ( NEW ) */ +GLfloat yrot; /* Y Rotation ( NEW ) */ +GLfloat zrot; /* Z Rotation ( NEW ) */ + +GLuint texture[1]; /* Storage For One Texture ( NEW ) */ + +/* function to load in bitmap as a GL texture */ +int LoadGLTextures() +{ + Image *image1; + + // allocate space for texture we will use + image1 = (Image *) malloc(sizeof(Image)); + if (image1 == NULL) { + printf("Error allocating space for image\n"); + return 0; + } + + /* Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit */ + if (LoadBMP("texture.bmp", image1)) { + /* Create The Texture */ + glGenTextures(1, texture); + /* Typical Texture Generation Using Data From The Bitmap */ + glBindTexture(GL_TEXTURE_2D, *texture); + /* Generate The Texture */ + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image1->sizeX, image1->sizeY, 0, GL_RGB, + GL_UNSIGNED_BYTE, image1->data); + /* Linear Filtering */ + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } else { + return 0; + } + + /* Free up any memory we may have used */ + if (image1 != NULL) { + free(image1); + } + + return 1; +} + +/* Here goes our drawing code */ +void render() +{ + /* These are to calculate our fps */ + GLfloat texcoords[4][2]; + GLfloat vertices[4][3]; + GLubyte indices[4] = { 0, 1, 3, 2 }; /* QUAD to TRIANGLE_STRIP conversion; */ + + /* Clear The Screen And The Depth Buffer */ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* Move Into The Screen 5 Units */ + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -5.0f); + + glRotatef(xrot, 1.0f, 0.0f, 0.0f); /* Rotate On The X Axis */ + glRotatef(yrot, 0.0f, 1.0f, 0.0f); /* Rotate On The Y Axis */ + glRotatef(zrot, 0.0f, 0.0f, 1.0f); /* Rotate On The Z Axis */ + + /* Select Our Texture */ + glBindTexture(GL_TEXTURE_2D, texture[0]); + + /* Set pointers to vertices and texcoords */ + glVertexPointer(3, GL_FLOAT, 0, vertices); + glTexCoordPointer(2, GL_FLOAT, 0, texcoords); + + /* Enable vertices and texcoords arrays */ + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + /* Front Face */ + texcoords[0][0] = 0.0f; + texcoords[0][1] = 0.0f; + vertices[0][0] = -1.0f; + vertices[0][1] = -1.0f; + vertices[0][2] = 1.0f; + texcoords[1][0] = 1.0f; + texcoords[1][1] = 0.0f; + vertices[1][0] = 1.0f; + vertices[1][1] = -1.0f; + vertices[1][2] = 1.0f; + texcoords[2][0] = 1.0f; + texcoords[2][1] = 1.0f; + vertices[2][0] = 1.0f; + vertices[2][1] = 1.0f; + vertices[2][2] = 1.0f; + texcoords[3][0] = 0.0f; + texcoords[3][1] = 1.0f; + vertices[3][0] = -1.0f; + vertices[3][1] = 1.0f; + vertices[3][2] = 1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Back Face */ + /* Normal Pointing Away From Viewer */ + texcoords[0][0] = 0.0f; + texcoords[0][1] = 1.0f; + vertices[0][0] = -1.0f; + vertices[0][1] = -1.0f; + vertices[0][2] = -1.0f; + texcoords[1][0] = 0.0f; + texcoords[1][1] = 0.0f; + vertices[1][0] = -1.0f; + vertices[1][1] = 1.0f; + vertices[1][2] = -1.0f; + texcoords[2][0] = 1.0f; + texcoords[2][1] = 0.0f; + vertices[2][0] = 1.0f; + vertices[2][1] = 1.0f; + vertices[2][2] = -1.0f; + texcoords[3][0] = 1.0f; + texcoords[3][1] = 1.0f; + vertices[3][0] = 1.0f; + vertices[3][1] = -1.0f; + vertices[3][2] = -1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Top Face */ + texcoords[0][0] = 1.0f; + texcoords[0][1] = 0.0f; + vertices[0][0] = -1.0f; + vertices[0][1] = 1.0f; + vertices[0][2] = -1.0f; + texcoords[1][0] = 1.0f; + texcoords[1][1] = 1.0f; + vertices[1][0] = -1.0f; + vertices[1][1] = 1.0f; + vertices[1][2] = 1.0f; + texcoords[2][0] = 0.0f; + texcoords[2][1] = 1.0f; + vertices[2][0] = 1.0f; + vertices[2][1] = 1.0f; + vertices[2][2] = 1.0f; + texcoords[3][0] = 0.0f; + texcoords[3][1] = 0.0f; + vertices[3][0] = 1.0f; + vertices[3][1] = 1.0f; + vertices[3][2] = -1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Bottom Face */ + texcoords[0][0] = 1.0f; + texcoords[0][1] = 1.0f; + vertices[0][0] = -1.0f; + vertices[0][1] = -1.0f; + vertices[0][2] = -1.0f; + texcoords[1][0] = 0.0f; + texcoords[1][1] = 1.0f; + vertices[1][0] = 1.0f; + vertices[1][1] = -1.0f; + vertices[1][2] = -1.0f; + texcoords[2][0] = 0.0f; + texcoords[2][1] = 0.0f; + vertices[2][0] = 1.0f; + vertices[2][1] = -1.0f; + vertices[2][2] = 1.0f; + texcoords[3][0] = 1.0f; + texcoords[3][1] = 0.0f; + vertices[3][0] = -1.0f; + vertices[3][1] = -1.0f; + vertices[3][2] = 1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Right face */ + texcoords[0][0] = 0.0f; + texcoords[0][1] = 1.0f; + vertices[0][0] = 1.0f; + vertices[0][1] = -1.0f; + vertices[0][2] = -1.0f; + texcoords[1][0] = 0.0f; + texcoords[1][1] = 0.0f; + vertices[1][0] = 1.0f; + vertices[1][1] = 1.0f; + vertices[1][2] = -1.0f; + texcoords[2][0] = 1.0f; + texcoords[2][1] = 0.0f; + vertices[2][0] = 1.0f; + vertices[2][1] = 1.0f; + vertices[2][2] = 1.0f; + texcoords[3][0] = 1.0f; + texcoords[3][1] = 1.0f; + vertices[3][0] = 1.0f; + vertices[3][1] = -1.0f; + vertices[3][2] = 1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Left Face */ + texcoords[0][0] = 0.0f; + texcoords[0][1] = 0.0f; + vertices[0][0] = -1.0f; + vertices[0][1] = -1.0f; + vertices[0][2] = -1.0f; + texcoords[1][0] = 1.0f; + texcoords[1][1] = 0.0f; + vertices[1][0] = -1.0f; + vertices[1][1] = -1.0f; + vertices[1][2] = 1.0f; + texcoords[2][0] = 1.0f; + texcoords[2][1] = 1.0f; + vertices[2][0] = -1.0f; + vertices[2][1] = 1.0f; + vertices[2][2] = 1.0f; + texcoords[3][0] = 0.0f; + texcoords[3][1] = 1.0f; + vertices[3][0] = -1.0f; + vertices[3][1] = 1.0f; + vertices[3][2] = -1.0f; + + /* Draw one textured plane using two stripped triangles */ + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices); + + /* Disable texcoords and vertices arrays */ + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); + + /* Flush all drawings */ + glFinish(); + + xrot += 0.3f; /* X Axis Rotation */ + yrot += 0.2f; /* Y Axis Rotation */ + zrot += 0.4f; /* Z Axis Rotation */ +} + +void resize(int w, int h) +{ + /*change to projection matrix */ + glMatrixMode(GL_PROJECTION); + /*reset the projection matrix */ + glLoadIdentity(); + /*set the viewport */ + glViewport(0, 0, w, h); + + GLUmat4 perspective; + /*use glu to set perspective */ + gluPerspective4f(&perspective, 45.0f, ((GLfloat) w / (GLfloat) h), 1.0f, 100.0f); + glMultMatrixf(&perspective.col[0].values[0]); + + /*get back to model view matrix */ + glMatrixMode(GL_MODELVIEW); + /*reset modevl view matrix */ + glLoadIdentity(); +} + +int init(void) +{ + int w = 640; + int h = 480; + + static const EGLint s_configAttribs[] = { + EGL_RED_SIZE, 5, + EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, + EGL_ALPHA_SIZE, 0, + EGL_SAMPLES, 0, + EGL_NONE + }; + + EGLint numconfigs; + + //get egl display + eglNativeDisplayType = fsl_getNativeDisplay(); + egldisplay = eglGetDisplay(eglNativeDisplayType); + //Initialize egl + eglInitialize(egldisplay, NULL, NULL); + assert(eglGetError() == EGL_SUCCESS); + //tell the driver we are using OpenGL ES + eglBindAPI(EGL_OPENGL_ES_API); + + //pass our egl configuration to egl + eglChooseConfig(egldisplay, s_configAttribs, &eglconfig, 1, &numconfigs); + printf("chooseconfig, \n"); + assert(eglGetError() == EGL_SUCCESS); + assert(numconfigs == 1); + /* Enable smooth shading */ + glShadeModel(GL_SMOOTH); + + eglNativeWindow = fsl_createwindow(egldisplay, eglNativeDisplayType); + assert(eglNativeWindow); + + eglsurface = + eglCreateWindowSurface(egldisplay, eglconfig, (EGLNativeWindowType) eglNativeWindow, + NULL); + + printf("createwindow, \n"); + assert(eglGetError() == EGL_SUCCESS); + + //create the egl graphics context + eglcontext = eglCreateContext(egldisplay, eglconfig, NULL, NULL); + printf("creatcontext, \n"); + assert(eglGetError() == EGL_SUCCESS); + + //make the context current + eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglcontext); + printf("makecurrent, \n"); + assert(eglGetError() == EGL_SUCCESS); + + /* Load in the texture */ + if (LoadGLTextures() == 0) { + return 0; + } + + /* Enable Texture Mapping ( NEW ) */ + glEnable(GL_TEXTURE_2D); + + /* Enable smooth shading */ + glShadeModel(GL_SMOOTH); + + /* Set the background black */ + glClearColor(0.0f, 0.0f, 0.0f, 0.5f); + + /* Depth buffer setup */ + glClearDepthf(1.0f); + + /* Enables Depth Testing */ + glEnable(GL_DEPTH_TEST); + + /* The Type Of Depth Test To Do */ + glDepthFunc(GL_LEQUAL); + + /*enable cullface */ + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + + /* Really Nice Perspective Calculations */ + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + + /*get width and height from egl */ + eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &w); + eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &h); + + /* Scale the content to the window */ + resize(w, h); + + return 1; +} + +void deinit(void) +{ + printf("Cleaning up...\n"); + eglMakeCurrent(egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + assert(eglGetError() == EGL_SUCCESS); + eglDestroyContext(egldisplay, eglcontext); + eglDestroySurface(egldisplay, eglsurface); + fsl_destroywindow(eglNativeWindow, eglNativeDisplayType); + eglTerminate(egldisplay); + assert(eglGetError() == EGL_SUCCESS); + eglReleaseThread(); +} + +void sighandler(int signal) +{ + printf("Caught signal %d, setting flaq to quit.\n", signal); + quit = 1; +} + +int main(void) +{ + signal(SIGINT, sighandler); + signal(SIGTERM, sighandler); + + assert(init()); + while (!quit) { + render(); + eglSwapBuffers(egldisplay, eglsurface); + } + deinit(); + + return 1; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es20_example.c b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es20_example.c new file mode 100644 index 000000000..a3dbb93a3 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/es20_example.c @@ -0,0 +1,488 @@ +/* + * This code was created by Jeff Molofee '99 + * (ported to Linux by Ti Leggett '01) + * (ported to i.mx51, i.mx31 and x11 by Freescale '10) + * If you've found this code useful, please let him know. + * + * Visit Jeff at http://nehe.gamedev.net/ + * + */ + +#include +#include +#include +#include +#include +#include + +#include "GLES2/gl2.h" +#include "GLES2/gl2ext.h" + +#include "EGL/egl.h" + +#include "FSL/fsl_egl.h" +#include "FSL/fslutil.h" + + +#define TRUE 1 +#define FALSE !TRUE +EGLDisplay egldisplay; +EGLConfig eglconfig; +EGLSurface eglsurface; +EGLContext eglcontext; +EGLNativeWindowType eglNativeWindow; +EGLNativeDisplayType eglNativeDisplayType; +volatile sig_atomic_t quit = 0; + +GLuint g_hShaderProgram = 0; +GLuint g_hModelViewMatrixLoc = 0; +GLuint g_hProjMatrixLoc = 0; +GLuint g_hVertexLoc = 0; +GLuint g_hVertexTexLoc = 2; +GLuint g_hColorLoc = 1; + + +//-------------------------------------------------------------------------------------- +// Name: g_strVertexShader / g_strFragmentShader +// Desc: The vertex and fragment shader programs +//-------------------------------------------------------------------------------------- +const char* g_strVertexShader = +"uniform mat4 g_matModelView; \n" +"uniform mat4 g_matProj; \n" +" \n" +"attribute vec4 g_vPosition; \n" +"attribute vec3 g_vColor; \n" +"attribute vec2 g_vTexCoord; \n" +" \n" +"varying vec3 g_vVSColor; \n" +"varying vec2 g_vVSTexCoord; \n" +" \n" +"void main() \n" +"{ \n" +" vec4 vPositionES = g_matModelView * g_vPosition; \n" +" gl_Position = g_matProj * vPositionES; \n" +" g_vVSColor = g_vColor; \n" +" g_vVSTexCoord = g_vTexCoord; \n" +"} \n"; + + +const char* g_strFragmentShader = +"#ifdef GL_FRAGMENT_PRECISION_HIGH \n" +" precision highp float; \n" +"#else \n" +" precision mediump float; \n" +"#endif \n" +" \n" +"uniform sampler2D s_texture; \n" +"varying vec3 g_vVSColor; \n" +"varying vec2 g_vVSTexCoord; \n" +" \n" +"void main() \n" +"{ \n" +" gl_FragColor = texture2D(s_texture,g_vVSTexCoord); \n" +"} \n"; + +float VertexPositions[] = { + /* Draw A Quad */ + /* Top Right Of The Quad (Top) */ + 1.0f, 1.0f, -1.0f, + /* Top Left Of The Quad (Top) */ + -1.0f, 1.0f, -1.0f, + /* Bottom Right Of The Quad (Top) */ + 1.0f, 1.0f, 1.0f, + /* Bottom Left Of The Quad (Top) */ + -1.0f, 1.0f, 1.0f, + /* Top Right Of The Quad (Bottom) */ + 1.0f, -1.0f, 1.0f, + /* Top Left Of The Quad (Bottom) */ + -1.0f, -1.0f, 1.0f, + /* Bottom Right Of The Quad (Bottom) */ + 1.0f, -1.0f, -1.0f, + /* Bottom Left Of The Quad (Bottom) */ + -1.0f, -1.0f, -1.0f, + /* Top Right Of The Quad (Front) */ + 1.0f, 1.0f, 1.0f, + /* Top Left Of The Quad (Front) */ + -1.0f, 1.0f, 1.0f, + /* Bottom Right Of The Quad (Front) */ + 1.0f, -1.0f, 1.0f, + /* Bottom Left Of The Quad (Front) */ + -1.0f, -1.0f, 1.0f, + /* Top Right Of The Quad (Back) */ + 1.0f, -1.0f, -1.0f, + /* Top Left Of The Quad (Back) */ + -1.0f, -1.0f, -1.0f, + /* Bottom Right Of The Quad (Back) */ + 1.0f, 1.0f, -1.0f, + /* Bottom Left Of The Quad (Back) */ + -1.0f, 1.0f, -1.0f, + /* Top Right Of The Quad (Left) */ + -1.0f, 1.0f, 1.0f, + /* Top Left Of The Quad (Left) */ + -1.0f, 1.0f, -1.0f, + /* Bottom Right Of The Quad (Left) */ + -1.0f, -1.0f, 1.0f, + /* Bottom Left Of The Quad (Left) */ + -1.0f, -1.0f, -1.0f, + /* Top Right Of The Quad (Right) */ + 1.0f, 1.0f, -1.0f, + /* Top Left Of The Quad (Right) */ + 1.0f, 1.0f, 1.0f, + /* Bottom Right Of The Quad (Right) */ + 1.0f, -1.0f, -1.0f, + /* Bottom Left Of The Quad (Right) */ + 1.0f, -1.0f, 1.0f +}; + +float VertexTexCoords[] = { + /* Top Face */ + 0.0f, 0.0f, + 1.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 1.0f, + /* Bottom Face */ + 1.0f, 1.0f, + 0.0f, 1.0f, + 0.0f, 0.0f, + 1.0f, 0.0f, + /* Front Face */ + 0.0f, 0.0f, + 1.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 1.0f, + /* Back Face */ + 1.0f, 1.0f, + 0.0f, 1.0f, + 1.0f, 0.0f, + 0.0f, 0.0f, + /*left face */ + 0.0f, 0.0f, + 1.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 1.0f, + /* Right face */ + 0.0f, 0.0f, + 1.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 1.0f, +}; + +float VertexColors[] = { + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Red */ + 1.0f, 0.0, 0.0f, 1.0f, + /* Red */ + 1.0f, 0.0, 0.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Red */ + 1.0f, 0.0f, 0.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f, + /* Blue */ + 0.0f, 0.0f, 1.0f, 1.0f, + /* Green */ + 0.0f, 1.0f, 0.0f, 1.0f +}; + +GLuint texture[1]; /* Storage For One Texture ( NEW ) */ + +/* function to load in bitmap as a GL texture */ +int LoadGLTextures() +{ + + Image *image1; + + // allocate space for texture we will use + image1 = (Image *) malloc(sizeof(Image)); + if (image1 == NULL) { + printf("Error allocating space for image"); + return 0; + } + + /* Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit */ + if (LoadBMP("texture.bmp", image1)) { + /* Create The Texture */ + glGenTextures(1, texture); + /* Typical Texture Generation Using Data From The Bitmap */ + glBindTexture(GL_TEXTURE_2D, *texture); + /* Generate The Texture */ + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image1->sizeX, image1->sizeY, 0, GL_RGB, + GL_UNSIGNED_BYTE, image1->data); + /* Linear Filtering */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + printf("texture loaded and created successfully"); + + } else + return 0; + + /* Free up any memory we may have used */ + if (image1 != NULL) { + free(image1); + } + + return 1; +} + +void render(float w, float h) +{ + static float fAngle = 0.0f; + fAngle += 0.01f; + + // Rotate and translate the model view matrix + float matModelView[16] = { 0 }; + matModelView[0] = +cosf(fAngle); + matModelView[2] = +sinf(fAngle); + matModelView[5] = 1.0f; + matModelView[8] = -sinf(fAngle); + matModelView[10] = +cosf(fAngle); + matModelView[12] = 0.0f; //X + matModelView[14] = -6.0f; //z + matModelView[15] = 1.0f; + + // Build a perspective projection matrix + float matProj[16] = { 0 }; + matProj[0] = cosf(0.5f) / sinf(0.5f); + matProj[5] = matProj[0] * (w / h); + matProj[10] = -(10.0f) / (9.0f); + matProj[11] = -1.0f; + matProj[14] = -(10.0f) / (9.0f); + + // Clear the colorbuffer and depth-buffer + glClearColor(0.0f, 0.0f, 0.5f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // Set some state + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + + // Set the shader program + glUseProgram(g_hShaderProgram); + glUniformMatrix4fv(g_hModelViewMatrixLoc, 1, 0, matModelView); + glUniformMatrix4fv(g_hProjMatrixLoc, 1, 0, matProj); + + // Bind the vertex attributes + glVertexAttribPointer(g_hVertexLoc, 3, GL_FLOAT, 0, 0, VertexPositions); + glEnableVertexAttribArray(g_hVertexLoc); + + glVertexAttribPointer(g_hColorLoc, 4, GL_FLOAT, 0, 0, VertexColors); + glEnableVertexAttribArray(g_hColorLoc); + + glVertexAttribPointer(g_hVertexTexLoc, 2, GL_FLOAT, 0, 0, VertexTexCoords); + glEnableVertexAttribArray(g_hVertexTexLoc); + + /* Select Our Texture */ + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, texture[0]); + + /* Drawing Using Triangle strips, draw triangle strips using 4 vertices */ + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 8, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 12, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 16, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 20, 4); + + // Cleanup + glDisableVertexAttribArray(g_hVertexLoc); + glDisableVertexAttribArray(g_hColorLoc); + glDisableVertexAttribArray(g_hVertexTexLoc); +} + + +int init(void) +{ + + /*static const EGLint gl_context_attribs[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; */ + + static const EGLint s_configAttribs[] = { + EGL_RED_SIZE, 5, + EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, + EGL_ALPHA_SIZE, 0, + EGL_SAMPLES, 0, + EGL_NONE + }; + + EGLint numconfigs; + + eglNativeDisplayType = fsl_getNativeDisplay(); + egldisplay = eglGetDisplay(eglNativeDisplayType); + eglInitialize(egldisplay, NULL, NULL); + assert(eglGetError() == EGL_SUCCESS); + eglBindAPI(EGL_OPENGL_ES_API); + + eglChooseConfig(egldisplay, s_configAttribs, &eglconfig, 1, &numconfigs); + assert(eglGetError() == EGL_SUCCESS); + assert(numconfigs == 1); + + eglNativeWindow = fsl_createwindow(egldisplay, eglNativeDisplayType); + assert(eglNativeWindow); + + eglsurface = eglCreateWindowSurface(egldisplay, eglconfig, eglNativeWindow, NULL); + + assert(eglGetError() == EGL_SUCCESS); + EGLint ContextAttribList[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; + + eglcontext = eglCreateContext(egldisplay, eglconfig, EGL_NO_CONTEXT, ContextAttribList); + assert(eglGetError() == EGL_SUCCESS); + eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglcontext); + assert(eglGetError() == EGL_SUCCESS); + + { + // Compile the shaders + GLuint hVertexShader = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(hVertexShader, 1, &g_strVertexShader, NULL); + glCompileShader(hVertexShader); + + // Check for compile success + GLint nCompileResult = 0; + glGetShaderiv(hVertexShader, GL_COMPILE_STATUS, &nCompileResult); + if (0 == nCompileResult) { + char strLog[1024]; + GLint nLength; + glGetShaderInfoLog(hVertexShader, 1024, &nLength, strLog); + return FALSE; + } + + GLuint hFragmentShader = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(hFragmentShader, 1, &g_strFragmentShader, NULL); + glCompileShader(hFragmentShader); + + // Check for compile success + glGetShaderiv(hFragmentShader, GL_COMPILE_STATUS, &nCompileResult); + if (0 == nCompileResult) { + char strLog[1024]; + GLint nLength; + glGetShaderInfoLog(hFragmentShader, 1024, &nLength, strLog); + return FALSE; + } + // Attach the individual shaders to the common shader program + g_hShaderProgram = glCreateProgram(); + glAttachShader(g_hShaderProgram, hVertexShader); + glAttachShader(g_hShaderProgram, hFragmentShader); + + // Init attributes BEFORE linking + glBindAttribLocation(g_hShaderProgram, g_hVertexLoc, "g_vPosition"); + glBindAttribLocation(g_hShaderProgram, g_hColorLoc, "g_vColor"); + + printf("about to link shader..."); + glBindAttribLocation(g_hShaderProgram, g_hVertexTexLoc, "g_vTexCoord"); + + // Link the vertex shader and fragment shader together + glLinkProgram(g_hShaderProgram); + + // Check for link success + GLint nLinkResult = 0; + glGetProgramiv(g_hShaderProgram, GL_LINK_STATUS, &nLinkResult); + if (0 == nLinkResult) { + char strLog[1024]; + GLint nLength; + glGetProgramInfoLog(g_hShaderProgram, 1024, &nLength, strLog); + printf("error linking shader"); + return FALSE; + } + // Get uniform locations + g_hModelViewMatrixLoc = + glGetUniformLocation(g_hShaderProgram, "g_matModelView"); + g_hProjMatrixLoc = glGetUniformLocation(g_hShaderProgram, "g_matProj"); + + glDeleteShader(hVertexShader); + glDeleteShader(hFragmentShader); + + //gen textures + /* Load in the texture */ + if (LoadGLTextures() == 0) { + printf("error loading texture"); + return 0; + } + + /* Enable Texture Mapping ( NEW ) */ + glEnable(GL_TEXTURE_2D); + + } + + return 1; +} + +void Cleanup() +{ + +} + +void deinit(void) +{ + printf("Cleaning up...\n"); + Cleanup(); + eglMakeCurrent(egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + assert(eglGetError() == EGL_SUCCESS); + eglDestroyContext(egldisplay, eglcontext); + eglDestroySurface(egldisplay, eglsurface); + fsl_destroywindow(eglNativeWindow, eglNativeDisplayType); + eglTerminate(egldisplay); + assert(eglGetError() == EGL_SUCCESS); + eglReleaseThread(); +} + +void sighandler(int signal) +{ + printf("Caught signal %d, setting flaq to quit.\n", signal); + quit = 1; +} + +int main(void) +{ + signal(SIGINT, sighandler); + signal(SIGTERM, sighandler); + assert(init()); + + while (!quit) { + EGLint width = 0; + EGLint height = 0; + eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width); + eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height); + render(width, height); + eglSwapBuffers(egldisplay, eglsurface); + } + deinit(); + return 0; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/texture.bmp b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles/mx6/opengles/texture.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d36bd345e8f055ffab166f193530daaa91e7a8f9 GIT binary patch literal 196664 zcmeI*|FeBrSts^0bZAOYVEEDnLh;3q5uZ(2C#?dWNy1LLluJjm%6zpfF|( zh9ZTPDWeHRX@#<&G9g-4EKOo55e(WR#xNPjWJc#poFtQ)A5!^4@>=J8&huHl_c{CS zbMCpH&%NjFU8~P$owe6`*0Y}H{d`$#?{oXR|H>Oz53Jhto&NjQR{3-J@6WAX)V{5+ z=RIq+YX5DoU-%2Fr7RM-%@Wv}!t(DTf!ig4SpDr<^Rn7S0$T|z_}@xm`S&(TV8Q=w z)cUgKtppbQZzZw(dmAON;QuyieOdEX0t^1Pl34z|jS^V!e;c*Fta&Se1^-(~EdSm{ z2`u=(japyUyp_O$|E(mJe{Z7%7X05vtuJfdN?^hNRuap%D?`@R8g8$p7^<~Xl3EUg}KYg{TvYmPP_hJbU+ReRg1oKyf z|93un_1JS)Kk$Op2Oe7e(2G_-@{M=P6EA9wZt3v$Z#Yc7&s?qE{oK{}J-<;1$$P6Pi!;_r7qmy5p8(RF!9}R!V(6Oac3Q z_o~^){QlAR?apcOPlG@RnH2ZYm#==}m8(yD%j%P_T7BwYU;U@w+KP&=8r}Nv%UU;` z4SC12FOYx^5Kgdv>!oe%$M0;&hMKP$&FJory<`KMAcujl4(1l?V3=hcj0N7byPJ|e zI=qECyX#F~*GB1|&d{hop!$m7ptEs(f8B~W!LM1d@W9qMklk&OXZf+D*4pHO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 z{R%8^1`Y&u)nEM%+RtPxm%?F{4nna$czYt zd>)5?40xla{-oPgW4`D^KHI0Alm8;Drby*>;$QN^x%okEevZ-0Z(Cl@;8x9E*03C-J3~oE&lU6$NaH{ zlE2C|!9VQ-9>47g-4XZ)cnjpZ^FE|S9f5x!WJD6M!4|0(*Qx5Jkl_nASiJ|+729Wk ze;5|xg?nBdR4yz*f+5QIqJnr!-7X|$#{B;MgeP)g2?lt6V92XV<@Wcn)OYYA9K-R1 z$Wb{A%YxJmtUht?J4sa^cQJsDx2*FgiN>-zNeklg9D#?4TD?0w7MSdA{#44tTNIor)v^k>bU+GTMxy;@3z`ti$yd2F^{e?xh zWVZcl4<$oJK_iHGHEs?mFk^aGadC#$m0f_4ls}u`f!)sH6>euWTximMo*(n^@VqM{ zja@?;Yi0X8iD>jTpm#^DNC8gH|BA8^rqC4x4T!W9lo)d@d=L6AnKc{GU)J*Nqe~Gf8L!?0wn0TRQNo;@3{lG9^}^gIFoO zpQfYdz=E!uOisnmg8x%Va-nk*C9vTCCTeZr`BV~E@P8^vE_8091Qz_?M6E46pGpD? z{!b;zh0aZsz=HpqsI`UXQ%PXK|EVOo(7A~cSnz)nwYKnlDhVw3Kb0gGIyX@Q3;u7S z))t;mC4mM1r;_AC=O#*E!T(Lv+QRdxB(UKBRFYii+(Zd1_`iu-TX;T|1Qz_CN|Fnm zn<#+=|2I)<3(u#Lz=Ho%Nphic6D6?V|0Zf};rUb&Snz);NiKA5q68NF-$bn~JfBJe z3;s_f$%W2Ml)!@jo2a#g=Tk{w!T+fwxzM?Z5?Jtm6ScPRd@2bn_&=2-7dkgl0t^0c zqSh9kPbGl`|EH4VLgyw*V8Q=Q)Y`)HsU)!A|5TD(=-fmJ1pmwDB7s{gfz|5&2YNo2 AnE(I) literal 0 HcmV?d00001 diff --git a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb index 69af7f51d..f6639b437 100644 --- a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb @@ -46,6 +46,7 @@ RDEPENDS_${PN}_append_ccimx53js = "\ RDEPENDS_${PN}_append_mx6 = "\ dey-examples-can \ + ${@base_contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \ dey-examples-v4l2 \ "