Make it run on motsugo
authorSam Moore <[email protected]>
Wed, 17 Sep 2014 16:10:57 +0000 (00:10 +0800)
committerSam Moore <[email protected]>
Wed, 17 Sep 2014 16:10:57 +0000 (00:10 +0800)
Motsugo has a fake X11 server, which allegedly supports OpenGL extensions.
But it doesn't quite work and things tend to segfault.

It works for CPU rendering though.

src/screen.cpp
src/view.cpp

index 7054fc7..e7d5d4b 100644 (file)
@@ -52,17 +52,17 @@ Screen::Screen(bool visible)
        // Why is this so horribly broken?
        if (ogl_IsVersionGEQ(3,0))
        {
-               Fatal("We require OpenGL 3.1, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion());
+               Error("We require OpenGL 3.1, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion());
        }
 
        if (!SDL_GL_ExtensionSupported("GL_ARB_shading_language_420pack"))
        {
-               Fatal("Your system does not support the ARB_shading_language_420pack extension, which is required.");
+               Error("Your system does not support the ARB_shading_language_420pack extension, which is required.");
        }
 
        if (!SDL_GL_ExtensionSupported("GL_ARB_explicit_attrib_location"))
        {
-               Fatal("Your system does not support the ARB_explicit_attrib_location extension, which is required.");
+               Error("Your system does not support the ARB_explicit_attrib_location extension, which is required.");
        }
 
        m_frame_begin_time = SDL_GetPerformanceCounter();
index 4e03136..b8e1019 100644 (file)
@@ -364,7 +364,10 @@ void View::RenderRange(int width, int height, unsigned first_obj, unsigned last_
                PrepareRender();
 
        if (m_buffer_dirty || m_bounds_dirty || !m_lazy_rendering) // object bounds have changed
-               UpdateObjBoundsVBO(first_obj, last_obj);
+       {
+               if (m_use_gpu_rendering)
+                       UpdateObjBoundsVBO(first_obj, last_obj);
+       }
 
        if (m_use_gpu_transform)
        {
@@ -464,10 +467,13 @@ void View::PrepareRender()
 {
        Debug("Recreate buffers with %u objects", m_document.ObjectCount());
        // Prepare bounds vbo
-       m_bounds_ubo.Invalidate();
-       m_bounds_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
-       m_bounds_ubo.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
-       m_bounds_ubo.SetName("m_bounds_ubo: Screen bounds.");
+       if (UsingGPURendering())
+       {
+               m_bounds_ubo.Invalidate();
+               m_bounds_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
+               m_bounds_ubo.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
+               m_bounds_ubo.SetName("m_bounds_ubo: Screen bounds.");
+       }
        
        // Instead of having each ObjectRenderer go through the whole document
        //  we initialise them, go through the document once adding to the appropriate Renderers
@@ -490,12 +496,14 @@ void View::PrepareRender()
                //Debug("Object of type %d", type);
        }
 
+
        // Finish the buffers
        for (unsigned i = 0; i < m_object_renderers.size(); ++i)
        {
                m_object_renderers[i]->FinaliseBuffers();
        }
-       dynamic_cast<BezierRenderer*>(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects);
+       if (UsingGPURendering())
+               dynamic_cast<BezierRenderer*>(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects);
        m_render_dirty = false;
 }
 

UCC git Repository :: git.ucc.asn.au