José Fonseca | 93f0e3f | 2011-10-09 16:16:18 +0100 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright 2011 Jose Fonseca |
| 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to deal |
| 8 | * in the Software without restriction, including without limitation the rights |
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | * copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | * THE SOFTWARE. |
| 23 | * |
| 24 | **************************************************************************/ |
| 25 | |
| 26 | |
José Fonseca | d1c301f | 2012-10-18 15:22:41 +0100 | [diff] [blame] | 27 | #include <assert.h> |
| 28 | |
José Fonseca | 3e899d7 | 2013-10-29 14:40:57 +0000 | [diff] [blame] | 29 | #include <iostream> |
| 30 | |
José Fonseca | d1c301f | 2012-10-18 15:22:41 +0100 | [diff] [blame] | 31 | #include "glproc.hpp" |
José Fonseca | 93f0e3f | 2011-10-09 16:16:18 +0100 | [diff] [blame] | 32 | #include "glws.hpp" |
| 33 | |
| 34 | |
| 35 | namespace glws { |
| 36 | |
| 37 | |
José Fonseca | 93f0e3f | 2011-10-09 16:16:18 +0100 | [diff] [blame] | 38 | bool |
| 39 | checkExtension(const char *extName, const char *extString) |
| 40 | { |
José Fonseca | d1c301f | 2012-10-18 15:22:41 +0100 | [diff] [blame] | 41 | assert(extName); |
José Fonseca | a69cd19 | 2014-05-28 18:29:33 +0100 | [diff] [blame] | 42 | |
| 43 | if (!extString) { |
| 44 | return false; |
| 45 | } |
José Fonseca | d1c301f | 2012-10-18 15:22:41 +0100 | [diff] [blame] | 46 | |
| 47 | const char *p = extString; |
| 48 | const char *q = extName; |
| 49 | char c; |
| 50 | do { |
| 51 | c = *p++; |
| 52 | if (c == '\0' || c == ' ') { |
| 53 | if (q && *q == '\0') { |
| 54 | return true; |
| 55 | } else { |
| 56 | q = extName; |
| 57 | } |
| 58 | } else { |
| 59 | if (q && *q == c) { |
| 60 | ++q; |
| 61 | } else { |
| 62 | q = 0; |
| 63 | } |
| 64 | } |
| 65 | } while (c); |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | |
José Fonseca | 3e899d7 | 2013-10-29 14:40:57 +0000 | [diff] [blame] | 70 | void |
| 71 | Drawable::copySubBuffer(int x, int y, int width, int height) { |
| 72 | std::cerr << "warning: copySubBuffer not yet implemented\n"; |
| 73 | } |
| 74 | |
| 75 | |
Jose Fonseca | c87689f | 2015-06-27 12:49:02 +0100 | [diff] [blame^] | 76 | void |
| 77 | Context::initialize(void) |
| 78 | { |
| 79 | assert(!initialized); |
José Fonseca | d1c301f | 2012-10-18 15:22:41 +0100 | [diff] [blame] | 80 | |
Jose Fonseca | c87689f | 2015-06-27 12:49:02 +0100 | [diff] [blame^] | 81 | extensions.getCurrentContextExtensions(profile); |
| 82 | |
| 83 | initialized = true; |
José Fonseca | 93f0e3f | 2011-10-09 16:16:18 +0100 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | |
| 87 | } /* namespace glws */ |