I’m running in circles trying to make my vertex/shader do anything.
I have render to texture and PBO download mechanisms ready. But I after app runs output texture is empty (well, almost - while creating I set all its values to 64 and after passing through shader there are 4 pixels with 0 value in the middle).
Fragment shader is just a plain dummy, i.e:
#version 150
in vec2 fragmentTexCoord;
out uvec3 fragColor;
void main(void)
{
fragColor = uvec3(8,16,24);
}
Vertex is just pass-through:
#version 150
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
in vec4 vertex;
in vec2 texCoord;
out vec2 fragmentTexCoord;
void main(void)
{
fragmentTexCoord = texCoord;
gl_Position = projectionMatrix*modelViewMatrix*vertex;
}
All input variables are passed to shader correctly (checked with gDEbugger). Output texture is defined as GL_RGB/GL_UNSIGNED_BYTE and I read it with
glReadPixels( 0, 0, imageWidth, imageHeight, GL_RGB, GL_UNSIGNED_BYTE, 0 );
GLubyte* bufferData = (GLubyte*)glMapBuffer( GL_PIXEL_PACK_BUFFER, GL_READ_ONLY );
Shader is called by glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0), after binding buffer with xyIndices = { 0, 1, 2, 1, 3, 2 }.
glGetError does not catch anything and based on gDEbugger state during drawing is ok (correct FBO and texture bound, drawbuffer set to output texture).
Where is the mistake, where do I err?