From: Sam Moore Date: Wed, 17 Sep 2014 16:10:57 +0000 (+0800) Subject: Make it run on motsugo X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=ae6af9f5e166d675a7139ec6dffee4ccab4347bc;p=ipdf%2Fcode.git Make it run on motsugo 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. --- diff --git a/src/screen.cpp b/src/screen.cpp index 7054fc7..e7d5d4b 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -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(); diff --git a/src/view.cpp b/src/view.cpp index 4e03136..b8e1019 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -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(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects); + if (UsingGPURendering()) + dynamic_cast(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects); m_render_dirty = false; }