Git Product home page Git Product logo

Comments (4)

 avatar commented on May 24, 2024 3

On Linux I had issues making the color atlas texture lookups work correctly. It seems like the x, y coordinates end up picking values from adjacent cells and so the colors are wrong.

What I did to fix it (hopefully) is to make the color atlas texture "cells" bigger than 1x1 so even if the x,y coordinates are slightly off, the right color is chosen. I'm sure there's some reason for this madness, but I'm a WebGL noob, and debugging WebGL is hard.

This seems to work for me on Linux and MacOS. Maybe it will work for you as well?

render/highlight-attributes.ts

export const generateColorLookupAtlas = () => {
   const max = Math.max(...highlights.keys(instances.current))
-  canvas.width = max + 1
-  canvas.height = 3
+  const texelSize = 2
+  canvas.width = (max + 1) * texelSize
+  canvas.height = 3 * texelSize

   const defaultColors = getCurrentDefaultColors()
   ui.imageSmoothingEnabled = false

   highlights.forEach(instances.current, (hlgrp, id) => {
     const defbg = hlgrp.reverse
       ? defaultColors.foreground
       : defaultColors.background
     ui.fillStyle = hlgrp.background || defbg
-    ui.fillRect(id, 0, 1, 1)
+    ui.fillRect(id * texelSize, 0, texelSize, texelSize)

     const deffg = hlgrp.reverse
       ? defaultColors.background
       : defaultColors.foreground
     ui.fillStyle = hlgrp.foreground || deffg
-    ui.fillRect(id, 1, 1, 1)
+    ui.fillRect(id * texelSize, 1 * texelSize, texelSize, texelSize)

     if (!hlgrp.underline) return

     const color = hlgrp.special || defaultColors.special
     ui.fillStyle = color
-    ui.fillRect(id, 2, 1, 1)
+    ui.fillRect(id * texelSize, 2 * texelSize, texelSize, texelSize)
  })

  return canvas
}

render/webgl-text-bg.ts

-      vec2 colorPosition = vec2(${v.hlid} + 0.0001, ${v.hlidType} + 0.0001) / ${v.colorAtlasReso
  lution};
+      float texelSize = 2.0;
+      float color_x = ${v.hlid} * texelSize + 1.0;
+      float color_y = ${v.hlidType} * texelSize + 1.0;
+
+      vec2 colorPosition = vec2(color_x, color_y) / ${v.colorAtlasResolution};

render/webgl-text-fg.ts

-      vec2 colorPosition = vec2(${v.hlid} + 0.0001, 1.0001) / ${v.colorAtlasResolution};
+      float texelSize = 2.0;
+      float color_x = ${v.hlid} * texelSize + 1.0;
+      float color_y = 1.0 * texelSize + 1.0;
+
+      vec2 colorPosition = vec2(color_x, color_y) / ${v.colorAtlasResolution};

By the way, great work on the project! I think using the builtin LSP support is a great idea. It's nice to see that the neovim devs considered both terminal and graphical UIs for the LSP support.

Apologies for my messy experimental code - never expected someone else to pick it up. There is a lot of rubbish that can be disposed of πŸ˜„

If you have any questions about anything let me know.

from uivonim.

clason avatar clason commented on May 24, 2024

Note: I don't see any of this on macOS, so this looks to be a low-level (electron or webGL) issue.

from uivonim.

smolck avatar smolck commented on May 24, 2024

Great, that works @Breja! Thank you so much! I've pushed the change.

Apologies for my messy experimental code - never expected someone else to pick it up. There is a lot of rubbish that can be disposed of πŸ˜„

No worries! I'm learning a good bit working on it, and it's proving to be a cool project to work on ;) Thanks for starting Veonim in the first place!

If you have any questions about anything let me know.

Will do, thank you! One thing I have wondered about is why you archived the original project? If you don't wish to share that, no worries, I'm just curious.

from uivonim.

 avatar commented on May 24, 2024

Will do, thank you! One thing I have wondered about is why you archived the original project? If you don't wish to share that, no worries, I'm just curious.

I burned out while working on the project, and did not have the energy to continue. I suppose I could have asked for maintainers to take over, but I didn't think anyone would be interested.

from uivonim.

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.