Render Layouts in OpenGL

1
Gurmeet Singh
8/13/2019 3:20 PM

Hi all,

We're trying to setup drawings renderer using OpenGL. The model layout renders perfectly, however we can't get other layouts to display. Here is the code we use

(model is DxfModel passed to method)
(layout is DxfLayout to set to render)

C# Code:
            Graphics graphics = new Graphics();

            if (layout != null && layout != model.ModelLayout)
            {
                foreach (var vp in layout.Viewports)
                {
                    if (!vp.ModelSpaceVisible)
                        continue;

                    DrawContext.Surface layoutDrawContext =
                        new DrawContext.Surface.ModelToPaperSpace(
                            model,
                            layout,
                            glGraphics.GraphicsConfig,
                            vp,
                            Matrix4D.Identity,
                            glGraphics.CharTriangulationCache
                            );
                    model.Draw(layoutDrawContext, graphics, graphics);
                    layoutDrawContext.Dispose();
                }
            }
            else
            {
                DrawContext.Surface drawContext =
                    new DrawContext.Surface.ModelSpace(
                        model,
                        glGraphics.GraphicsConfig,
                        Matrix4D.Identity,
                        glGraphics.CharTriangulationCache);
                model.Draw(drawContext, graphics, graphics);
                drawContext.Dispose();
            }

            ProcessedGraphics processedGraphics = new ProcessedGraphics();
            processedGraphics.Process(glGraphics.GraphicsConfig, graphics);

            glGraphics.ClearDrawables();
            glGraphics.CreateDrawables(processedGraphics);

Wout
8/16/2019 3:12 PM

Hi,

CadLib's OpenGL rendering indeed does not support rendering paper space layouts. It is intended only for 3D viewing of model space.

- Wout

1