Code Monkey home page Code Monkey logo

Comments (8)

nasamaher avatar nasamaher commented on May 21, 2024

I should comment that our GPU is quite beefy (P6000) and I'm not implying there won't be a performance hit on other GPUs. I would think a user would naturally select between the implementations by using floats vs doubles when creating lines.

from jplotter.

hageldave avatar hageldave commented on May 21, 2024

Hey there,

Thanks for posting here! I've come across this issue of too little precision before and as you mentioned, there are a few possible work arounds which would solve this, but require quite some implementation effort (e.g. rescaling coordinates) to work with the coordinate system.
I'm definitely curious about the GL double precision variant of the Lines and LinesRenderer classes! Maybe the prototypical adaption carry over easily to the other renderers as well.

How come such a high version of GL is required? I thought double precision was supported starting from 4.0.

from jplotter.

nasamaher avatar nasamaher commented on May 21, 2024

Hi hageldave,

You are right about OpenGL version: the API calls work with GL40., although the GLSH scripts require #version 410. I have implemented Lines and Points, with a crude binary switch (from an external class) to choose float vs double. I've attached the relevant files. I'm sure you'll find a nice way to auto-trigger the right shader and code - e.g., use the vertex types the user provides. Let me know if you have any questions.

image

64bit.zip

from jplotter.

hageldave avatar hageldave commented on May 21, 2024

@nasamaher thanks for contributing your code :) I will make the other GL renderers (Text, Triangle, Curves) also capable of using double precision and come up with a mechanism for choosing/autosetting the precision.

I found a bug that you may want to fix in your own code base. It has to do with dashed line rendering. I fixed it already in the new branch, see


here the parameters scaleX and scaleY need to be passed to the methods instead of passing 1,1

from jplotter.

nasamaher avatar nasamaher commented on May 21, 2024

Happy to contribute. Thanks for the bug warning.

from jplotter.

hageldave avatar hageldave commented on May 21, 2024

Double precision in GL rendering has been implemented for all of the 'basic' renderers (lines, points, curves, triangles, text).
The respective renderers, as well as CompleteRenderer and ChainedRenderer, provide a method setGLDoublePrecisionEnabled(boolean enable) to enable double precision rendering. We chose this mechanic over the alternative of using a flag in the Renderable (i.e. specifying in a Lines object that it wants to be rendered with double precision) since it would cause costly changes of render programs while running the render routine of a Renderer

This led to a few breaking changes in the API of GenericRenderer and its subclasses (i.e. the basic renderers) and corresponding Renderable implementations (i.e. Lines, Curves, Points, ...) related to the render and updateGL calls. These are internal however, and most likely nothing a user of this library would touch anyway.

This functionality is now on the master branch as of 8480130 and will be part of the next release of JPlotter.

There is also a little test class for checking out the effects of double precision rendering. Zoom in until it gets messy, then turn on double precision in the GUI.

@nasamaher I hope you are happy with this solution ;)

from jplotter.

nasamaher avatar nasamaher commented on May 21, 2024

@hageldave, wonderful! I think the "high-level" flag is appropriate. Thank you for your efforts.

from jplotter.

hageldave avatar hageldave commented on May 21, 2024

finally released in v0.6.0 (bd7cf5c)

from jplotter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.