0

Say I use GLKit in iOS for OpenGL rendering. And I want to draw two different objects.

So I created two shader programs. And when I draw each object separated, it works well. But if I combine these two program in a single frame draw. The first object doesn`t show.

- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect {

    // draw first object
    glUseProgram(firstProgram);
    drawArrays(...);

    // draw second object
    glUseProgram(secondProgram);
    drawArrays(...);
}

And no matter how I change the drawing order, the first drawn object does not show at screen.

Can anybody help me?

BDL
  • 21,052
  • 22
  • 49
  • 55
vanney
  • 1
  • 1
  • There are too many ways in which your object might not show here just going by the order in which you draw them. Please share some more of your code, most notably your shader code, as well as the code in which you set up your buffers. – Bartvbl Feb 14 '17 at 09:11
  • Ensure all the calls relevant to the shader are called after the glUseProgram. That includes setting all the attributes and uniforms on it. – Matic Oblak Feb 14 '17 at 14:36

0 Answers0