27 #include <Eigen/Dense> 40 "out vec4 out_Color;\n" 43 " out_Color = color;\n" 49 "in vec4 in_Position;\n" 51 "uniform mat4 modelMatrix;\n" 52 "uniform mat4 viewMatrix;\n" 53 "uniform mat4 projectionMatrix;\n" 54 "uniform vec4 in_Color;\n" 57 " mat4 modelViewMatrix = viewMatrix * modelMatrix;\n" 58 " gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n" 59 " color = in_Color;\n" 87 color << 1.0, 0.48, 0.16, 1.0;
113 glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
123 vector <string> attribs;
128 glEnable(GL_DEPTH_TEST);
132 glDisable(GL_DEPTH_TEST);
149 vector<Eigen::Vector4f> vert;
150 vector<Eigen::Vector2f> texCoord;
151 vector<GLuint> elementsVertices;
153 vert.push_back ( Eigen::Vector4f( -0.5, -0.5, 0.0, 1.0) );
154 vert.push_back ( Eigen::Vector4f( 0.5, -0.5, 0.0, 1.0) );
155 vert.push_back ( Eigen::Vector4f( 0.5, 0.5, 0.0, 1.0) );
156 vert.push_back ( Eigen::Vector4f( -0.5, 0.5, 0.0, 1.0) );
158 elementsVertices.push_back(0);
159 elementsVertices.push_back(1);
160 elementsVertices.push_back(2);
161 elementsVertices.push_back(2);
162 elementsVertices.push_back(3);
163 elementsVertices.push_back(0);
165 texCoord.push_back ( Eigen::Vector2f(0.0, 0.0) );
166 texCoord.push_back ( Eigen::Vector2f(1.0, 0.0) );
167 texCoord.push_back ( Eigen::Vector2f(1.0, 1.0) );
168 texCoord.push_back ( Eigen::Vector2f(0.0, 1.0) );
void getViewMatrix(GLdouble *matrix)
Return the modelview matrix as a GLdouble array.
Definition: camera.hpp:126
A simple unitary quad.
Definition: quad.hpp:66
void getProjectionMatrix(GLdouble *matrix)
Return the projection matrix as a GLdouble array.
Definition: camera.hpp:142
Definition: bufferobject.hpp:34
void setShaderName(string name)
Sets the shader name, very useful for debugging.
Definition: shader.hpp:329
A Shader object represents one GLSL program.
Definition: shader.hpp:45
~Quad()
Default destructor.
Definition: quad.hpp:95
void render(const Tucano::Camera &camera, const Tucano::Camera &light)
Render quad.
Definition: quad.hpp:110
Quad(void)
Default Constructor.
Definition: quad.hpp:82
void getActiveAttributes(vector< string > &attribs)
Detaches and deletes the shaders and the shader program.
Definition: shader.hpp:1205
void errorCheckFunc(std::string file, int line, std::string message="")
GL error check method.
Definition: misc.hpp:53
void initializeFromStrings(string in_vertex_code, string in_fragment_code, string in_geometry_code="", string in_tessellation_evaluation_code="", string in_tessellation_control_code="")
Initializes shader directly from string, no files.
Definition: shader.hpp:589
Eigen::Vector4f color
Sphere color.
Definition: quad.hpp:74
void loadIndices(vector< GLuint > &ind)
Load indices into indices array.
Definition: mesh.hpp:448
const string quad_vertex_code
Default vertex shader for rendering quad.
Definition: quad.hpp:47
const string quad_fragment_code
Default fragment shader for rendering quad.
Definition: quad.hpp:37
void createGeometry(void)
Creates the quad geometry with associated tex coords.
Definition: quad.hpp:147
void setDefaultAttribLocations(void)
Sets default attribute locations. vertex coords -> location 0 normals -> location 1 colors -> locatio...
Definition: mesh.hpp:474
void resetModelMatrix(void)
Resets the model matrix.
Definition: model.hpp:159
void unbind(void)
Disables the shader program.
Definition: shader.hpp:1184
Tucano::Shader quad_shader
Shader to render sphere.
Definition: quad.hpp:71
Eigen::Affine3f model_matrix
Model matrix, holds information about the models location and orientation.
Definition: model.hpp:21
virtual void unbindBuffers(void)
Unbinds all buffers.
Definition: mesh.hpp:702
void loadVertices(vector< Eigen::Vector4f > &vert)
Load vertices (x,y,z,w) and creates appropriate vertex attribute. The default attribute name is "in_P...
Definition: mesh.hpp:312
void setColor(const Eigen::Vector4f &c)
Sets the quad color.
Definition: quad.hpp:102
void bind(void)
Enables the shader program for usage.
Definition: shader.hpp:1176
void loadTexCoords(vector< Eigen::Vector2f > &tex, bool normalize=false)
Load tex coords (u,v) as a vertex attribute. Optionally normalizes coords in range [0...
Definition: mesh.hpp:397
virtual void renderElements(void)
Call the draw method for rendering triangles. This method requires that a index buffer has been creat...
Definition: mesh.hpp:726
virtual void bindBuffers(void)
Binds all buffers.
Definition: mesh.hpp:677
A common Mesh, usually containing triagles or points.
Definition: mesh.hpp:194
Defines an abstract camera with a projection and view matrices.
Definition: camera.hpp:37
void setAttributeLocation(Shader *shader)
Automatically sets the attribute locations for a given Shader.
Definition: mesh.hpp:541
Eigen::Vector4f getViewport(void) const
Returns the viewport coordinates.
Definition: camera.hpp:246
void setUniform(GLint location, GLint a, GLint b, GLint c, GLint d)
Sets an uniform integer 4D vector (ivec4) given a location and the vector values. ...
Definition: shader.hpp:1258