Editing User:AnkushKhandelwal/OpenGLRendering

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
+
'''OpenGL Framework'''
'''Improve OpenGL Rendering'''
 
 
 
'''GSOC Proposal 2015'''
 
 
 
 
Brief Description: The Objective of the project is to Re-factor and re-write the existing code of OpenSCAD preferably by implementing or using an existing rendering/scenegraph framework for cleaner rendering code. This newly developed infrastucture can be imported to softwares like GLES2 which opens up more possibilities like WebGL and native support for ARM Linux platforms that usually only provide GLES2 implementation.
 
Brief Description: The Objective of the project is to Re-factor and re-write the existing code of OpenSCAD preferably by implementing or using an existing rendering/scenegraph framework for cleaner rendering code. This newly developed infrastucture can be imported to softwares like GLES2 which opens up more possibilities like WebGL and native support for ARM Linux platforms that usually only provide GLES2 implementation.
  
Line 11: Line 7:
 
*'''IRC username''': ank_95
 
*'''IRC username''': ank_95
 
*'''Contact Number''': +918886330979
 
*'''Contact Number''': +918886330979
*'''Skype Username''':ankush1995
 
*'''Backup Contact Number''': +919785425538
 
  
 
==Background Information==
 
==Background Information==
* Pursuing Computer Science from IIIT Hyderabad, Andhra Pradesh, India. Currently in 2nd year.
+
* Pursuing Computer Science from IIIT Hyderabad, Hyderabad, Andhra Pradesh, India. Currently in 2nd year.
* Skills - c/c++, OpenGL1/2/3, PHP, Mysql, Python, Web2py, Javascript, Jquery, HTML, CSS, Bash programming, Git.
+
* Worked in c, c++ and OpenGL 2/3.
* Worked in c, c++ and OpenGL 1/2/3.
 
* My previous works in c++ and OpenGL : https://github.com/ankush1995/OpenGL
 
 
* Interested in Graphics and front-end development.
 
* Interested in Graphics and front-end development.
 
* I am a Linux user and want to step in the Open Source World.
 
* I am a Linux user and want to step in the Open Source World.
* I am familiar with git.  
+
* I am familiar with git. Commit my work on git using github account(github.com/ankush1995).
* Commit my work on git using github account(github.com/ankush1995).
 
* Here is the link to my CV : http://brlcad.org/w/images/1/1f/CV.pdf.
 
  
 
==Project Information==
 
==Project Information==
Line 42: Line 32:
 
https://github.com/openscad/openscad/wiki/Information-About-Other-Frameworks.
 
https://github.com/openscad/openscad/wiki/Information-About-Other-Frameworks.
  
 +
'''Creating or Selecting Scenegraph/Rendering Library'''
 +
 +
In openSCAD OpenGL ES2 is not yet supported, till now immediate-mode opengl is used. The Goal of this  scene-graph library would be to provide rendering data structure to abstract buffer objects and also to manage Qt event mappings to camera. By the hepl of this library the internal segments of openSCAD will be entirely independent of rendering.
 +
This Library will help to refactor internal OpenSCAD code instead of the current rendering used in OpenSCAD. The Rendering using the Library will be more simple and clean, it will be helpful for calling CGAL objects, Polyset objects and helper objects like axis display. With this library many features can be implemented like the speeding up of OpenGL 3d mesh drawing etc.
  
 
'''Spliting the OpenGL code in Different classes - CODE EXTRACTION'''
 
'''Spliting the OpenGL code in Different classes - CODE EXTRACTION'''
  
 
We need to split out the openGL code from the polyset classes and all other classes and make a different class or data structure and it is used directly. In All it should be a seperate component which takes objects (for example , polyset) and renders it, in an effort to isolate the rendering from the rest of the software. The code of OpenSCAD is in openGL 2 and 1.1 + extentions and also we have users on openGL 2 and openGL 1.1 + extentions , so abstracting away OpenGL extensions and version differences is important.
 
We need to split out the openGL code from the polyset classes and all other classes and make a different class or data structure and it is used directly. In All it should be a seperate component which takes objects (for example , polyset) and renders it, in an effort to isolate the rendering from the rest of the software. The code of OpenSCAD is in openGL 2 and 1.1 + extentions and also we have users on openGL 2 and openGL 1.1 + extentions , so abstracting away OpenGL extensions and version differences is important.
 
+
If we know exactly how much GL code is in a file , the next step would be to turn it into a separate component, i.e. a class or set of functions that take a polyset as parameter and renders it. This class would then be responsible for converting polyset data into something more suitable for OpenGL.For example it does not make sense to render one single object in OpenGL ,it is not even supported in mordern OpenGL without enabling legacy compatibility.
[[File:Diagram.png]]
 
 
 
 
 
If we know exactly how much GL code is in a file , the next step would be to turn it into a separate component, i.e. a class or set of functions that take a polyset as parameter and renders it. This will help in making the main files of openSCAD, free from rendering, there will be a separate component for rendering. This class would then be responsible for converting polyset data into something more suitable for OpenGL.For example it does not make sense to render one single object in OpenGL ,it is not even supported in mordern OpenGL without enabling legacy compatibility.
 
To enhance our understanding on code extraction we take an example. Below we have a function from file polyset.cc which is used in rendering edges, now we want to separate it from the polyset.cc file such that the moved code is not allowed  to use any private methods or any member variables of polyset.
 
 
 
[[File:polyset.png]]
 
 
 
To do that we take this function to another file and we create a renderer class and add API to polyset to enable that rendering class to extract the data. The renderer can now compile a VBO from that data and render that (plus cache the VBO so it can be reused if the polyset doesn’t change). See below patch for practicle application.
 
 
Then, in the future, when we use a real OpenGL framework, the renderer will most likely build a VBO using classes internal to that specific rendering framework all the VBO stuff would then be built without having to make any changes to the PolySet class.
 
Then, in the future, when we use a real OpenGL framework, the renderer will most likely build a VBO using classes internal to that specific rendering framework all the VBO stuff would then be built without having to make any changes to the PolySet class.
 
If we can compile for example polyset without actually having OpenGL (e.g. on GLES2 box like Chromebook) in it then it will be a measure of success of code extraction.
 
If we can compile for example polyset without actually having OpenGL (e.g. on GLES2 box like Chromebook) in it then it will be a measure of success of code extraction.
  
 
A patch has been submitted in which the OpenGL code is in one file and other renderin code is in another : https://github.com/openscad/openscad/pull/1249
 
A patch has been submitted in which the OpenGL code is in one file and other renderin code is in another : https://github.com/openscad/openscad/pull/1249
 
'''Selecting Scenegraph/Rendering Library'''
 
 
Selecting the most suitable Library which can be integrated with the newly developed code will require some research about the existing libraries.
 
In openSCAD OpenGL ES2 is not yet supported, till now immediate-mode opengl is used. The Goal of this  scene-graph library would be to provide rendering data structure to abstract buffer objects and also to manage Qt event mappings to camera. By the help of this library the internal segments of openSCAD will be entirely independent of rendering.
 
This Library will help to refactor internal OpenSCAD code instead of the current rendering used in OpenSCAD. The Rendering using the Library will be more simple and clean, it will be helpful for calling CGAL objects, Polyset objects and helper objects like axis display. With this library many features can be implemented like the speeding up of OpenGL 3d mesh drawing etc.
 
 
  
 
'''Off-Screen Rendering'''
 
'''Off-Screen Rendering'''
Line 86: Line 64:
  
 
'''Week 1(May 25)'''
 
'''Week 1(May 25)'''
* Identify Goals and Requirements related to the project.  
+
* Identify Goals and Requirements.
* Understanding the code in more detail.
+
* Listing out various Rendering Engines on which experiment can be done of the newly developed code after the completion of project.  
 +
* Looking through the files from which GL code is to be extracted and understanding it.
  
'''Week 2-3(June 1)'''
+
'''Week 2-3'''
* Looking through the files from which OpenGL code is to be extracted and understanding it.
+
* Working on scene-graph like Library which is comparatively a large task.
* Deep understanding of code, where the functions are called and where the  objects are made.
+
* Starting separating GL code from the various files.
* Starting separating openGL code from the various files.
 
* Going on with two implementations - old and new. Old one will be intact.
 
  
'''Week 4(June 15)'''
+
'''Week 4'''
* Only the rendering part is separated, nothing else, excellent knowledge of c++ will be required.
+
* Working on the Library continues.
* The extracted OpenGL code is then written in a seperate component either a class or data structures.
+
* This library is a seperate GL rendering library which will make the internals of openSCAD independent of rendering, then we just have to pass objects.
* Linking the rendering code to the main infrastructure begins.
 
* Making a renderer class.
 
* adding API to polyset to enable that rendering class to extract the data from the main files.
 
  
'''Week 5(June 22)'''
+
'''Week 5'''
* Making a seperate segment ( either a renderer class or a data structure ).
+
* Extracting the OpenGL code from the polyset classes and helper classes.
* These classes will be public, so that we can inherit the same in multiple files.
+
* Making a seperate segment ( either a class or a data structure ).
* Extracting the OpenGL code from the various classes like polyset etc.
 
* Now the original files does not contain OpenGL code, all the OpenGL code is written in separate files.
 
* Making renderer class for whole code of openscad.
 
* This process will continue for 2-3 weeks.
 
  
'''Week 6(June 29) '''
+
'''Week 6'''
* Continuing creating an abstract supertype of the class containg GL code and calling the objects in appropriate places.
+
* Create an abstract supertype of the class containg GL code.
* This will help in decreasing code redundancy. Now the code will be more compact, distributed in various components.
+
* Constructing most of the part of Rendering Library.
* using same class or data structure for same objects which currently are written many times in different files.
 
* Then we just have to make the same class in the files and extract the data from the two files..  
 
 
   
 
   
 
''' MID-term Evaluations'''
 
''' MID-term Evaluations'''
  
'''Week 7(July 6)'''
+
'''Week 7'''
* brushing up the code.
+
* Continuing with making a superset class to render the GL code.
* Taking feedback about the new implementation.
+
* Testing of rendering Library Begins.
* Old one is also there which is the current implementation (before the starting of the project).  
 
  
'''Week 8-9(July 13) '''
+
'''Week 8-9'''
 
* Solving issues on github, #292, #675, #418 etc.
 
* Solving issues on github, #292, #675, #418 etc.
* Research about using existing library.
+
* if successful, Heavy testing of the Library.
* There are lots of existing library so using the best suitable library.
+
* else, looking for prominent solution.
* Discussing with community members about the library.  
 
* This library will be a seperate GL rendering library which will make the internals of openSCAD independent of rendering.
 
  
'''Week 10-11(July 27)'''
+
'''Week 10'''
 
* Integration phase begins.
 
* Integration phase begins.
* Integrating the library in the new implementation.
+
* using library in other files.
* Starting the development of view-modal system.
 
  
'''Week 12 (August 10)'''
+
'''Week 11-12'''
* Listing out various Rendering Engines on which experiment can be done of the newly developed code.
 
 
* Experimenting with other frameworks.  
 
* Experimenting with other frameworks.  
* trying to implement Off-screne Rendering feature with the help of new OpenSCAD which supports OpenGL ES2, but this is optional.  
+
* trying to implement Off-screne Rendering feature with the help of new OpenSCAD which supports OpenGL ES2.  
  
'''Week 13(August 17)'''
+
'''Week 13'''
 
* Cleaning up the code.
 
* Cleaning up the code.
 
* Time to make up for missed milestone (if any).
 
* Time to make up for missed milestone (if any).
Line 146: Line 109:
 
''' Week 14'''
 
''' Week 14'''
 
* more testing and cleaning.
 
* more testing and cleaning.
* providing the users with new implementation of OpenSCAD.
 
  
 
''' Final Evaluation'''
 
''' Final Evaluation'''
Line 152: Line 114:
 
==Deliverables==
 
==Deliverables==
  
* Cleaner rendering code.
+
* Cleaner rendering code
* All the way new implementation of OpenSCAD.
 
 
* Better support and better responsiveness for bigger models
 
* Better support and better responsiveness for bigger models
 
* view-modal of the OpenGL code
 
* view-modal of the OpenGL code

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)