summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Rodin <mrodin@de.adit-jv.com>2018-11-15 10:17:06 +0100
committerMichael Rodin <mrodin@de.adit-jv.com>2018-11-27 16:51:39 +0100
commit9a808a85c79dd689d343d64fc1d7ab37384aec55 (patch)
tree6cc4fc89873281690d593563168d869b214f2b4b
parent14cc000dfe21fc1a73e98d1a05143eb0e12df694 (diff)
downloadwayland-ivi-extension-9a808a85c79dd689d343d64fc1d7ab37384aec55.tar.gz
EGLWLMockNavigation: class Car: modify rendering function
Modify the rendering function of the Car class to support alternative rendering using textures. Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com>
-rw-r--r--ivi-layermanagement-examples/EGLWLMockNavigation/src/Car.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/src/Car.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/Car.cpp
index c77cdb3..e9ee516 100644
--- a/ivi-layermanagement-examples/EGLWLMockNavigation/src/Car.cpp
+++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/Car.cpp
@@ -94,9 +94,14 @@ Car::Car(vec3f position, vec3f size, vec4f color, ShaderTexture* shader, Texture
void Car::render()
{
- m_pShader->use(&m_position, &m_color);
-
// draw
+ if (withTexture) {
+ GLuint textureID = texture->getId();
+ ((ShaderTexture *)m_pShader)->use(&m_position, textureID);
+ ((ShaderTexture *)m_pShader)->setTexCoords(m_texCoords);
+ } else {
+ m_pShader->use(&m_position, &m_color);
+ }
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, m_vertex);
glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, &m_index);