Menu

#36 problems with label engine

closed
Rendering (78)
5
2012-09-12
2007-06-25
No

Since the recent changes bringing renderOpaque, renderTransparant, overlays, etc., the LabelEngine triggers some bugs:

  1. When LabelEngine is active, the yellow sphere of the navigatetool is no longer transparent.

  2. When LabelEngine is active, only one of the molecules in a UnitCell gets rendered, the others are hidden. Moreover, the labelengine shows a transparency problem in that case.

I have added qDebug() to check the glPushMatrix/glPopMatrix calls in TextRenderer, and they look just fine. Therefore I suppose this might be a problem in the new "overlay" system (as LabelEngine is flagged as an overlay), which is why I assign this bug to you, Donald.

Discussion

  • James

    James - 2007-07-12

    Logged In: YES
    user_id=1317290
    Originator: NO

    I don't fully understand why this bug is occurring but I have found something that fixes the transparency problem.

    If you add the following code to Painter's begin(GLWidget *widget) method transparency works while the text renderer is enabled:

    if(d->textRenderer->isActive())
    {
    d->textRenderer->end();
    }

    Its probably a bit of a hacky fix but as I said, I don't understand the underlying code, I just stumbled across this while working on a new tool (more to come about that later). I assume someone else understands the code better and that this hacky fix might clue you in on what might be the underlying cause of the bug.

    Hope this helps,
    James & Ross

     
  • Donald Ephraim Curtis

    Logged In: YES
    user_id=1500648
    Originator: NO

    1. I have resolved this issue but it's not the greatest. At this time when TextRenderer is activated it sets up it's OpenGL environment to what i needs by pushing some stuff to the GL stack etc. However, to optimize we don't call ::end until we are ready to render another non-text item. However this causes problems because with our GLPainter::begin and GLPainter::end, we may draw text, change the environment, then draw a sphere, but here is the order of operations,

    TextRenderer::begin (push environment)
    TextRenderer::drawText
    glEnable(GL_BLEND) (new environment, say GL_BLEND)
    TextRenderer::end (pop OLD environment, no GL_BLEND)
    drawSphere()

    So to fix the error i simply call TextRenderer::end after calling ::drawText. This is bad because that means for each call to draw text we are re-setting up our environment. Our painting system is a little off-whack and I think we need to remedy it a bit more. One of the problems is that you can change the GL environment in the rendering code, but actually, things like enabling transparency, etc should be handled by the GLPainter. Also, we can easily make it so you can instanciate your own GLPainter and just use a shared static variable. shrug I have fixed the problem temp but please leave this PR open.

    1. There is no transparency problem, it's just that for EACH unitcell the labels get rendered on the initial molecules coordinates. Multiple calls end up looking like a box around the text but that's not the case. The problem is that when we go to render the unit cell we do a glTranslate which is all well and good except that text rendering is based off what the camera() object thinks is the modelview. So to remedy this we either need the camera to take into consideration the gltranslations (which is bad imo) or we need to make the camera have it's own model view stack and allow us to push and pop that bad boy. This would resolve the problem and i'll look into it more soon.
     
  • Donald Ephraim Curtis

    Logged In: YES
    user_id=1500648
    Originator: NO

    This has been resolved.

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).