How do you create a 2D texture array using multiple views from the model? I saw the example at Texture Arrays but it’s loading the textures from a file. I want to dynamically create the textures, where each one is a different camera angle of the model, and then I want to pass the 2D texture array into a shader. It would be more convienent using the 2d sampler array rather than passing in a bunch of 2d sampler/texture objects into the shader.
I can’t find very many 2D texture array examples on the internet so any help would be greatly appreciated!
Am I correct in thinking that the problem here is that of how to render to texture?
If so, then I believe that it may be done something like this:
bufferWidth = 256 # Or whatever size you intend
bufferHeight = 256 # Or whatever size you intend
surfaceBuffer = base.win.makeTextureBuffer("surface buffer", bufferWidth, bufferHeight)
surfaceCamera = base.makeCamera2d(surfaceBuffer)
# Set up the camera as desired, such as parenting it to render or some other NodePath.
texture = surfaceBuffer.getTexture()