render to buffer instead of window

Thanks. I can get the camera to render to the buffer correctly now, with stereo rendering. It was looking nice, so I tried to apply a shader to see if i could get that working. Since I still have to learn more about shaders I just tried to apply a really simple shader to see if i could get that to work. I tried the example CG shader on the ‘Shader Basics’ page in the documentation. It turned the entire screen white. I tested the shader on a bunch of other sample programs, and the same thing happened every time. I figured that the shader was just weird.
I borrowed bamdastard’s shader from this thread:
[The Oculus Rift Side-by-side-stereo FisheyeLens and Filters)
More specifically, his github:
github.com/ubernaut/OculusRift- … ld-Panda3d
I modified his shader to no longer make things black and white, and then I tested it with some example programs and they worked fine, but upon testing it with my code, the left eye in the buffer goes completely gray, the right eye in the buffer renders normally, and the main screen had bizarre artifacts like having all textures missing, only half of the panda renders, and the ground flashes a bunch of shades of green.

I tried 2 different approaches, each with the same result:
1st try:

loadPrcFileData('', 'win-size 1280 800\nshow-buffers #t')
...
myShader = Shader.load("myfilter.sha", Shader.SL_Cg)
render.set_shader(myShader)
mybuffer = base.win.makeTextureBuffer("oculus", 2048, 1024)
mybuffer.setSideBySideStereo(True)
mybuffer.setSort(-100)
disp = mybuffer.makeDisplayRegion()
disp.setCamera(base.cam)
base.camLens.setInterocularDistance(5)
tex = mybuffer.getTexture()
render.setShader(Shader.load("myfilter.sha"))
render.setShaderInput("tex", tex)

2nd try:

loadPrcFileData('', 'win-size 1280 800\nshow-buffers #t')
...
ShowBase.__init__(self)
mybuffer = base.win.makeTextureBuffer("oculus", 2048, 1024)
mybuffer.setSort(-100)
camn1 = Camera('camleft')
camnp1 = NodePath(camn1)
camnp1.reparentTo(camera)
camnp1.setX(-.1)
camn2 = Camera('camright')
camnp2 = NodePath(camn2)
camnp2.reparentTo(camera)
camnp2.setX(.1)
disp1 = mybuffer.makeDisplayRegion(0,.5,0,1)
disp1.setCamera(camnp1)
disp2 = mybuffer.makeDisplayRegion(.5,1,0,1)
disp2.setCamera(camnp2)
tex = mybuffer.getTexture()
render.setShader(Shader.load("myfilter.sha"))
render.setShaderInput("tex", tex)

I also tried using the Filtermanager class, but it ended up with the same problem that bamdastard ran into.
How do I apply a simple shader with stereo rendering?