VP2.0 / raw opengl

VP2.0 / raw opengl

Anonymous
Not applicable
975 Views
2 Replies
Message 1 of 3

VP2.0 / raw opengl

Anonymous
Not applicable

Hi there,

 

I'm in the process of porting over a vp1.0 viewport renderer we had for Maya to use vp2.0, and am running into a few issues. Since our viewport renderer is using quite a few raw opengl calls (its a hidden line renderer), the best approach seemed to be to create a new MRenderOverride, with a pipeline such as:

 

  1. MSceneRender Operation to clear the background, draw grids and other unsupported geo types
  2. Custom MUserRenderOperation to render tris/polys with raw OGL calls
  3. MHudRender
  4. MPresentTarget

However, whatever i try to do, the OGL state seems to be acting very odd in the MUserRenderOperation's execute() function.

 

For example, transforms don't seem to be working at all. The MUserRenderOperation sets the proper modelview matrix of the node, yet the object shows up at "random" locations - based on what the last thing the previous MSceneRender had to draw and where.

If (for troubleshooting) i set the MSceneRender to also draw the objects and select a node, my drawing will show up on top of that selected object. If nothing is selected, the drawing will appear at the origin. If only the grid is drawn and MSceneRender is not used to render anything, my drawing will show up at the edge of the grid... In fact, whatever i set in the modelview matrix seems to be ignored completely and has no effect on where my drawn object appears.

Line styles and colors are also ignored, i always just get a thick blue line for all draws in wireframe mode, lighting calls are also disabled, i always get 'shaded' lines in smooth shading mode.

 

It feels like either MUserRenderOperation doesn't support certain OGL calls, or i'm simply missing some obvious initialization calls. Sadly none of the devkit examples contain a sample that uses MUserRenderOperation for the actual drawing independently of MSceneRender, using OGL.

 

Any help & pointers would be appreciated,

cheers,

Laszlo Sebo

0 Likes
976 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

By default Maya runs in the OpenGL 'Core Profile', which disallows calls to any deprecated OpenGL API, which includes most of the immediate mode calls.

 

Go into Windows -> Settings and Preferences -> Preferences. Select 'Display' from the list on the left. On the right, scroll down to the bottom and set 'Rendering Engine' to 'OpenGL Legacy'. Save your settings and restart Maya. If some or all of your problems are resolved then you're using some deprecated OpenGL API. To find out which of your calls are causing problems, reset Maya's rendering engine to 'OpenGL Core Profile' then modify your code to call glGetError() after all of your GL calls and check to see which ones are failing.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks Joe, good tip, i'll check how the profile change affects behavior. I think i'm missing something obvious somewhere, because the calls i'm using are very basic (color changes, transforms etc).

0 Likes