Vertex shader on raspberry pi2/openGL ES 2

Hi,
i try to render a quad with MVP-Matrix and an offset.


    precision mediump float;       
    uniform mat4 u_mvpMatrix;      
    uniform vec2 u_offset;         
    attribute vec4 a_position;    
    attribute vec2 a_texCoord;     
    varying vec2 v_texCoord;       
    void main()                    
    {                              
       gl_Position   =a_position;  
       gl_Position.x-=u_offset.x;  
       gl_Position  *=u_mvpMatrix; 
       v_texCoord = a_texCoord;    
    }                              

run the opengl-code on X11 + SDL it looks right.

under raspberry pi2 without x the quad didn’t apear.

but when i remove the MVP-Matrix multiplacation:


    precision mediump float;       
    uniform mat4 u_mvpMatrix;      
    uniform vec2 u_offset;         
    attribute vec4 a_position;    
    attribute vec2 a_texCoord;     
    varying vec2 v_texCoord;       
    void main()                    
    {                              
       gl_Position   =a_position;  
       gl_Position.x-=u_offset.x;  
       //gl_Position  *=u_mvpMatrix; 
       v_texCoord = a_texCoord;    
    }                              

the quad appears.

without the offset, with MVP-Matrix the quad appears, too.


    precision mediump float;       
    uniform mat4 u_mvpMatrix;      
    uniform vec2 u_offset;         
    attribute vec4 a_position;    
    attribute vec2 a_texCoord;     
    varying vec2 v_texCoord;       
    void main()                    
    {                              
       gl_Position   =a_position;  
       //gl_Position.x-=u_offset.x;  
       gl_Position  *=u_mvpMatrix; 
       v_texCoord = a_texCoord;    
    }                              

why can’t i use MVP-Matrix mulltiplication and offset together on my raspberry pi2?

p.s.: my draw-function:


 glUseProgram ( userData->programObject );
  
  glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
  glUniform2f(userData->offsetLoc, 0.5, 0.0);
glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT, GL_FALSE, 0, userData->vertices );
  glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, userData->texCoord );

    glDrawArrays  ( GL_TRIANGLE_STRIP, 0, 4);

Are you checking that the shader compiled and linked successfully? Are you checking for errors after glUseProgram() and after the glDrawArrays() call?

no errors from glGetShaderiv or glGetProgramiv

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