Sending Texture to the Fragment shader when using BridgeEngineMetalShaderDelegate


#1

Hi Guys I am new to Metal shaders and excuse me if this is a very silly question. I was able to do this using OpenGL as follows:

  • (void) prepareWithProjection:(const float*)projection
    modelview:(const float*)modelView
    depthBufferTexture:(const GLuint)depthTexture
    cameraImageTexture:(const GLuint)cameraTexture {

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, _textureOpenGL);
    glUniform1i (self.wallTexture, GL_TEXTURE0 - GL_TEXTURE0);

and on the shader I am able to access it as

uniform sampler2D wallTexture;

But now on Metal when using the BridgeEngineMetalShaderDelegate I don’t seem to have access to the MTLRenderCommandEncoder which I feel is needed to access the texture as follows:

[CommandEncoder setFragmentTexture:_texture atIndex:AAPLTextureIndexBaseColor];//(from apples sample)