mirror of https://github.com/mosra/magnum.git
Browse Source
Conflicts: src/Context.h src/Platform/AbstractXApplication.cpp src/Platform/AbstractXApplication.h
49 changed files with 720 additions and 224 deletions
@ -0,0 +1,47 @@
|
||||
# Author: mosra <mosra@centrum.cz> |
||||
pkgname=magnum |
||||
pkgver=dev.es3desktop |
||||
pkgrel=1 |
||||
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (desktop OpenGL ES 3.0 version)" |
||||
arch=('i686' 'x86_64') |
||||
url="http://mosra.cz/blog/magnum.php" |
||||
license=('MIT') |
||||
depends=('corrade' 'openal') |
||||
makedepends=('cmake' 'ninja') |
||||
options=(!strip) |
||||
provides=('magnum-git') |
||||
|
||||
build() { |
||||
mkdir -p "$startdir/build-es3desktop" |
||||
cd "$startdir/build-es3desktop" |
||||
|
||||
cmake .. \ |
||||
-DCMAKE_BUILD_TYPE=Debug \ |
||||
-DCMAKE_INSTALL_PREFIX=/usr \ |
||||
-DTARGET_GLES=ON \ |
||||
-DTARGET_GLES2=OFF \ |
||||
-DTARGET_DESKTOP_GLES=ON \ |
||||
-DWITH_AUDIO=ON \ |
||||
-DWITH_SDL2APPLICATION=ON \ |
||||
-DWITH_GLXAPPLICATION=ON \ |
||||
-DWITH_WINDOWLESSGLXAPPLICATION=ON \ |
||||
-DWITH_MAGNUMFONT=ON \ |
||||
-DWITH_TGAIMAGECONVERTER=ON \ |
||||
-DWITH_TGAIMPORTER=ON \ |
||||
-DWITH_WAVAUDIOIMPORTER=ON \ |
||||
-DWITH_MAGNUMINFO=ON \ |
||||
-DBUILD_TESTS=ON \ |
||||
-DBUILD_GL_TESTS=ON \ |
||||
-G Ninja |
||||
ninja |
||||
} |
||||
|
||||
check() { |
||||
cd "$startdir/build-es3desktop" |
||||
ctest --output-on-failure |
||||
} |
||||
|
||||
package() { |
||||
cd "$startdir/build-es3desktop" |
||||
DESTDIR="$pkgdir/" ninja install |
||||
} |
||||
@ -0,0 +1,62 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
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 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 <TestSuite/Tester.h> |
||||
|
||||
#include "Version.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class VersionTest: public TestSuite::Tester { |
||||
public: |
||||
explicit VersionTest(); |
||||
|
||||
void fromNumber(); |
||||
void toNumber(); |
||||
}; |
||||
|
||||
VersionTest::VersionTest() { |
||||
addTests({&VersionTest::fromNumber, |
||||
&VersionTest::toNumber}); |
||||
} |
||||
|
||||
void VersionTest::fromNumber() { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
CORRADE_COMPARE(version(4, 3), Version::GL430); |
||||
#else |
||||
CORRADE_COMPARE(version(3, 0), Version::GLES300); |
||||
#endif |
||||
} |
||||
|
||||
void VersionTest::toNumber() { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
CORRADE_COMPARE(version(Version::GL430), std::make_pair(4, 3)); |
||||
#else |
||||
CORRADE_COMPARE(version(Version::GLES300), std::make_pair(3, 0)); |
||||
#endif |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::VersionTest) |
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
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 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 "Version.h" |
||||
|
||||
#include <Utility/Debug.h> |
||||
|
||||
namespace Magnum { |
||||
|
||||
#ifndef DOXYGEN_GENERATING_OUTPUT |
||||
Debug operator<<(Debug debug, Version value) { |
||||
switch(value) { |
||||
#define _c(value, string) case Version::value: return debug << string; |
||||
_c(None, "None") |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
_c(GL210, "OpenGL 2.1") |
||||
_c(GL300, "OpenGL 3.0") |
||||
_c(GL310, "OpenGL 3.1") |
||||
_c(GL320, "OpenGL 3.2") |
||||
_c(GL330, "OpenGL 3.3") |
||||
_c(GL400, "OpenGL 4.0") |
||||
_c(GL410, "OpenGL 4.1") |
||||
_c(GL420, "OpenGL 4.2") |
||||
_c(GL430, "OpenGL 4.3") |
||||
_c(GL440, "OpenGL 4.4") |
||||
#else |
||||
_c(GLES200, "OpenGL ES 2.0") |
||||
_c(GLES300, "OpenGL ES 3.0") |
||||
#endif |
||||
#undef _c |
||||
} |
||||
|
||||
return debug << "Invalid"; |
||||
} |
||||
#endif |
||||
|
||||
} |
||||
@ -0,0 +1,108 @@
|
||||
#ifndef Magnum_Version_h |
||||
#define Magnum_Version_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
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 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. |
||||
*/ |
||||
|
||||
/** @file Version.h
|
||||
* Enum @ref Magnum::Version, function @ref version() |
||||
*/ |
||||
|
||||
#include <utility> |
||||
|
||||
#include "Magnum.h" |
||||
#include "magnumVisibility.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
/**
|
||||
@brief OpenGL version |
||||
|
||||
@see @ref Context, @ref MAGNUM_ASSERT_VERSION_SUPPORTED() |
||||
*/ |
||||
enum class Version: Int { |
||||
None = 0xFFFF, /**< @brief Unspecified */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
GL210 = 210, /**< @brief OpenGL 2.1 / GLSL 1.20 */ |
||||
GL300 = 300, /**< @brief OpenGL 3.0 / GLSL 1.30 */ |
||||
GL310 = 310, /**< @brief OpenGL 3.1 / GLSL 1.40 */ |
||||
GL320 = 320, /**< @brief OpenGL 3.2 / GLSL 1.50 */ |
||||
GL330 = 330, /**< @brief OpenGL 3.3, GLSL 3.30 */ |
||||
GL400 = 400, /**< @brief OpenGL 4.0, GLSL 4.00 */ |
||||
GL410 = 410, /**< @brief OpenGL 4.1, GLSL 4.10 */ |
||||
GL420 = 420, /**< @brief OpenGL 4.2, GLSL 4.20 */ |
||||
GL430 = 430, /**< @brief OpenGL 4.3, GLSL 4.30 */ |
||||
GL440 = 440, /**< @brief OpenGL 4.4, GLSL 4.40 */ |
||||
#endif |
||||
|
||||
/**
|
||||
* @brief OpenGL ES 2.0, GLSL ES 1.00 |
||||
* |
||||
* All the functionality is present in OpenGL 4.2 (extension |
||||
* @extension{ARB,ES2_compatibility}), so on desktop OpenGL this is |
||||
* equivalent to @ref Version::GL410. |
||||
*/ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
GLES200 = 410, |
||||
#else |
||||
GLES200 = 200, |
||||
#endif |
||||
|
||||
/**
|
||||
* @brief OpenGL ES 3.0, GLSL ES 3.00 |
||||
* |
||||
* All the functionality is present in OpenGL 4.3 (extension |
||||
* @extension{ARB,ES3_compatibility}), so on desktop OpenGL this is the |
||||
* equivalent to @ref Version::GL430. |
||||
*/ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
GLES300 = 430 |
||||
#else |
||||
GLES300 = 300 |
||||
#endif |
||||
}; |
||||
|
||||
#if defined(CORRADE_GCC44_COMPATIBILITY) && !defined(DOXYGEN_GENERATING_OUTPUT) |
||||
/* GCC 4.4 somehow doesn't have comparison operators for strongly-typed enums */ |
||||
inline bool operator<=(Version a, Version b) { return Int(a) <= Int(b); } |
||||
inline bool operator>=(Version a, Version b) { return Int(a) >= Int(b); } |
||||
inline bool operator<(Version a, Version b) { return Int(a) < Int(b); } |
||||
inline bool operator>(Version a, Version b) { return Int(a) > Int(b); } |
||||
#endif |
||||
|
||||
/** @brief Enum value from major and minor version number */ |
||||
inline Version version(Int major, Int minor) { |
||||
return Version(major*100 + minor*10); |
||||
} |
||||
|
||||
/** @brief Major and minor version number from enum value */ |
||||
inline std::pair<Int, Int> version(Version version) { |
||||
return {Int(version)/100, (Int(version)%100)/10}; |
||||
} |
||||
|
||||
/** @debugoperator{Magnum::Context} */ |
||||
Debug MAGNUM_EXPORT operator<<(Debug debug, Version value); |
||||
|
||||
} |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue