Commit Graph

90 Commits

Author SHA1 Message Date
Maciej Suminski cdab6cfdbe Draw the origin marker in OpenGL with shaders GAL. 2013-06-24 16:02:18 +02:00
Maciej Suminski e1aa6f7e84 Grid settings apply to GAL based rendering. 2013-06-24 14:33:02 +02:00
Maciej Suminski d114d9e386 Passing COLOR4D parameter using constant reference. 2013-06-24 10:21:34 +02:00
Maciej Suminski bf7d383066 Changed atan2() to VECTOR2D::Angle() 2013-06-21 09:01:40 +02:00
Maciej Suminski fdc52d933a Fixed some minor rendering issues, mostyl for shaderless OpenGL GAL. 2013-06-20 16:37:21 +02:00
Maciej Suminski 316f7309a1 Bug fixes:
- VBO_CONTAINER::allocate() was returning wrong value in case of error
- framelimiter had wrong formula for computing destined period between frames
- removed _padding field from VBO_VERTEX, as it was not speeding up, but wasting memory
2013-06-20 13:16:12 +02:00
Maciej Suminski 585aeb7f91 Moved fields containing information about currently used color, shader and transformation for vertices from VBO_ITEM to VBO_CONTAINER (OPENGL_GAL). 2013-06-19 10:50:46 +02:00
Maciej Suminski c4e42f46a9 Removed unnecessary functions from VBO_VERTEX. 2013-06-18 17:53:12 +02:00
Maciej Suminski 8a89e160ed Added VBO_CONTAINER as a faster storage for vertices (OPENGL_GAL), tuned for exchanging data with GPU.
Removed a few unnecessary variables and fields from OPENGL_GAL.
Added function GAL::ClearCache() for freeing memory used by cached items.
Fixed a few memory leaks (tesselator, PAINTER's settings & VIEW_ITEM's groups).
Changed a few functions into inlines.
2013-06-18 16:20:29 +02:00
Maciej Suminski 5c405a6f40 Removed some debug messages. 2013-06-06 11:54:37 +02:00
Maciej Suminski 03b5d6125b Removed indices storing from VBO_ITEM as they are always consecutive numbers. Removed storing pointers to VBO_ITEMs that have to be drawn - instead they are memcpied to mapped GPU memory.
Some functions of VBO_ITEM became inline.
2013-06-06 11:52:39 +02:00
Maciej Suminski 85a2aee79c Introducing shaders.
Shader's parameters are stored in VBO_ITEM. Changed VBO_ITEM data structure. Added UseShader() function for selecting shader for a given VBO_ITEM.
Added one main vertex & fragment shader program to be used for with all kinds of items (type of shader is selected using attributes that are stored in VBO). Currently available shaders are: at-least-1px-width line, filled circle and stroked circle.
Removed unnecessary param (aDepthOffset) from a few functions (OPENGL_GAL::drawSemiCircle(), OPENGL_GAL::drawLineCap()). Removed function OPENGL_GAL::DrawRoundedSegment(). Changed some asserts to debug info or error log.
2013-06-04 15:58:53 +02:00
Maciej Suminski 31b722f9d3 Added tesselation of polygons for VBO based rendering (OpenGL GAL). 2013-05-27 09:37:49 +02:00
Maciej Suminski 7dec942ef7 Different way of rendering groups (with a single DrawElements call) in OpenGL GAL. 2013-05-16 18:43:25 +02:00
Maciej Suminski b58cc107e6 Changed functions for adding vertices in VBO mode to make code easier to read and understand. 2013-05-16 14:47:34 +02:00
Maciej Suminski 0177590699 Faster way of caching items for OPENGL GAL. 2013-05-16 10:35:16 +02:00
Maciej Suminski 787fe28fd0 Added functionality for transformation of VBO vertices, extended functions like translate, rotate, scale using glm library. Removed D() macro, as it was not used, but in conflict with glm library. Added VBO_ITEMs for circles, semicircles. Now almost everything is drawn using VBO (besides polygons and grid). 2013-05-15 16:48:10 +02:00
Maciej Suminski 66d257f620 Drawing tracks using PushVertices, added some comments, fixed formatting. 2013-05-14 10:38:25 +02:00
Maciej Suminski 918231795b Added possibility of adding multiple vertices to VBO_ITEM at once 2013-05-13 11:14:35 +02:00
Maciej Suminski 9f71172437 Fixed Cairo issues and some possible memory leaks 2013-05-13 10:55:35 +02:00
Maciej Suminski 7b426e8103 Fixed memleak, removed excessive recaching, still there is a problem with Cairo caching 2013-05-10 16:05:40 +02:00
Maciej Suminski fb65f5d1ae Improved recaching (all items when a board is loaded), still needs some fixing (mem leak). 2013-04-30 17:55:24 +02:00
Maciej Suminski 56aabe20bc Introduction of VBO. Now only tracks are rendered in a very simple way. 2013-04-30 15:59:32 +02:00
Maciej Suminski af8b256a00 Changed non-shader primitives to GL_TRIANGLES. 2013-04-25 18:30:53 +02:00
Maciej Suminski 1e0f1b39b0 Fixed color issue for stroked fonts with OpenGL backend and caching turned on. 2013-04-25 10:00:25 +02:00
Maciej Suminski b6ec124ceb Removed BeginLayer and EndLayer functions. Resolved Cairo layers drawing problem in a different way. 2013-04-24 09:48:34 +02:00
Maciej Suminski d9b489d471 Changed view control settings to KiCad default (panning, zooming, etc.) 2013-04-23 12:07:14 +02:00
Maciej Suminski 3289c6c305 Modified shaders' source path. 2013-04-23 09:52:51 +02:00
Maciej Suminski 07545ba49c Fixed wheel scroll event on Windows 2013-04-22 11:08:02 +02:00
Maciej Suminski 55f7a99d1b Cairo now renders layers properly (colors are not saturated after layer composition), but slower. 2013-04-19 18:19:50 +02:00
Maciej Suminski 98addf78b4 Some cleanup. 2013-04-19 18:19:20 +02:00
Maciej Suminski ec9e283d34 Fixed resize issue (moved GAL panel into pane).
Tidied up event handlers.
2013-04-18 11:20:19 +02:00
Maciej Suminski 869505a659 Added const(..)& in GAL methods' parameters and change iterators to constant iterators. 2013-04-17 12:48:37 +02:00
Maciej Suminski 895d265603 Added GAL::DrawSegment for drawing rounded segments (used for drawing tracks). 2013-04-17 12:38:00 +02:00
Maciej Suminski 698bc0cdac Cleanup 2013-04-16 11:16:27 +02:00
Maciej Suminski 63c2af4fa4 Tesselation error fix.
Added missing callback function (combine callback).
2013-04-12 10:37:06 +02:00
Wayne Stambaugh 3ff7ddbea7 wxWidgets 2.8.12 build fix 2013-04-12 09:30:18 +02:00
Maciej Suminski 157cbc2f68 Fixed drawing of circles in certain circumstances using OpenGL. 2013-04-09 16:12:16 +02:00
Maciej Suminski 221cb6d5b2 Fixed bug of displaying stroked rectangles on wrong layer depth. 2013-04-05 15:10:58 +02:00
Maciej Suminski c20de314cc Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
    - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
    - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
    - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
    - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
    - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
    - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
    - STROKE_FONT - Implements stroke font drawing using GAL methods.
                          
Most important changes to Kicad original code:
    * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
    * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
    * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
    * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
    * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
    * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
    * Removed tools/class_painter.h, as now it is extended and included in source code.
                         
Build changes:
    * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
    * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
    * GAL-related code is compiled into a static library (common/libgal).
    * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
                            
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 08:54:03 +02:00