drawable_object.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 
18 #include "tango-gl/shaders.h"
19 
20 namespace tango_gl {
21 
26  if (!shader_program_) {
27  LOGE("Could not create program.");
28  }
29  uniform_mvp_mat_ = glGetUniformLocation(shader_program_, "mvp");
30  attrib_vertices_ = glGetAttribLocation(shader_program_, "vertex");
31  uniform_color_ = glGetUniformLocation(shader_program_, "color");
32 }
33 
35  if (shader_program_) {
36  glDeleteShader(shader_program_);
37  }
38 }
39 
40 void DrawableObject::SetColor(float red, float green, float blue) {
41  red_ = red;
42  green_ = green;
43  blue_ = blue;
44 }
45 void DrawableObject::SetColor(const Color& color) {
46  SetColor(color.r, color.g, color.b);
47 }
48 
49 void DrawableObject::SetAlpha(const float alpha) { alpha_ = alpha; }
50 
51 void DrawableObject::SetVertices(const std::vector<GLfloat>& vertices) {
53 }
54 
55 void DrawableObject::SetVertices(const std::vector<GLfloat>& vertices,
56  const std::vector<GLushort>& indices) {
58  indices_ = indices;
59 }
60 
61 void DrawableObject::SetVertices(const std::vector<GLfloat>& vertices,
62  const std::vector<GLfloat>& normals) {
64  normals_ = normals;
65 }
66 } // namespace tango_gl
tango_gl::DrawableObject::SetAlpha
void SetAlpha(const float alpha)
Definition: drawable_object.cpp:49
tango_gl::DrawableObject::alpha_
float alpha_
Definition: drawable_object.h:50
tango_gl::DrawableObject::attrib_vertices_
GLuint attrib_vertices_
Definition: drawable_object.h:59
tango_gl::DrawableObject::red_
float red_
Definition: drawable_object.h:47
tango_gl::DrawableObject::SetVertices
void SetVertices(const std::vector< GLfloat > &vertices)
Definition: drawable_object.cpp:51
alpha
RealScalar alpha
tango_gl::DrawableObject::SetColor
void SetColor(const Color &color)
Definition: drawable_object.cpp:45
tango_gl::shaders::GetBasicFragmentShader
std::string GetBasicFragmentShader()
Definition: shaders.cpp:33
tango_gl::vertices
static const float vertices[]
Definition: quad.cpp:39
tango_gl::DrawableObject::normals_
std::vector< GLfloat > normals_
Definition: drawable_object.h:53
tango_gl::DrawableObject::blue_
float blue_
Definition: drawable_object.h:49
tango_gl::Color::g
float g
Definition: color.h:29
tango_gl::DrawableObject::green_
float green_
Definition: drawable_object.h:48
tango_gl::Color::r
float r
Definition: color.h:28
LOGE
#define LOGE(...)
Definition: tango-gl/include/tango-gl/util.h:61
indices
indices
shaders.h
tango_gl::util::CreateProgram
GLuint CreateProgram(const char *vertex_source, const char *fragment_source)
Definition: util.cpp:75
tango_gl::DrawableObject::uniform_color_
GLuint uniform_color_
Definition: drawable_object.h:57
drawable_object.h
tango_gl::DrawableObject::DeleteGlResources
void DeleteGlResources()
Definition: drawable_object.cpp:34
tango_gl::DrawableObject::indices_
std::vector< GLushort > indices_
Definition: drawable_object.h:51
tango_gl::Color
Definition: color.h:21
tango_gl::DrawableObject::vertices_
std::vector< GLfloat > vertices_
Definition: drawable_object.h:52
c_str
const char * c_str(Args &&...args)
tango_gl::DrawableObject::SetShader
void SetShader()
Definition: drawable_object.cpp:22
tango_gl::DrawableObject::uniform_mvp_mat_
GLuint uniform_mvp_mat_
Definition: drawable_object.h:58
tango_gl::Color::b
float b
Definition: color.h:30
tango_gl
Definition: axis.cpp:20
tango_gl::DrawableObject::shader_program_
GLuint shader_program_
Definition: drawable_object.h:56
tango_gl::shaders::GetBasicVertexShader
std::string GetBasicVertexShader()
Definition: shaders.cpp:20


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:09