Live data from Hacker News

Show HN: Primrose – a text editor that runs in a WebGL texture

primroseeditor.com

51–60 of 105 posts

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#51
post #48

Earlier quoted context omitted.

out of curiosity, why not use the bookmarking feature?

Because I cycle through a lot of tabs. Yes, some of them I leave up for months to pick away at, but others I finish in just a day. It's much easier to close tabs than to edit my bookmarks constantly. And losing those tabs isn't an issue because Safari can be made to reopen those tabs each session, even after unexpected shutdown or whatever. But then this happened. I need to write something that will back up my tabs.

I'm the same way, so I can relate to your pain. I've had this happen before with Chrome/Chromium with hundreds of tabs. I now use Firefox for two reasons: One, the UI is better than Chrome/Chromium with hundreds of tabs active, and two I now simply periodically clear out long term tabs when I no longer have an immediate need for them by bookmarking them.

My friends think I'm insane by keeping so many tabs open. Maybe I am. Maybe you are, too. Yet with as disorganized as it might seem to others, it works well for my particular usage patterns. (It also helps that I segregate news, work, misc. activities into different profiles, too.) The thing is that sometimes when you open something that you want to get back to at some indeterminate point in the future, you can do one of two things: Bookmark it and forget about it, possibly permanently; or keep it open and stumble upon it as you go through your tabs to categorize them and clean them out. Although these days, I mostly just dump everything into a dated but uncategorized list to go through in the future. Session Manager handles the rest in the event I do something stupid.

I imagine I'll catch some flak for sharing this, but it works well for me. My work-related browser sessions are usually better organized and important stuff gets saved more or less immediately. My "fun" generic browsing instances--not so much.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#52
This is so cool. Very interesting as an idea, hard to explain without seeing it I almost didn't click.

Side note: I tried to load this on Chrome for Android and it went very badly. I got redirected through two of those bright red "UNSAFE YOU SHALL NOT PASS" https pages and then finally got to a page that didn't do much at all. No idea why, worked fine in Chrome on OS X.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#53
post #37

I wonder how doable it would be to make most of the software we use, or even the system (but not the kernel), run on a GPU. Any windowing system or GUI is already mostly a graphics application.

This is actually how Desktop Window Manager (aka "Aero") on Windows and Quartz Compositor on OS X actually work. They're just setup with an orthographic projection and they don't rotate the windows at all.

That was actually a bit of a surprise (though I admit it shouldn't have been) with Primrose. If I pick dimensions for the editor that fit the window's aspect ratio, and don't rotate the view at all, then the editor pane can fill the browser window and it looks very natural.

I am not positive, as I don't have the spec laying in front of me and it's been a long time since I looked, but I'm pretty sure the HTML5 Canvas API is not hardware accelerated at this time. That is how I do the actual rendering of the text, using Text API.

There is another project called fontpath[1] that can read TTF and OTF font files, and another project from the same developer called gl-sprite-text[2] that can render them as bitmaps to textures. I've been considering converting my rendering over to using it. The process would at least be good practice in decoupling the code a bit more, as I think the tokenizer and keyboard system would be useful in other projects as well.

The keyboard code pages aren't yet complete for everyone in the world right now, but I think they go a long way towards making it possible to once and for all make good keyboard interactions in JS. And by completely implementing my own end-around of the browser's own handling, sticking to more of the older primitives, I am actually able to make for more cross browser compatible. I don't know if anyone noticed, but this runs in IE perfectly fine, and I didn't really do anything special to make it so. And if you just run the Canvas on its own, without the WebGL part, it actually runs on some relatively old browsers without any trouble.

[1] https://github.com/mattdesl/fontpath

[2] https://github.com/mattdesl/gl-sprite-text

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#54
post #52

This is so cool. Very interesting as an idea, hard to explain without seeing it I almost didn't click. Side note: I tried to load this on Chrome for Android and it went very badly. I got redirected through two of those bright red "UNSAFE YOU SHALL NOT PASS" https pages and then finally got to a page that didn't do much at all. No idea why, worked fine in Chrome on OS X.

There are no overt technical reasons it won't run on Android. At one point, I did have it running in Chrome and Firefox on Android, but I had a lot of difficulty getting it to run without regularly crashing the browser and bombing out to the home screen. I don't know if that is an Android issue or a Galaxy Note 3 issue, but it was pretty reliably reproduceable in both browsers with just a "load this page, now refresh the page".

I also somehow broke the touch screen controls at the last minute. But I was really keen to get this project out by the end of this month. So I cut features to get in on my self-imposed deadline. I just shut it off to avoid procrastinating release, focusing on too many UI issues or trying to avoid crashing people's browsers when I haven't the slightest clue if there is anything I can do about it.

Most of my career has been working in consulting, mostly for the type of consultoware companies that make all the boring, MS-tech, CRUD projects. I've been freelancing for the last three years, but even that isn't ideal. I've always wanted to have my own projects, building the type of products I've always wanted.

Over the years, I've had a lot of personal trouble with procrastination of completing projects. 10 years of starting and stopping the same ideas, becoming dissatisfied with my work, and eventually growing bored of it and letting it rot on a forgotten hard drive somewhere. I've always known it was an avoidance tactic. By focusing only on the core technical issues, I'd never have to address the tertiary tech and management issues common to releasing any project. So that was another motivation behind this project: just get something together and get it done, out, and in front of people.

I couldn't be happier with the results. Yes, it's missing features. Yes, the server is kind of janky, being that I'm not a sysadmin and only even learned how to turn SSL on a few months ago (though I think it's actually my host's fault for not configuring some of my certificates properly). But I think it's pretty good for a month's worth of work.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#55

So here's why this is particularly awesome in my head. I am a digital nomad, and basically travel with a backpack's worth of stuff, developing off my 13"MBA. The thing I miss the most about my old office is having a nice monitor. The thing I miss most about having a home is my 3-monitor desktop setup. Both things I had to give up because they don't fit in my backpack and because I can't easily procure them wherever I…

Holy crap, great idea! Imagine if adding a "monitor" (virtually speaking, of course) to your setup was no more difficult than splitting a Vim window... that would be pretty rad. An Oculus Rift is much less expensive than your typical multi-monitor setup too, FWIW.

Actually, I'm hoping to be able to experiment with code layout ideas that do not strictly adhere to a window. 2D elements tend to not map well to 3D spaces. One of the problems with the text-in-a-texture method that I've done here is that there is no relief of depth to the text, and relief is actually an important part of how we make sense out of objects in 3D space. It's fine on a 2D screen because the context is so restricted that it all stays consistent. But in 3D, it's kind of disconcerting to see completely flat textures.

Like, why do we still use plain text in flat files for source code (for the most part, there are a few exceptions-that-prove-the-rule)? Why are there so many examples of graphical programming systems that have completely failed? Is it because there is something inherent to text that makes it superior for representing algorithms? Or is it because 1-dimensional text maps to our IO systems the best? I suspect there is a healthy dose of the latter, but we haven't ever had a significant "other" IO system to ever test that theory.

In a lot of ways, Primrose isn't even my goal, more like a benchmark from which to start developing other ideas in text representation in VR UIs. I don't know what they will be, but at least I now have a starting point.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#56
post #44

Just a warning, if you try this while using Safari it might crash and close all of your tabs somehow. And it might make it so that you can't reopen those tabs despite the fact that you have tabs set to be restored each session. And you may in fact experience the acute pain of losing a year's worth of painstakingly accumulated tabs. Not that this has happened to me.

I'm really sorry about that. I didn't know it was going to do that. I had seen that it was doing that in browsers on Android and specifically disabled it for mobile users to avoid such an awful experience. I had just assumed that Safari, being WebKit, would work just as well as the least common denominator of Chrome and Opera. Again, very sorry.

I guess that will teach me to start sneaking into my wife's computer bag and borrowing her Macbook to test these things.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#57

So here's why this is particularly awesome in my head. I am a digital nomad, and basically travel with a backpack's worth of stuff, developing off my 13"MBA. The thing I miss the most about my old office is having a nice monitor. The thing I miss most about having a home is my 3-monitor desktop setup. Both things I had to give up because they don't fit in my backpack and because I can't easily procure them wherever I…

There are definitely people working on it, but I don't think the resolution is going to be there for text editing in the first (or even second) generation Rift. That said, take a look at these: http://www.reddit.com/r/oculus/comments/2hbktl/best_virtual_...

This issue is actually where the idea came from to put the text on the inside of a sphere. I wanted to make a VERY big text field, so that I could fit a good amount of text on the object at a font size large enough to read the text well. At that size, the edges of a rectangular window are so much further away from the viewer that there is significant distortion. The sphere makes for a much more comfortable viewing angle.

No, I wouldn't want to write Primrose itself in Primrose, and Primrose isn't a very big project. But little experiments with the live-coding have been fun. I'm still working out the use cases in my head. I suspect there might be more use for manipulating and visualizing code in VR--at least in the early days until resolution gets better--than straight, bulk writing code.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#58
post #41

Earlier quoted context omitted.

What stops you from having multiple windows on your desktop? Oculus sucks at displaying text - it's low resolution (half of 1080p), it has crazy chromatic abberations, and you have to transform "spherize" your image to correct for the lens distortion, further reducting the resolution. Oculus is not light - it's pretty annoying to wear it for longer than 20-30 minutes.

This is all true of the hardware as it exists right now. By the same token the original iPhone was low res, slow, only 2G, and bulky. The iPhone 4 (first with retina display) came out only 3 years later. That's a huge leap in such a short period of time. If VR catches on at all you can expect it to see the same type of acceleration.

Yeah, that was kind of a motivation for me. I was sick of standing around, talking about what was or was not good for VR, with people who didn't even own a Rift, let alone program anything for it.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#59

Earlier quoted context omitted.

That's pretty much why I made this! I've been wanting to build live-editable objects in VR, but I was severely dissatisfied with the options available.

Yes, this. I want to be able to map the amazing flexibility I had in SecondLife over either physical. I want to see programmable objects or virtual objects in a "layer" over the physical world and be able to open them up and edit the code, just as I was able to do in SecondLife. The creative possibilities are vast.

I actually have a project in the works for something like that. I took a break from it to make this.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#60

This would be cool to code a game from within a game. A game mechanic where you have to "hack" a computer system to gain rewards or advance levels. A few notes, using FF35 on OSX 10.10: 1) Can't use without first going full-screen. 2) Red dot follows the mouse, but with a large offset. 3) Cursor doesn't focus where mouse click occurs. Doesn't focus where red dot is either. 4) No visual indicator when a window has foc…

Thanks for the issue reports.

#1 is interesting, I've actually had the opposite problems: not being able to get things to work in fullscreen on OS X. My wife has a Macbook, so I will try to test there (if she will let me).

#2 and #3 are probably the same issue, expressed in two different ways because the red dot is placed completely independently from the caret drawn in the texture. Do you think you'd be able to figure out if its OS or display related? I.e. do you have a retina display? I should be collecting analytics on screen and pixel ratio metrics, sigh.

#4 was a punt, I just wanted to get the job out the door. I did want to dim the editor when it wasn't selected, and provide a key combo to deselect, but I ran out of time on my self-inflicted deadline. It is definitely in the pipeline, however.

#5: did you notice that SHIFT+mouse movement panned the view? Or are you not satisfied with that system? I admit, I'm not wild about it myself, but it seemed like the least evil of all of the options, considering the interactions that I also had to do with the editor.

Post reply on HN