PDA

View Full Version : Maya API - view change when Maya panel layout changes?


Pixelclown
06-04-2009, 07:27 PM
Hi,

I have a context class which draws an opengl line-strip over my persp viewport with overlay drawing. But every time my panel layout changes the drawing doesn't work any more for the original view but for the others (top, side etc...). But if I enlarge those the drawing doesn't work there as well. It seems to me that the current view is not quite the right or something. Here is the code for the drawing procedure:


// get the current viewport
view = M3dView::active3dView();
int portWidth = view.portWidth( &stat );
int portHeight = view.portHeight( &stat );

event.getPosition( viewPosX, viewPosY );

// set the draw start to the end of the old cycle
drawPosXStart = drawPosXEnd;
drawPosYStart = drawPosYEnd;

// calculate the draw end point
drawPosXEnd = ( viewPosX / (double(portWidth) * 0.5) ) - 1;
drawPosYEnd = ( viewPosY / (double(portHeight) * 0.5) ) - 1;

// draw the curve
view.beginGL();
view.beginOverlayDrawing();
glColor3f(1.0, 0.0, 0.0);
glLineWidth(4);
glBegin(GL_LINE_STRIP);
glVertex2f( GLfloat(drawPosXStart), GLfloat(drawPosYStart));
glVertex2f( GLfloat(drawPosXEnd), GLfloat(drawPosYEnd));
glEnd();
glLineWidth(1);
view.endOverlayDrawing();
view.endGL();


Maybe someone knows the problem, has a solution or just a suggestion. Everything is welcome, thanks!
Jonas

CGTalk Moderation
06-04-2009, 07:27 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.