View Full Version : MayaAPI question...

07 July 2005, 08:44 PM
Is there a command you can use in MayaAPI to write to the framebuffer? I'm trying to write scenedata to a framebuffer so I can retireve it later during the draw cycle....

Tried using OpenGL command glDrawBuffer(GLenum mode), but my compiler dosen't seem to recognize it....*leafing through header files*

Robert Bateman
08 August 2005, 09:46 PM
Tried using OpenGL command glDrawBuffer(GLenum mode), but my compiler dosen't seem to recognize it....*leafing through header files*

well, it's a new feature in the Maya7.0 API (testing the beta at the moment). Shame it doesn't work though (hopefully thats just a beta problem). I'd suggest waiting for 7 to come out because there is lots of new HW shading stuff in there which should sort out a lot of in-evitable hacking.

The other question is do you really need to write the data to the frame buffer? could you use a texture or p-buffer instead?

08 August 2005, 11:28 PM
Actually, I'm trying to create my own framebuffer and then write to it...kinda like in the nvidia demo "simple_framebuffer_object". I'm trying to use openGL calls in my class, but it's kinda weird...I have the calls to create my framebuffer looking like this....


////initialize framebuffers here...
glGenFramebuffersEXT(1, &fb); //generate 1 framebuffer
glGenTextures(1, &tex); //generate a texture
glGenRenderbuffersEXT(1, &depth_rb); //make a renderbuffer for the framebuffer

//more junk after here that dosen't matter if the above dosen't run!


It compiles fine...but when I try it in Maya, all I get back is a small error message. I'm thinking it's a header file, but I'm kinda in the dark here...:(

08 August 2005, 08:01 AM
How are you getting the function pointers to those functions?

Maya's M3dView.h includes GL/gl.h itself, so maybe your include path ordering is picking up the wrong header version.

You could try compiling something that will print out the opengl version and see if that looks funky. If you get less than 2.0.0 then something's gone awry.

Robert Bateman
08 August 2005, 04:39 PM
are you doing this on linux?

08 August 2005, 04:46 PM
are you doing this on linux?

Unfortunetly no. I wish I was. I heard errors like this are easier to troubleshoot on Linux.

I'll try including M3dView as a header file...but I think glGenFramebuffers is located in Glut.h. I know the program will spit out openGL, cause I drew a couple polys to the scene just to check to see if that was the problem.

I have some time today, so I'm going to strip it down and put in the minimum libraries and headers...see if I can isolate the problem.

BTW, Rob...thanks for those pages on MayaAPI...I haven't looked through all the examples yet but they've been very helpful.

Thanks for your suggestions. I'll keep u posted.

08 August 2005, 10:24 PM
Hmmm...stripped everthing out and now I seem to be getting a repeat error...about an unresolved external symbol..

I seem to be getting these a there a good way to troubleshoot when you have an error in MayaAPI like this? Or any of the weird erros that come up, such as the one I had before....

Here's another good one...soemtimes I'll end up getting NULL as an undeclared is that crap?

PS - Rob...I hoe that avatar ur using isn't's kinda freaky looking....

Robert Bateman
08 August 2005, 08:59 AM
if it's a new openGL extension you may get errors - remember to use wglGetProcAddress to initialise all extension functions (or just use a lib like glew to do it all for you).

No the avatar isn't me, it's the drummer from lightning bolt - the photo is from the a gig they did in the electric ballroom in london (though i was there)

08 August 2005, 06:49 PM
Oh, that makes sense. Maya only supports openGL 1.1, right? I'll look into it. Thanks!

CGTalk Moderation
08 August 2005, 06:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.