YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
TextureBuffer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef YARP_OVRHEADSET_TEXTUREBUFFER_H
20#define YARP_OVRHEADSET_TEXTUREBUFFER_H
21
22#include <GL/glew.h>
23#include <OVR_Math.h>
24#include <mutex>
25#include <yarp/sig/Image.h>
26
27
29{
30public:
31
32 void fromImage(ovrSession inSession, const yarp::sig::Image& img, double alpha = 1.0);
33
34 //only for single thread contexts
36
37 //multithread safe
38 TextureBuffer(int w, int h, int eye, ovrSession session);
39
41
42 void resize(size_t w = 0, size_t h = 0);
43 void update(const yarp::sig::Image& img);
44 void update();
45 void lock();
46 void unlock();
47
48 ovrSession session;
49 ovrTextureSwapChain textureSwapChain;
51
52 size_t width;
53 size_t height;
54 unsigned int components;
55 unsigned int padding;
56 size_t rowSize;
57 size_t bufferSize;
58 double alpha;
59
60 ovrPosef eyePose;
61
62 GLuint *pboIds;
63
64 GLubyte* ptr;
66 std::mutex mutex;
67
68 unsigned int missingFrames;
69
70 size_t imageWidth;
72
73private:
74
75 bool initialized;
76 bool singleThread;
77
78 void createTextureAndBuffers();
79 void deleteTextureAndBuffers();
80 int eye;
81};
82
83#endif // YARP_OVRHEADSET_TEXTUREBUFFER_H
ovrSession session
std::mutex mutex
ovrTextureSwapChain textureSwapChain
void fromImage(ovrSession inSession, const yarp::sig::Image &img, double alpha=1.0)
ovrPosef eyePose
void resize(size_t w=0, size_t h=0)
GLubyte * ptr
unsigned int components
GLuint * pboIds
unsigned int missingFrames
unsigned int padding
Base class for storing images.
Definition Image.h:79