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
float b
Definition: color.h:30
void SetAlpha(const float alpha)
float r
Definition: color.h:28
std::string GetBasicFragmentShader()
Definition: shaders.cpp:33
static const float vertices[]
Definition: quad.cpp:39
std::vector< GLfloat > vertices_
GLuint CreateProgram(const char *vertex_source, const char *fragment_source)
Definition: util.cpp:75
#define LOGE(...)
std::string GetBasicVertexShader()
Definition: shaders.cpp:20
void SetColor(const Color &color)
std::vector< GLfloat > normals_
std::vector< GLushort > indices_
float g
Definition: color.h:29
void SetVertices(const std::vector< GLfloat > &vertices)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:37:28