View Full Version : OpenGL Overlay in Maya Viewports?
04-06-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!
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-06-2004, 11:26 PM
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-07-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?
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-07-2004, 05:24 PM
Okay, thanks Hugh!
04-10-2004, 03:32 PM
Would this page help at all?
01-17-2006, 11:00 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.