OpenGL problems in conduit

Are you writing custom shader code or are there some setup routines that ModuleWorks requires in order to get things configured correctly? I’m not familiar with the ModuleWorks API for getting things to draw.

Hi Steve, I’m writng my own shader.
In order to understand I created a project without ModuleWorks that draw a simple line on screen.

This is my shader:

#version 330

layout (location = 0) in vec3 aVertex;

precision mediump float;
uniform mat4 uMVP;

out vec3 vertex;

void main() {
  	vec4 pos = uMVP * vec4(aVertex, 1.0f);
  	vertex = aVertex;
  	gl_Position = pos;

In my rhino conduit post draw event I have this:

case CSupportChannels::SC_POSTDRAWOBJECTS:

if (!bCallOnceOpenGL)	{
	bCallOnceOpenGL = true;

	glGenVertexArrays(1, &VertexArrayID);

	// Create and compile my GLSL program from the shaders
	programID = LoadShaders("SimpleTransform.vertexshader", "SingleColor.fragmentshader");

	// Get a handle for our "MVP" uniform
	MatrixID = glGetUniformLocation(programID, "MVP");

	// Generate 1 buffer, put the resulting identifier in vertexbuffer
	glGenBuffers(1, &vertexbuffer);
	// The following commands will talk about our 'vertexbuffer' buffer
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
	// Give our vertices to OpenGL.
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_DYNAMIC_DRAW);

	CRhinoDisplayEngine* p_engine = in_pipeline.Engine();

	// model view matrix
	ON_Xform worldToCamera = p_engine->WorldToCamera();
	// projection matrix
	ON_Xform cameraToClip = p_engine->CameraToClip();

	glm::mat4 world_to_camera(1.0f);
	world_to_camera[0] = glm::vec4(worldToCamera[0][0], worldToCamera[1][0], worldToCamera[2][0], worldToCamera[3][0]);
	world_to_camera[1] = glm::vec4(worldToCamera[0][1], worldToCamera[1][1], worldToCamera[2][1], worldToCamera[3][1]);
	world_to_camera[2] = glm::vec4(worldToCamera[0][2], worldToCamera[1][2], worldToCamera[2][2], worldToCamera[3][2]);
	world_to_camera[3] = glm::vec4(worldToCamera[0][3], worldToCamera[1][3], worldToCamera[2][3], worldToCamera[3][3]);
	glm::mat4 projection(1.0f); 
	projection[0] = glm::vec4(cameraToClip[0][0], cameraToClip[1][0], cameraToClip[2][0], cameraToClip[3][0]);
	projection[1] = glm::vec4(cameraToClip[0][1], cameraToClip[1][1], cameraToClip[2][1], cameraToClip[3][1]);
	projection[2] = glm::vec4(cameraToClip[0][2], cameraToClip[1][2], cameraToClip[2][2], cameraToClip[3][2]);
	projection[3] = glm::vec4(cameraToClip[0][3], cameraToClip[1][3], cameraToClip[2][3], cameraToClip[3][3]);
	glm::mat4 MVP = projection * world_to_camera; 

	// Use our shader

	// Send our transformation to the currently bound shader in the "MVP" uniform
	glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);

	// 1rst attribute buffer : vertices
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
		0,                  // attribute. No particular reason for 0, but must match the layout in the shader.
		3,                  // size
		GL_FLOAT,           // type
		GL_FALSE,           // normalized?
		0,                  // stride
		(void*)0            // array buffer offset
	// Draw the triangle !
	glDrawArrays(GL_LINES, 0, 2); 


The g_vertex_buffer_data contains a simple line with 2 vertices declared like this:

static const GLfloat g_vertex_buffer_data[] = {
	0.0f, 0.0f, 0.0f,
	 0.5f, 0.5f, 0.0f

When I run my plugIn on screen I see the line in the correct position but if I move the mouse the line remain always in the same position. I suppose that the problem is in my MVP matrix.