We have moved to https://dokuwiki.librecad.org/

Lots of content was already moved to the new wiki, but there is still work to do. If you want to contribute, please register a new account at https://dokuwiki.librecad.org/

This wiki will be kept for a while to keep search engine results valid. Moved sites may be deleted here in future.

Difference between revisions of "GSoC 2019 Dev Log"

From LibreCAD wiki
Jump to: navigation, search
(Week 12)
(Week 13)
Line 594: Line 594:
 
'''August 19th'''
 
'''August 19th'''
  
>  
+
> Working on cmake to create cpp file which will save the absolute paths of RESOURCES during compilation
 +
 
 +
> Accesing RESOURCES(SHADER and FONT) paths from that file and generate the resources runtime
 +
 
 +
> Now No need to put shaders/font files absolute paths manually, All Working OK
  
 
'''August 20th'''
 
'''August 20th'''

Revision as of 18:31, 19 August 2019

 Community Bonding Period (May 6th - May 27th) 

> During Community Bonding Period i continued doing more research work for the LibreCAD OpenGL rendering project.

> Linked a partial implemented OpenGL painter with the LibreCAD 3 which uses BufferObjects for rendering

> Implemented basic facilities like pan, zoom

> I started with finding the connections of rendering functions of drawables,drawentities etc.

> Implement and connect the drawables like grid,cursor, origin pointer etc.

> Found connection of tempentities , drawentities

> Tried and check ways of Text Rendering with OpenGL painter( basic ttf type / MSDF type )

> Found place for the caching the saved entities.

> Implemented few more functions in opengl painter (analogous to Cairo) which does Matrix/Vector/Coordinate manipulations(manually with GLM)

> Deciding the basic complete layout of OpenGL painter and found possible ways of complete implementation : https://github.com/sckorpio/LibreCAD_3

> I created blog for the development log on LibreCAD blog : https://blog.librecad.org/tag/google-summer-of-code-gsoc-2019/

TODO:

> Finalize and implement basic gl_entity class which could hold all type of possible entities and render them

> Create a gl_pack class which could hold a number of gl_entities to cache and render complex entities (like dimensions)

> Decide which text rendering should be used (basic ttf or MSDF or both..)

> little research work left on gradient rendering and line patterns and continuing work to complete the painter implementation

 Coding Period Phase 1 (May 27th - June 28th) 

Week 1

May 27th

> I started with reviewing the partially implemented opengl painter and used only one painter instance with each viewer (which was earlier 3 instances for background,foreground and document using cairo)

> making the painter instance creation more robust starting from UI

May 28th

> Started with testing the drawables rendering with opengl painter , drawables doest require caching

> Connect the signal(drawevent) and slot(grid's draw() code) , Tested the grid drawing calls with the opengl painter

TODO: Debug later -- the zooming out of grid misses some lines

May 29th

> Connect the lccursor with drawevent signal , Tested the cursor drawing calls with the opengl painter

May 30th

> Connected the tempentities with the signal, Now the entities (during drawing/editing process) can also be rendered

> Connected the dragpoints with the signal, Now the entities can be edited using dragpoints

> Checked the editing options correct working like- translate, rotate, scale , copy etc

May 31st

> Found some errors in cursor during high zoom, debugging the lccursor

> Trying to get the perfect viewport with error free pan and zoom so that later the new entities can be seen while testing

June 1st

> Separated the translate,rotate,scale matrix from the model,view,projection matrix in Renderer

> Fixed the clipping of grid while zooming out also speed up the cursor at high zoom.

June 2nd

> Implemented the reset_transformation function

> Now the zoom is perfect working , zooming into the cursor with stability

> In Cairo all matrix are 3*3 so manually implemented all with 4*4 matrices in OpenGL Renderer Class

Week 2

June 3rd

> Found need of Isolated Transformations

> Need of context saving and restoring which stores the transformation matrices, linewidth, color etc

June 4th

> Created a structure which can save the context attributes like glm::mat , linewidth , color

> Created Stack Implementation for the saving and restoring of context

> Implemented the painters save() and restore() methods, now isolated transformations working correctly

June 5th

> Joined the lcvdimensions with the render calls, dimensions all working fine now

> Temporary Implemented the rendering of empty quads in place of text , just to check the saving and restoring of context. Working fine

June 6th

> Implemented the Rotation Matrix manipulation methods

> The Text Quads are now getting rendered with correct angle, working OK

> Now the basic operations of OpenGL painter are functioning correct ( without caching mechanism )

June 7th

> Starting with Caching mechanism

> Reviewing all draw() codes once again to design and finalize the gl_entity class

June 8th

> Found some possible errors which can clash with opengl painter

> Fix those draw codes to work correctly with painter

June 9th

> BREAK

Week 3

June 10th

> Found possible issue with multiple matrix transformations, Need to remember the transformations after caching

> Redesigned the painter matrix manipulations with single CTM and MVP

> Shifting the model matrix to caching painter

June 11th

> Understanding the kernel and storage part of librecad

> Found the Signal and slot connections of events between the document and documentcanvas

June 12th

> Found error with the remove entity signal emitting code ( of paperviewer )

> Fixed some function in storage manager to solve the issue , now entities are rendering OK in paperviewer tab also

June 13th

> Found the duplication of entities storing in entity container of document canvas

> Tried to make a new cached container with key = id of entity

June 14th

> Found some issue with the draw code of paperbackground

> Fixed the missing stroke() call , now the paper background is rendering correct ( Temporary as a white rectangle )

June 15th

> Reviewed all draw() codes and planned the structure of caching , things which are constant and which are variable

> Updated the gl_entity class to hold attributes need in caching

June 16th

> BREAK

Week 4

June 17th

> Discussed the different ways of caching with mentors and decided to implement a particular

> Started with making a separate class named caching painter which will only cache things without any rendering

June 18th

> Started making other classes like Cacher, gl_pack etc which will work in caching

> Added few more functions in main painter and documentcanvas for making caching more abstracted

June 19th

> Continuing working on these classes

June 20th

> Almost completed with the gl_entity, gl_pack, cacher , cacherpainter classes

> Now able to run the draw() codes through caching painter

> Able to cache the gl_packs and implemented the required query functions regarding caching

June 21st

> Ran Caching with basic entities lines , circle , arc etc and with dimensions ( leaving text) all working OK

> Fixed caching issues , all caching working OK

> Found some signal issues in PAPER viewer while MODEL viewer is all OK

June 22nd

> BREAK

June 23rd

> Fixed the entity storage issue and signals

> Changed the entityDrawItem map in document canvas with key as entity's ID

> Cleaned the Code till now

Week 5

June 24th

> Started with updating the gl_entity to hold the attributes of text rendering

> Making some temporary functions to render direct quads

June 25th

> Merged the old commits from the original repo

> Resolved the issues during compiling and finally updating and cleaning the repo till worked done now

> Submitted the first evaluation form

June 26th

> Got the Feedback on the caching mechanism implemented

> Discussed with mentor how to separate the classes for different types

June 27th

> Started with separating the draw() code from renderer to entity class

> Redesigning the structure of classes to work accordingly

June 28th

> Tried Compiling more than one shader working OK

> One Shader for the basic shape drawing the second one for rendering the gradients

 Coding Period Phase 2 (June 29th - July 26th) 

June 29th

> Discussed more with Mentor to make the entities more abstracted and robust

> Avoiding the conditional statements and now implementing the draw logic of different entity in their respective classes

June 30th

> First time successfully separated the draw code , working OK

> Now working on making a Base class of entity which others will implement

Week 6

July 1st

> Completed the Gradient rendering ( Gradient Entity , functions etc )

> Implemented the Linear_Gradient calculation function using vector geometry math

> Finally got the correct gradient background and paper background result all working OK

July 2nd

> Found out some issues with the coordinate system

> Solved the issue , Finally the coordinate system is corrected , rendering correct , gradient correct , DXF files opening correctly

July 3rd

> Started learning about the shader based linepattern, dashes

July 4th

> Searched some articles on how to render linepattern and dashes

> Learning how to design the fragment shader to render dashes

July 5th

> Implemented few simple linepattern ( consist of dash and gap only ) roughly in seperate codes

> Debugging how the LC3 stores the line pattern in vector

July 6th

> BREAK

July 7th

> Discussion with mentor on how to implement the linepattern based on the research work done yet

> Got a bug reported by mentor , discussing with him and trying to debug.

Week 7

July 8th

> Still finding Some concrete method for line pattern which is optimal and feasible ( It should have less CPU computations and support caching also )

> Trying Some GLSL Shaders to get results

July 9th

> Found out a mathematical way by which CPU computation is required only once , trying to implement this method with GLSL

> First Time successfully rendered correct line patterns , Now this looks integrable with LC3 and could support caching also

July 10th

> Working on GLSL shaders to render more line patterns

July 11th

> Trying to save the line pattern data as an array of ratios representing dash and gap

> The pattern with even elements is to repeated directly while the one with odd elements gets flipped every time.

July 12th

> made new GLSL Shaders to render thick , continous , seamless dashed lines with miter at edges

> Tessellate line with 2 triangles using Geometry Shader and then rendering or discarding fragments according to dash/gap in fragment shader

> Now have basic , gradient , thickline , dashed thickline etc as new shaders

> Next is to start with revamping code which can send data in correct format accordingly to shader type

July 13th

> made new commit , tried to solve the gradient background issue

> Gradient Repo seems working all ok, Current repo work fine on different machines too

July 14th

> BREAK

Week 8

July 15th

> Finding ways to integrate the thick line and line pattern shaders with codebase

July 16th

> finalize the shaders to be used with librecad opengl module for linepatterns

> Reviewing how much and where the changes would be required for integrating the shaders

July 17th

> Got reported by mentor about the OpenGL Debugger with Qt

> Found a number of gl calls which are depreciated and replaced then with latest compatible calls

> Still there is the issue of gradient background freeing memory

July 18th

> On AMD GPUs the repo works perfect , now checking on NVIDIA GPU

> Got the bug on NVIDIA systems, trying to seperate glDelete*** calls from destructors of CPU side objects

> Fixed the bug and got it reviewed by the mentor, Finally its done!!!

July 19th

> Back to work on Dash-Gap and linepatterns

> Add uniform arrays in shader files to pass variable dash-gap data

> Updated shader class to access the dash-gap uniforms

July 20th

> Raw testing the dash pattern shader with capped joints lines , working Ok

July 21st

> Also checked the Mitter Joints line / linepattern shader

> Discussing with mentor regarding the selection , integration of which type(CAP or MITTER) to be used

Week 9

July 22nd

> Also trying to find ways to integrate the MITTER joints thicklines/linepattern shaders

> Getting more complicated with GL_LINE_ADJACENCY , need to change functions to manipulate index data in Renderer class

July 23rd

> Making algorithms which can support jumping of pen also

> Multiple shapes within one VBO and which could still support GL_LINE_STRIP_ADJACENCY

July 24th

> Created a algorithm which can fulfill all the need and which is performance and memory efficient

> Coding it roughly in separate codes and testing, working OK

July 25th

> Now time is to Integrate this method and revamp the codebase of LC3

> Finally revamped the Code!!!

> Now it can support jumping pen , thick lines, linepatterns all working OK

July 26th

> Now working on shader class so that it can support geometry shader , parse it and compile it ( if present )

 Coding Period Phase 3 (July 27th - Aug 19th) 

July 27th

> Updated Shader class

> Now its parsing and compiling Shader files having geometry shader also

July 28th

> Working on how and when to render Thicklines

> Making/Updating Functions to apply entity properties and pick the correct shader required

> Joined the thickline shader to work

> Finally rendered Thicklines having MITTER joints, all working OK

Week 10

July 29th

> Now Starting with modifying codebase to render dash patterns

> Modified vertex data to store length of path

> Added new attributes in shape_entity to have properties of dashed patterns

July 30th

> Added new shader to render dashed/thick lines

> Rough testing the shader and clearing errors.

July 31st

> Finally Rendered dashed lines with fixed dash pattern right now

> Reported the mentor about implementation and asking feedback

> Now working on passing variable dash pattern data to shader via Renderer

August 1st

> Working on variable dashed lines pattern ( create from UI )

> Joined the dashed data coming from kernel to shaders via document canvas and renderer

> Finally finished rendering line patterns

August 2nd

> Working on transparency

> Enabled transparency and fixed the vertex data during fill

> transparency working OK

> fixed a minor segmentation fault because of a garbage value of uninitialized dash_size variable on launch of LC3

August 3rd

> Reported mentor about the work finished regarding linepatterns

> Got Feedback correct!!! All working Ok

August 4th

> Finding way to make the thick lines render with magnified or non magnified width while zooming keeping the same codebase

> Changed the draw() code of shape entity to support the magnified width property

Week 11

August 5th

> Started work on Text Rendering module

> Preparing the layout of different classes need to abstract text rendering property

August 6th

> Implemented Text_entity Class to support rendering and caching Text rendering

> Made a Writer class to use the Freetype Library and built and cache the character glyphs textures

August 7th

> Making changes in codebase to support Texture rendering

> Finding errors while using Freetype library with Qt

> Updated and Merged the Main Librecad_3 repo in the current repo

August 8th

> UNABLE TO WORK DUE TO ACADEMIC PURPOSE :(

August 9th

> UNABLE TO WORK DUE TO ACADEMIC PURPOSE :(

August 10th

> Again started with making new Gl_Font and Writer classes

> This Time making it more abstracted so that it can support multiple fonts in the same document

August 11th

> Finally integrated the Freetype Library correctly in lc3

> Implemented GL_font Class and tried rendering some text directly, Working Correct

Week 12

August 12th

> Working on Font_Book to cache multiple GL_Font objects ( discarding Writer class the text render method made itself in GL_Font )

> Created a Default Font to be used when a specific font is missing

> Implemented Font_Book , working OK

August 13th

> Started Working on Text_Entity

> Joined the Text_Entity with the GL_Font and Font_Book

> Tested rendering Font with Cursor , Dimensions and Entities with their model matrix, Working OK

August 14th

> Now Started Joining the outermost calls of painter to the Renderer/Cacher for Text Rendering

> Finished abstracting Text Rendering Calls , Checked text rendering with Cursor and Dimensions etc

> Finally Finished Text Rendering, Working all OK

August 15th

> Debugging for the Bezier curves , Quadratic , cubic curves

> Got Feedback from mentor regarding Text Rendering

> Writing blog for GSoC Phase 2 experience

August 16th

> Implementing Bezier curves

> Solving some issues related to vertex data

August 17th

> Finished Bezier curves , quadratic and cubic

> Starting implementing Ellipse

August 18th

> Found some issue with editing/rotating ellipse from UI , reported to mentor [ TODO: solve later ]

> Trying to implement ellipse using matrix transformation and arc method, but it is disturbing CTM and line patterns

> Implemented Ellipse using Parametric Equation after converting the angle limits to eccentric angles

> Finally Ellipse Implemented , Rendering all OK

Week 13

August 19th

> Working on cmake to create cpp file which will save the absolute paths of RESOURCES during compilation

> Accesing RESOURCES(SHADER and FONT) paths from that file and generate the resources runtime

> Now No need to put shaders/font files absolute paths manually, All Working OK

August 20th

>

August 21st

>

August 22nd

>

August 23rd

>

August 24th

>

August 25th

>