Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
app
android
jni
background_renderer.h
Go to the documentation of this file.
1
/*
2
* Copyright 2018 Google Inc. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef C_ARCORE_AUGMENTED_IMAGE_BACKGROUND_RENDERER_H_
18
#define C_ARCORE_AUGMENTED_IMAGE_BACKGROUND_RENDERER_H_
19
20
#include <GLES2/gl2.h>
21
#include <GLES2/gl2ext.h>
22
#include <cstdlib>
23
24
#include "
util.h
"
25
26
static
const
GLfloat
BackgroundRenderer_kVertices
[] = {
27
-1.0f, -1.0f, +1.0f, -1.0f, -1.0f, +1.0f, +1.0f, +1.0f,
28
};
29
30
// This class renders the passthrough camera image into the OpenGL frame.
31
class
BackgroundRenderer
{
32
public
:
33
// Positions of the quad vertices in clip space (X, Y).
34
35
static
constexpr
int
kNumVertices
= 4;
36
37
public
:
38
BackgroundRenderer
() =
default
;
39
~BackgroundRenderer
() =
default
;
40
41
// Sets up OpenGL state. Must be called on the OpenGL thread and before any
42
// other methods below.
43
void
InitializeGlContent
(
GLuint
textureId);
44
45
// Draws the background image. This methods must be called for every ArFrame
46
// returned by ArSession_update() to catch display geometry change events.
47
void
Draw
(
const
float
* transformed_uvs);
48
49
private
:
50
51
GLuint
shader_program_
;
52
GLuint
texture_id_
;
53
54
GLuint
attribute_vertices_
;
55
GLuint
attribute_uvs_
;
56
};
57
58
#endif // C_ARCORE_AUGMENTED_IMAGE_BACKGROUND_RENDERER_H_
BackgroundRenderer::texture_id_
GLuint texture_id_
Definition:
background_renderer.h:52
BackgroundRenderer
Definition:
background_renderer.h:31
BackgroundRenderer::~BackgroundRenderer
~BackgroundRenderer()=default
BackgroundRenderer::BackgroundRenderer
BackgroundRenderer()=default
BackgroundRenderer::kNumVertices
static constexpr int kNumVertices
Definition:
background_renderer.h:35
GLuint
unsigned int GLuint
Definition:
dummy.cpp:78
BackgroundRenderer_kVertices
static const GLfloat BackgroundRenderer_kVertices[]
Definition:
background_renderer.h:26
BackgroundRenderer::attribute_vertices_
GLuint attribute_vertices_
Definition:
background_renderer.h:54
BackgroundRenderer::InitializeGlContent
void InitializeGlContent(GLuint textureId)
Definition:
background_renderer.cc:52
util.h
BackgroundRenderer::attribute_uvs_
GLuint attribute_uvs_
Definition:
background_renderer.h:55
BackgroundRenderer::Draw
void Draw(const float *transformed_uvs)
Definition:
background_renderer.cc:66
BackgroundRenderer::shader_program_
GLuint shader_program_
Definition:
background_renderer.h:51
rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:34:58