
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am using the Maya API in C++. I would like to do something very simple, but I cannot manage to make it work: draw a line in Maya, using openGL.
In my class "MyClass", which inheritate from "MPxContext", I redefine the function "doDrag". And I would like to draw a line in this function.
A version that works is the following one:
MStatus MyClass::doDrag(MEvent &event, MHWRender::MUIDrawManager &drawMgr, const MHWRender::MFrameContext& context)
{
MColor red(1.0f, 0.0f, 0.0f);
drawMgr.beginDrawable();
drawMgr.setColor(red);
drawMgr.line(MPoint(0, 0, 0), MPoint(10, 10, 10));
drawMgr.endDrawable();
return MS::kSuccess;
}
But I would like to use OpenGL instead, because later I will have to do more complicated stuff. So if something like that would work, it would be great:
MStatus MyClass::doDrag(MEvent &event, MHWRender::MUIDrawManager &drawMgr, const MHWRender::MFrameContext& context)
{
drawMgr.beginDrawable();
glBegin(GL_LINES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3d(0.0, 0.0, 0.0);
glVertex3d(10.0, 10.0, 10.0);
glEnd();
drawMgr.endDrawable();
return MS::kSuccess;
}
Does anyone has an idea how to do that? I spent hours searching a solution on the web, I really need your help.
Thanks a lot.
Solved! Go to Solution.