Matrix to Shader, mvp

I started to program OpenGL. I try to use a shader to transform my matrix. My shader is:

#version 330 core

layout(location = 0) in vec3 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 texCoords;

uniform mat4 m_pos_view;
uniform mat4 m_pos_projection;
uniform mat4 m_pos_model;

void main(void)
gl_Position = vec4(position, 1.0);
gl_Position = m_pos_projection * m_pos_view * m_pos_model * gl_Position;

and I use it in my .cpp

GLuint positionViewID, positionProjectionID, positionModelID;

positionViewID = m_program->attributeLocation("m_pos_view");
positionProjectionID = m_program->attributeLocation("m_pos_projection");
positionModelID = m_program->attributeLocation("m_pos_model");


m_program->setAttributeArray("m_pos_view", getMView().constData(), 0,3);
m_program->setAttributeArray("m_pos_projection", getMProjection().constData(), 0,3);

size_t i;
for (showFloor ? i=0 : i=1; i < m_models.size(); ++i)
    m_program->setAttributeArray("m_pos_model", m_models[i]->getTransformations().constData(), 0,3);

there is no error. But it doesn’t draw the .obj… What must I do to make it work?
I hope you can help me. Thanks

Your terminology is off. The matrices aren’t attribute arrays, they’re uniforms. Attribute arrays are position, normal and texCoords.

It’s really difficult to comment further because of the way you’ve wrapped everything in your own classes. How can we say whether your GL calls are right or wrong? We can’t even see your GL calls.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.