PDA

View Full Version : CG + Render to texture



Trey
10-27-2003, 11:57 AM
Has anyone rendered to a win32 pbuffer with a CG fragment program in operation? My software crashes, for some reason. If there is even a single quad drawn to the pbuffer, it crashes somewhere in NVOGLNT.DLL. Unfortunately because of the way it crashes, I don't know if its crashing during the draw to the pbuffer, during the bind of the pbuffer as a texture, or during the draw of the pbuffer-turned-texture (just drawing a simple textured quad to the screen).

Is there some special setup to do w/pbuffers if you're going to be running cg through them? I haven't tried this with a non-cg shader so I don't know if the same crash problem occurs but.. basically if anyone has successfully rendered to a pbuffer with cg fragment shaders in operation, would you please say what attributes you use to create the pbuffer (and whatever else may be important)?

thanks,

trey

[This message has been edited by Trey (edited 10-27-2003).]

jra101
10-27-2003, 12:27 PM
Have you tried any of the Cg demos in the Cg Toolkit? Demos such as cg_ShinySprite, rgbe_blend, and fp_blend all use pbuffers with Cg and run without issues on all systems I've tested. You shouldn't need to do anything special to use a pbuffer with Cg.

If you send me the source for your application, I can take a look at it and file a driver bug if necessary.

Trey
10-27-2003, 03:58 PM
It is not easy to send the source - its a multithreaded multiple .dll application. OpenGL is initialized in one dll, OpenGl code executes in other dll's, CG code executes in still other dll's.. Is there anything I should know about the interaction between CG and OpenGL that isn't mentioned on every single one-file CG example out there on the net?

Does it matter that multiple .dll's are involved? Does the same .dll that initializes GL have to be the one that initializes CG?

Something else I noticed - any time my rendering window is closed and re-opened, all drawing done through cg stops working (black screen). cgIsContext() and cgIsProgram both return true for the context/program that were created prior to the window close/reopen. Strange. Stranger still, if I ignore the fact that cg says those handles are valid and re-create them, the rendering comes back. I don't know if this is related to the crash when rendering-to-texture but.. just thought it might help diagnose some larger problem.

trey