OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include <stdio.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include <GL/osmesa.h> |
| 12 |
| 13 #include "OSMesaContextHolder.h" |
| 14 |
| 15 OSMesaContextHolder::OSMesaContextHolder() { |
| 16 fOSMesaContext = OSMesaCreateContextExt(0x1, 0, 0, 0, nullptr); |
| 17 if (!fOSMesaContext) { |
| 18 fputs("Unable to get OSMesa context.\n", stderr); |
| 19 } else { |
| 20 static uint32_t buffer[16 * 16]; |
| 21 OSMesaMakeCurrent(fOSMesaContext, &buffer, 0x1401, 16, 16); |
| 22 } |
| 23 } |
| 24 |
| 25 OSMesaContextHolder::~OSMesaContextHolder() { |
| 26 if (fOSMesaContext) { |
| 27 OSMesaDestroyContext(fOSMesaContext); |
| 28 } |
| 29 } |
| 30 |
OLD | NEW |