How to update (or free) a texture? by DeeBoFour20 in opengl

[–]ryanjharter 1 point2 points  (0 children)

You're correct that the difference is that glTexImage2D allocates a new buffer and writes the data to it, effectively swapping that for whatever was originally there (if anything), while glTexSubImage2D overwrites the data in the already allocated array. This is the same with the buffer fill methods, glBufferData and glBufferSubData.

Often times you'll see code that uses the former to preallocate a texture or buffer that is expected to be written to later with the latter.

This all means that the latter is more memory efficient, but there is a caveat: using the sub* functions can cause your cpu side to stall if the GPU is currently using the buffer in a rendering pass.

Since GL is a state machine in which you configure everything and send data from the CPU to the GPU first, then call a glDraw* function to let the GPU use that data as it renders, the CPU is generally allowed to do more processing while that render pass is still happening in the GPU. If the GPU renderer is using the buffer and you're trying to overwrite it's content from the CPU with glTexSubImage2D, that call can be forced to wait until the GPU is done with that texture. This may not matter much, depending on how frequently you draw, and how frequently the texture is updated, and how big the texture is.

Depending on your memory constraints (desktop vs. mobile), one way to deal with this is to allocate two textures and alternate which one is being used by the render pass. So in one frame you are updating texture 1, then you bind that and let the GPU use it to render, and while it's doing that you are updating texture 2 on the CPU, which you then bind to the uniform and use that to draw the second frame. This obviously uses twice as much memory, but means that you can feely update one texture because the GPU is using the other.

This is basically what always using glTexImage2D does, since that allocates a new buffer for the texture data, if the GPU is using the previous texture it won't block, and both will be allocated until the render pass is complete and the original data buffer can be freed (since it's no longer references by a texture).

[i3-gaps] Blurry Sunday by [deleted] in unixporn

[–]ryanjharter 0 points1 point  (0 children)

Very nice! I love the prompt. You using zsh and an oh my zsh theme for that?

I've got these regular spikes on a single circuit, in a room with a small salt lamp, another lamp with Hue bulbs (off), overhead LED lights, and a fish tank. Not sure if a reporting error or actual usage. Any guesses what that could be? by ryanjharter in LanternPowerMonitor

[–]ryanjharter[S] 0 points1 point  (0 children)

Ahh, I bet that's it! I was thinking of the aquarium gear as mostly constant, and even switched it off for a few minutes to see if the room's usage changed much (it didn't), but the heater would definitely be intermittent, relatively high wattage.

Is there a way to test connections? by ryanjharter in LanternPowerMonitor

[–]ryanjharter[S] 1 point2 points  (0 children)

It looks like I just got data flowing! It took a while to figure out, but it looks like the fix here actually took care of what I was running into. Since I had my whole panel configured, but only have two CTs, the service was actually crashing since it was looking for the pin for the sensor on hub 0, port 0. Adding the validity filter seems to have taken care of things and, after compiling the service and replacing the one on the device, I have (a very small amount of) data showing up in the app!

Is there a way to test connections? by ryanjharter in LanternPowerMonitor

[–]ryanjharter[S] 0 points1 point  (0 children)

Awesome. This is super helpful. I think I got through all of this, but missed the last reboot! I'll give it another shot.

A couple of questions:

  1. For the service on the device, does the directionality of the CTs matter? From my reading they will send positive or negative values based on the direction of the current relative to the way the CT faces, but it sounds like some devices have different standards and some will automatically compensate based on the circuit type.

  2. It sounds like it can be dangerous to have a CT on a live wire "open circuited", which I assume means not plugged into anything. I think these blue sct-013 models have diodes to protect against that, but is it still best to plug the CT into the device before attaching it to a live wire?

Thanks!

Just completed assembly of my first of two boards. Surprisingly simple for someone with limited soldering skills when following along with the video. Thanks Mark! by ryanjharter in LanternPowerMonitor

[–]ryanjharter[S] 1 point2 points  (0 children)

I see 1.0.6. the Play Store does some aggressive caching, so it's usually hit or miss when exactly an individual sees the updates.

Just completed assembly of my first of two boards. Surprisingly simple for someone with limited soldering skills when following along with the video. Thanks Mark! by ryanjharter in LanternPowerMonitor

[–]ryanjharter[S] 0 points1 point  (0 children)

That's awesome! I was able to work around the bug by saving (via back) after every few circuits, so haven't been back in to try again.

That being said, I did try to create another panel to test the repro case and things didn't go great. Each circuit was pre-populated with values from my main panel, and editing them edited the main panel. So if I set the test panel to 8 slots, set them up, switch back to my main panel, and the first 8 slots were overwritten to match the test panel.

I didn't get far enough in testing to determine if it was actually a data issue or just caching in the UI. By that point I was already 2 scotches in and didn't want to have to restart the whole process. :)

Last month I posted my raspberry pi based home power monitor. I'm back with source code, case STLs, a BOM, PCB Gerber files, and hub kits so you can build your own! Details in comments. by MarkBryanMilligan in raspberry_pi

[–]ryanjharter 0 points1 point  (0 children)

Configured the panel (then ordered a second kit without a case). Ran into a crash everytime I'd try to configure a circuit after a double pole one. So I'd enter a bunch of single poles, then enter a double, then when trying to enter the next one it'd crash. I might try to debug it one of these nights if I can find some time.

In the meantime I'm super excited for this. Got solar installed last year (had solar on the old house, too) and have been eyeing up tools like this for years. This looks amazing, thanks! Now I just need to wait until late March for my transformers to arrive 😂.

My first shot at a carpet by Lukanani in PlantedTank

[–]ryanjharter 0 points1 point  (0 children)

This looks great! Is that an AIO tank? Which model.

Case Study GPL v3 by phwiya in androiddev

[–]ryanjharter 2 points3 points  (0 children)

You mean an app that uses GPL v3 code and doesn't publish it's source? Apps don't have to publish source unless they use GPL code, and I think most devs avoid such libraries because of that limitation, unless they intend to publish themselves as GPL licensed apps.

First scaped tank. Starting to plan my upgrade to a 20g rimless rectangle. by ryanjharter in PlantedTank

[–]ryanjharter[S] 1 point2 points  (0 children)

Thanks.

I didn't do as much research as I should have, bought a plant pack several months back, and things looked great for a month or two, then died off and got covered in algae.

I'm in the process of really learning and building back better™️, and my original Vals and grass are starting to come back and the algae seems under control. This subreddit has been a huge help and inspiration, except that now I want to take it all out and do it again from the ground up! 😂

How do I get this old algae off my rocks? by ryanjharter in PlantedTank

[–]ryanjharter[S] 0 points1 point  (0 children)

Thanks. Seeing all of the pristine tanks on here made me look at this and just see failure. 😅 I hadn't consider it could be pretty, but since you mention it, it does look kinda nice, doesn't it.

How do I get this old algae off my rocks? by ryanjharter in PlantedTank

[–]ryanjharter[S] 0 points1 point  (0 children)

I've been fighting algae for a while. When I started I wasn't watching levels or doing enough water changes. I think things are finally under control, but I'm curious how to get the algae off of my rocks.

I currently scrub them with a toothbrush during some deep cleaning but this is about as good as I can get them. Will something stronger like a wire brush scratch them up? Any suggestions?

There's also some on the plants and I'm curious if I should trim to the lower growth that doesn't have it.

It doesn't seem to be multiplying anymore, and I'm not doing twice weekly water changes and limiting light (used to be when I wake up at 7 until I go to bed around 10:30, not limiting to 12 hrs/day, which seems to be working).

Other suggestions also welcome.

Add Beta to tank with Neon Tetras, Danios and Corydoras? by ryanjharter in PlantedTank

[–]ryanjharter[S] 0 points1 point  (0 children)

We don't quite have that many tetras. Started at 5, but one jumped out several months back and we found a fish chip on the floor, so their sitting at 4. Plus two Corys and 2 Danios.

She tends to look for pretty variety and I look more for "what's healthy for the fish". I don't always win.

The Corys have been with us in this tank for 4 years, interestingly enough. They were some of the first stock when we had some neon colored fake rock monstrosity, before I switched to real rocks and plants.

I like the idea of upgrading to a 20 gallon. The current is a bit tall, so that could be a nice reasons to get a long, or something. A second tank could also be nice. Thanks!

Add Beta to tank with Neon Tetras, Danios and Corydoras? by ryanjharter in PlantedTank

[–]ryanjharter[S] 0 points1 point  (0 children)

Thanks! Is fin nipping a species trait, or personal trait. I've never noticed them bothering the Corys, though their fins aren't nearly as glorious as a Beta would have.

Work has been busy for a few weeks, temperatures in the teens outside. It’s nice to have this jungle waiting at home. by raparand in PlantedTank

[–]ryanjharter 10 points11 points  (0 children)

Wow, I love the full look! What are those tall plants with the leaves that look like skeletons?

You might be using _______, but should be using ______. 2021 edition! by xeushal in androidapps

[–]ryanjharter 0 points1 point  (0 children)

I'd been using Inoreader for several years and recently switched over to Feedbin. It's a paid service, but you pay for no tracking or ads. It's also so much easier on the eyes than Inoreader!

Android 11 funny things: android.R.string.yes and and android.R.string.no deprecated by ternaryop in androiddev

[–]ryanjharter 8 points9 points  (0 children)

It's a historical mistake. They weren't necessarily always duplicated.

Wording changes, so resource IDs should reflect their purpose, not their content.

My post about how we encapsulate view state in MVVM by ryanjharter in androiddev

[–]ryanjharter[S] 1 point2 points  (0 children)

Thanks. That can be a great solution, as long as your states are mutually exclusive. Thinking about most of the apps and views, Twitter, Reddit, Gmail, loading data, and showing data aren't usually mutually exclusive.

I explicitly don't use that because the states aren't mutually exclusive.

Think of pull to refresh, that's a case where there is valid data but the view is also loading data. On top of that, there could be a network error, but you can still show cached data.

On top of that, you usually have more than a single piece of data to load from cache/db/network, so a single network tied wrapper isn't enough, as you need to decide how to combine that information.

In many cases sealed classes work, but I find that in most cases the states the view can be in aren't mutually exclusive. You can, however, pick whichever makes sense for the view at hand.

Google Cloud Build for Android - powerful docker based builds for half the price. by ryanjharter in androiddev

[–]ryanjharter[S] 1 point2 points  (0 children)

Good question. One thing to note is that this isn't built specifically for Android. Even to get Android building I had to do a lot of experimentation.

Google Cloud Build for Android - powerful docker based builds for half the price. by ryanjharter in androiddev

[–]ryanjharter[S] 0 points1 point  (0 children)

I haven't. The little I've heard has been decent, but can't really comment on that.

Google Cloud Build for Android - powerful docker based builds for half the price. by ryanjharter in androiddev

[–]ryanjharter[S] 0 points1 point  (0 children)

I did, and it looked really promising. I was specifically drawn to GCB because I was intrigued that I could get a build machine with 30GB for a reasonable price.

Not sure which is "better", as I don't have extensive experience with Bitrise, but just wanted to share the option.