ViewPort -> FrameBuffer -> Nifty?

I already have a class that converts a Texture2D to a NiftyImage, and the Texture2D is coming from a FrameBuffer which has everything set up properly. I know it’s working right because I can change the background color in the ViewPort instance and see that effect. However, no model shows up on the scene. I attached a node as the scene for the viewport, to which I attached a box as a test model. I gave the box both unshaded and lit materials (with a light in the scene as well) and I couldn’t see anything. The box I used as a test was 100x100x100 units, and I manually placed the Camera at 300, 300, 300 and set it looking at the origin. I call scene.updateGeometricState() before I get the texture output from the FrameBuffer. I’m thinking right now that it’s a problem with the fact that the image isn’t constantly being updated in Nifty. So, I’m here to ask: How would I get the model to show, or the viewport to update?

So if you don’t involve nifty then it works right? ie: you can put the texture on some shape and see it fine as in the render to texture example?

@pspeed Nevermind. Once again, as soon as I ask the question I figure it out. No matter how much messing with it I do, I somehow fix the problem right after asking the question. Thanks anyway, you’ve been a huge help recently. I realize I’m asking a TON of questions and it’s probably pretty irritating but thanks for helping out.

So what was the problem?

The problem was the Camera setup. First I didn’t even specify the frustums, then when I did I specified them very very badly. After that I was placing the camera at places where it couldn’t see the weapon anyway. I felt pretty stupid when I figured that out. xD

Anyway, the reason I needed this was for my custom weapon screen, which is now fully functional. For pistols, you can change the Top, Mechanics, and Handle of the weapon. Each different part affects accuracy, rate of fire, and many other traits. On top of that, you can customize the main, secondary, and detail colors for each part seperately, giving the weapon a very unique look per player.

I had a LOT of fun with this. First the coloring of the textures, then figuring out how to get the detail texture loaded in, then adding saving/loading, then getting the rendered weapon into Nifty, then making the colors customizable through Nifty. All I have to say is, I’m rather disappointed in the framerate I get with only 3 popups open in Nifty. The regular screen FPS is about 300 on an HD4850. After 1 popup, it’s down to 180. With 2, it drops to 110ish. With 3, it’s down to barely over 60-70. Either way, it works and it’s fun.

Thanks to all of the people that helped me with this, I will be posting a video of it at some point tomorrow after the last few bugs are worked out.

1 Like