JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
GPUtexture.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
21 
22 //! Simple class to hold an OpenGL texture
23 /*! OpenGL textures are used to transfer image data from CPU to GPU and then allow the GPU to perform some processing on
24  the data. Processing is typically done by using "shader" GPU programs that transform the texture's pixel data and
25  render it, in some user-programmable way. */
27 {
28  public:
29  //! Constructor
30  /*! format should be as in glTexImage2D(), typically only GL_RGBA or GL_LUMINANCE are supported on embedded hardware
31  platforms. */
32  GPUtexture(GLsizei width, GLsizei height, GLenum format, bool createFramebuffer);
33 
34  //! Destructor, frees the texture in OpenGL
35  ~GPUtexture();
36 
37  //! Copy pixel data from memory location to the texture
38  /*! data should have been allocated by caller and have the correct size given the textute width, height, and
39  format. */
40  void setPixels(void const * data);
41 
42  //! Copy pixel data from the texture to already-allocated memory location
43  /*! data should have been allocated by caller and have the correct size given the textute width, height, and
44  format. */
45  void getPixels(void * data) const;
46 
47  GLsizei const Width;
48  GLsizei const Height;
49  GLenum const Format;
50  GLuint Id;
51  GLuint FramebufferId;
53 };
void getPixels(void *data) const
Copy pixel data from the texture to already-allocated memory location.
Definition: GPUtexture.C:84
~GPUtexture()
Destructor, frees the texture in OpenGL.
Definition: GPUtexture.C:56
GLsizei const Width
Definition: GPUtexture.H:47
Simple class to hold an OpenGL texture.
Definition: GPUtexture.H:26
GLsizei const Height
Definition: GPUtexture.H:48
void setPixels(void const *data)
Copy pixel data from memory location to the texture.
Definition: GPUtexture.C:64
GLuint RenderBufferId
Definition: GPUtexture.H:52
GLuint Id
Definition: GPUtexture.H:50
GLuint FramebufferId
Definition: GPUtexture.H:51
GLenum const Format
Definition: GPUtexture.H:49
GPUtexture(GLsizei width, GLsizei height, GLenum format, bool createFramebuffer)
Constructor.
Definition: GPUtexture.C:21