View Full Version : OpenGL Overlay in Maya Viewports?
04 April 2004, 09:19 PM
I was wondering if anyone could suggest the best way of overlaying an OpenGL buffer over standard Maya viewports? (probably using API)>
I'm reasonably sure this is possible (I noticed the MPxGlBuffer class in the API Docs), but could do with some tips as to how to use this in the overlay process?
If possible, perhaps someone could write a simple command which creates a GL overlay, and (say) renders a coloured triangle (or something simple) to the viewport overlay?
Thanks in advance for your help!
04 April 2004, 10:19 PM
I'll have to check some code when I get into work tomorrow, but yeah, it's pretty easy....
I hacked around with someone's code to get it to draw black bars around the frame to frame it properly....
I seem to remember that it was as easy as making GL calls....
I'll check the code and write up some examples...
04 April 2004, 11:26 PM
04 April 2004, 10:25 AM
Okay... a brief outline for how to draw to the viewport:
This assumes a member variable: 'bool drawState' that is initialised to false in the constructor....
void myNode::draw(M3dView & view, const MDagPath & path, M3dView::DisplayStyle style, M3dView::DisplayStatus status)
double width = view.portWidth();
double height = view.portHeight();
gluOrtho2D(0.0, (GLdouble)width, 0.0, (GLdouble)height);
// Do any OpenGL drawing here....
drawState = true;
04 April 2004, 04:44 PM
So, is myNode::draw a function which I define? And what's 'myNode'? ... and where do I call this function from?
04 April 2004, 05:20 PM
Ahh - you will want to look into Maya API programming....
In this case, myNode is derived from MPxLocatorNode
draw() is called automatically when the node needs to be drawn...
04 April 2004, 05:24 PM
Okay, thanks Hugh!
04 April 2004, 03:32 PM
Would this page help at all?
01 January 2006, 12:00 AM
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.