+ glPopAttrib();
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+}
+
+void exui_draw()
+{
+ if(!exsel_active) return;
+ if(!ui_font) return;
+
+ // render the 2D UI in a texture
+ push_render_target(rtarg);
+ glClearColor(0, 1, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ draw_2d_ui();
+ pop_render_target();
+
+ // place UI image into the scene
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ if(parent) {
+ glMultMatrixf(parent->get_matrix()[0]);
+ }
+ glTranslatef(pos.x, pos.y, pos.z);
+
+ glPushAttrib(GL_ENABLE_BIT);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_TEXTURE_2D);
+ glDepthMask(0);
+
+ bind_shader(0);
+ bind_texture(rtarg->texture());
+
+ glMatrixMode(GL_TEXTURE);
+ glLoadMatrixf(rtarg->texture_matrix()[0]);
+
+ glBegin(GL_QUADS);
+ glColor3f(1, 1, 1);
+ glTexCoord2f(0, 0); glVertex2f(-size.x / 2, -size.y / 2);
+ glTexCoord2f(1, 0); glVertex2f(size.x / 2, -size.y / 2);
+ glTexCoord2f(1, 1); glVertex2f(size.x / 2, size.y / 2);
+ glTexCoord2f(0, 1); glVertex2f(-size.x / 2, size.y / 2);
+ glEnd();
+
+ glLoadIdentity();
+