View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

ReadBackCuda.h
Go to the documentation of this file.
1
11#ifndef READBACKCUDA_H
12#define READBACKCUDA_H
13
14#ifdef __APPLE__
15#include <OpenGL/gl.h>
16#else
17#include <GL/gl.h>
18#endif
19
20#include "export.h"
21
22struct cudaGraphicsResource;
23typedef unsigned char uchar;
24
25namespace vistle {
26
29public:
32
33 bool init();
34 bool isInitialized() const;
35
36 bool readpixels(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits, GLint buf,
37 GLenum type = GL_UNSIGNED_BYTE);
38 bool readpixelsyuv(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits, GLint buf,
39 int subx, int suby);
40 bool readdepthquant(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits,
41 GLint buf, GLenum type = GL_UNSIGNED_BYTE);
42
43 static bool s_error;
44private:
45 bool initPbo(size_t raw, size_t compressed);
46 bool pbo2cuda(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLint buf, GLenum type,
47 uchar **img);
48 GLuint pboName;
49 cudaGraphicsResource *imgRes;
50 uchar *outImg;
51 size_t imgSize;
52 size_t compSize;
53 bool m_initialized;
54};
55
56#ifndef HAVE_CUDA
58{}
60{}
62{
63 return false;
64}
66{
67 return false;
68}
69bool ReadBackCuda::readpixels(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits,
70 GLint buf, GLenum type)
71{
72 return false;
73}
74bool ReadBackCuda::readpixelsyuv(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits,
75 GLint buf, int subx, int suby)
76{
77 return false;
78}
79bool ReadBackCuda::readdepthquant(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits,
80 GLint buf, GLenum type)
81{
82 return false;
83}
84#endif
85
86} // namespace vistle
87#endif
unsigned char uchar
Definition: ReadBackCuda.h:22
fast framebuffer read-back using CUDA
Definition: ReadBackCuda.h:28
bool init()
Definition: ReadBackCuda.h:61
bool isInitialized() const
Definition: ReadBackCuda.h:65
bool readpixels(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits, GLint buf, GLenum type=GL_UNSIGNED_BYTE)
Definition: ReadBackCuda.h:69
ReadBackCuda()
Definition: ReadBackCuda.h:57
bool readdepthquant(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits, GLint buf, GLenum type=GL_UNSIGNED_BYTE)
Definition: ReadBackCuda.h:79
bool readpixelsyuv(GLint x, GLint y, GLint w, GLint pitch, GLint h, GLenum format, int ps, GLubyte *bits, GLint buf, int subx, int suby)
Definition: ReadBackCuda.h:74
static bool s_error
whether a CUDA error occurred
Definition: ReadBackCuda.h:43
~ReadBackCuda()
Definition: ReadBackCuda.h:59
unsigned char uchar
Definition: depthquant.cpp:16
#define V_RHREXPORT
Definition: export.h:9