Again about bgl in bge.

Hi.

Is it real, to draw something inside (not in front) scene, using bgl? i need draw trajectory, but i can`t use drawLine(), because it not working with overlay scene. (blender game engine)

Thanks, and sorry for my English.


You could try using objects as drawlines.
drawline_object.blend (400 KB)

This works for me, and the result is pretty fast.

You can decorate the objects as you like, the result is much better looking than drawline and it can be used in overlay scenes, as long as you convert the co-ordinates.

Yes, I have already did it (but not so elegant).But I am afraid such a number of objects. In any case, thank you very much!

Heres a function you can use to draw lines with bgl:


<b>def </b><b>draw_line</b>(points, size, color, lineType=<b>0</b>):

    glColor4f(*color)
    glLineWidth(size)

    <b>if </b>lineType == <b>1</b>:
        glLineStipple(<b>4</b>, <b>0x5555</b>)
        glEnable(GL_LINE_STIPPLE)
        glColor4f(*color)

    glBegin(GL_LINE_STRIP)
    <b>for </b>coord <b>in </b>points:
        glVertex3f(*coord)
    glEnd()

    <b>if </b>lineType == <b>1</b>:
        glDisable(GL_LINE_STIPPLE)
        glEnable(GL_BLEND)

You just pass it a list of positions, the thickness of the line and the color of the line. You can also pass in a 1 as the very last parameter to get a stippled line. Hope that helps!