What is wrong with my openGL draw code?


#1

Hello, what is wrong with my openGL code? I am suspecting it to be my push and popAttrib codes. As you can see, the wireframe is not showing at all when the object is covered behind the custom openGL locator. Any hints?

    glFT.glPushAttrib(OpenMayaRender.MGL_CURRENT_BIT)
    glFT.glPushAttrib(OpenMayaRender.MGL_ALL_ATTRIB_BITS)

some code is inserted here

    glFT.glPopAttrib()
    glFT.glPopAttrib()

the above draw codes are my settings for the glPushAttrib…

Thanks in advance…


#2

Actually i’ts not shown only for the objects that seem to me are polygons, the cone which looks like is a NURBS is showing fine… so I guess may be there is something else, connected to the way your graphics driver handles OGL transparency connected with the way Maya draws polygon edges…


#3

i see, i will have somebody else test the code on a quadro card. this is very irritating,specially for animators who would like to see the deformation. i do not want them to be turning off the locator’s visibility just so that they can see the deformation of the mesh. thank you very much

has anybody experienced the same thing?


#4

OK, now i have just discovered that even joints are also hidden when overlapped by the custom locators…


#5

Out of curiosity I created a transparent cube with red lambert shader and placed it in a similar location. (See attachment, hopefully it loaded correctly). It seems normal to me, so I’m curious if you could just try to do that on your machine to rule out the possibility that your problem was due to the locator drawing code.


#6

Hello, sir. I tried it out of curiosity, and it seems to be the same as your result…there is definitely something in my openGL draw codes that I did not understand fully, it could probably the MGL_BLEND, or that I have put lineWidth in the wrong order, I dont know…I will check my earlier codes to see where it started or if the problem was already there since the start. anyway, here is part of the code:

    view.beginGL()
    
    glFT.glPushAttrib(OpenMayaRender.MGL_CURRENT_BIT)
    glFT.glPushAttrib(OpenMayaRender.MGL_ALL_ATTRIB_BITS)
    
    glFT.glEnable(OpenMayaRender.MGL_BLEND)
        
    if status == OpenMayaUI.M3dView.kLead:
        glFT.glColor4f(0.0+color_RVal, 0.0+color_GVal, 0.0+color_BVal, 0.2)
    if status == OpenMayaUI.M3dView.kActive:
        glFT.glColor4f(0.0+color_RVal+.3, 0.0+color_GVal+.3, 0.0+color_BVal+.3, 0.2)
    if status == OpenMayaUI.M3dView.kDormant:
        glFT.glColor4f(0.0+color_RVal-.3, 0.0+color_GVal-.3, 0.0+color_BVal-.3, 0.4)
    
    glFT.glBegin(OpenMayaRender.MGL_QUADS)

#some openGL primitive draw codes#

    glFT.glEnd()
    
    glFT.glLineWidth(widthVal)

    glFT.glBegin(OpenMayaRender.MGL_LINE_STRIP)

#some openGL primitive draw codes#

    glFT.glEnd()
    
    glFT.glDisable(OpenMayaRender.MGL_BLEND)
    
    glFT.glPopAttrib()
    glFT.glPopAttrib()
    view.endGL()

#7

Straight from the OGL FAQ - try adding this lines (can’t test this right now):


  glEnable (GL_BLEND)
  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
  

of course you should convert them to python api calls :wink:


#8

amazing! thank you very much,i will try to read this later after my game of starcraft. i was looking for this reference but i cannot seem to find it using google. i learned the basics of OGL’s class,methods and functions through another site. thank you very much again.


#9

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.