Jump to content

I'm trying to use ChatGPT to save OLED displays with pixel control, can someone help with an exe? C++ Windows

Streetguru

I don't know anything about coding in C++ or Visual Studio, but I went to chatGPT to have it write code that will automatically invert or disable each pixel on a display. with a GUI and a bunch of user controls for the timing of the program, having it automatically run on all displays, and a few other things.

As using a process like that should naturally avoid burn in when playing video games in full screen correct? I also tried to add a feature where it would only run along the edge of the display, so that only HUD pixels would end up touched.

But does anyone know how to make windows programs, and if the code even works? Here's the final code it gave me. Thanks

 

Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1

    Dim originalBitmaps As List(Of Bitmap) = New List(Of Bitmap)()
    Dim timers As List(Of Timer) = New List(Of Timer)()
    Dim forms As List(Of Form) = New List(Of Form)()

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        For Each screen As Screen In Screen.AllScreens
            ' Create a form for each display
            Dim form As Form = New Form()
            form.FormBorderStyle = FormBorderStyle.None
            form.WindowState = FormWindowState.Maximized
            form.Bounds = screen.Bounds
            form.Show()

            ' Save the form for later use
            forms.Add(form)

            ' Create a Bitmap for each display
            Dim bmp As Bitmap = New Bitmap(screen.Bounds.Width, screen.Bounds.Height)
            Using g As Graphics = Graphics.FromImage(bmp)
                g.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, bmp.Size)
            End Using

            ' Save the original Bitmap for later use
            originalBitmaps.Add(bmp)

            ' Create a Timer for each display
            Dim timer As Timer = New Timer()
            timer.Interval = 1000 ' In milliseconds
            AddHandler timer.Tick, AddressOf Timer_Tick
            timer.Start()

            ' Save the Timer for later use
            timers.Add(timer)
        Next
    End Sub

    Private Sub Timer_Tick(sender As Object, e As EventArgs)
        For i As Integer = 0 To forms.Count - 1
            Dim form As Form = forms(i)
            Dim originalBitmap As Bitmap = originalBitmaps(i)
            Dim g As Graphics = form.CreateGraphics()

            ' Invert the colors of the Bitmap
            For x As Integer = 0 To originalBitmap.Width - 1
                For y As Integer = 0 To originalBitmap.Height - 1
                    Dim pixel As Color = originalBitmap.GetPixel(x, y)
                    Dim invertedPixel As Color = Color.FromArgb(255 - pixel.R, 255 - pixel.G, 255 - pixel.B)
                    originalBitmap.SetPixel(x, y, invertedPixel)
                Next
            Next

            ' Draw the inverted Bitmap on the form
            g.DrawImage(originalBitmap, 0, 0)
        Next
    End Sub

End Class

 

 

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

I didn't quite understand what you're trying to do.

I do game on an Oled (last checked 14000h), I have no burn in, now.

What screen are you using.

 

(I recommend low brightness and avoiding bright red static elements)

I'm willing to swim against the current.

Link to comment
Share on other sites

Link to post
Share on other sites

The application is written in VB .net, I think ... VB uses dim to define variables. 

 

Also the program doesn't do what you think it does.  It basically enumerates the actual screens you have (if you have multiple monitors) and creates a window on each screen, maximizes it and then draws a picture in that window and once a second or something like that, a function reads the picture in the window and inverts every pixel--- it would be kinda slow because it works one pixel at a time.

 

It's not an overlay over a video game, it doesn't flip pixels that the game produces, it's just a fully maximized window with some picture in it. 

It's the equivalent of you opening a browser page in full screen and clicking on a button on that page to invert that pages' background.

 

 

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Did you specifically ask it to write C++, because that's not it... Looks like VB.

As for running along the edge, I'm not sure if this is a good approach - my gut tells me that you might end up with a visible "stripe" where the inversion happened.

Crosshair VIII Dark Hero | 5900X | NH-U14S | Asus X Noctua RTX 3070 | MP600 | 850 EVO 250 GB | Caviar Black 5 TB | SS-860 XP2 | Define R5 Black | Thaulab Varna IV -> Objective 2 -> Sennheiser HD-555/AKG K7XX/Audiotechnica ATH-M40x

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, mariushm said:

The application is written in VB .net, I think ... VB uses dim to define variables.

Damn it chat GPT how dare you! I didn't know how fast it would have to be, 1 second is pretty slow actually considering how many pixels there really are lol....good thing I tried to include a timing feature....It would probably have to be multiple pixels every screen refresh, so a few ms Vs 1 full second.

Maybe I can keep talking to it to get it to build an overlay that flips pixels.

 

 

6 minutes ago, killchain said:

Did you specifically ask it to write C++, because that's not it... Looks like VB.

As for running along the edge, I'm not sure if this is a good approach - my gut tells me that you might end up with a visible "stripe" where the inversion happened.

It told me it was C++ lol

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, leclod said:

I didn't quite understand what you're trying to do.

I do game on an Oled (last checked 14000h), I have no burn in, now.

What screen are you using.

 

(I recommend low brightness and avoiding bright red static elements)

LG C2

Currently I just have a 2nd virtual desktop that's blank with a black background, so every so often I punch the shortcut keys to refresh the entire display to black.

Just being beyond careful with it lol

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Streetguru said:

It told me it was C++ lol

Blindly trusting chatgpt with anything is a bad idea. it doesn't know what it's saying, it just predicts what is likely to follow in a conversation.

2 minutes ago, Streetguru said:

Maybe I can keep talking to it to get it to build an overlay that flips pixels.

Unlikely. Doing what you want to do without messing with everything on screen would require inserting the change in the gpu pipeline, which is not something you can do with 50 lines of c++.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Sauron said:

Blindly trusting chatgpt with anything is a bad idea. it doesn't know what it's saying, it just predicts what is likely to follow in a conversation.

Unlikely. Doing what you want to do without messing with everything on screen would require inserting the change in the gpu pipeline, which is not something you can do with 50 lines of c++.

I figured...are you sure it wouldn't be "simple" to at least create an overlay that would just go down the line turning pixels black every screen refresh?

I asked AMD if they could add something like it in the drivers, maybe the chatGPT program can at least be used as an example.

I asked it to create a game of Pong in Lua and that seemed to work fine, most likely it's best just to use it to help learn how to write code, but hopefully it won't be long before AI can just be directed to write full programs.

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

52 minutes ago, Streetguru said:

I figured...are you sure it wouldn't be "simple" to at least create an overlay that would just go down the line turning pixels black every screen refresh?

Not without a heavy performance hit. Also it would likely mess with your input since a regular window would steal focus away from the game.

53 minutes ago, Streetguru said:

most likely it's best just to use it to help learn how to write code

I'd go with normal tutorials, they're less likely to give you wrong information and they are specifically designed to teach you.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Do you really want to be looking at a display extremely obnoxiously flashing ugly stuff at you? 🤷‍♂️

F@H
Desktop: i9-13900K, ASUS Z790-E, 64GB DDR5-6000 CL36, RTX3080, 2TB MP600 Pro XT, 2TB SX8200Pro, 2x16TB Ironwolf RAID0, Corsair HX1200, Antec Vortex 360 AIO, Thermaltake Versa H25 TG, Samsung 4K curved 49" TV, 23" secondary, Mountain Everest Max

Mobile SFF rig: i9-9900K, Noctua NH-L9i, Asrock Z390 Phantom ITX-AC, 32GB, GTX1070, 2x1TB SX8200Pro RAID0, 2x5TB 2.5" HDD RAID0, Athena 500W Flex (Noctua fan), Custom 4.7l 3D printed case

 

Asus Zenbook UM325UA, Ryzen 7 5700u, 16GB, 1TB, OLED

 

GPD Win 2

Link to comment
Share on other sites

Link to post
Share on other sites

29 minutes ago, Kilrah said:

Do you really want to be looking at a display extremely obnoxiously flashing ugly stuff at you? 🤷‍♂️

The goal is to almost have it play snake across my display so the pixels get at least a moment to rest, as long as it's only a few pixels at a time it probably won't matter too much visually

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Streetguru said:

I figured...are you sure it wouldn't be "simple" to at least create an overlay that would just go down the line turning pixels black every screen refresh?

If the game is fullscreen it's a nightmare. You need to know if it's directX (1) or OpenGL (2) first.

 

1 - If it's directX you need to create a simple graphic context  and add what you need and push it on top.

 

2 - If it's OpenGL then since it's a stupid engine and there can only be a single graphic context for the whole computer you need to grab take over and use precious cycle on your app and modify each frame yourself which literally double the amount of frames you buffer (this will literally feels like you have 1 frame generated for a normal 2 frames cutting in half your fps if you want to see it this way)

 

Now these 2 options will required C++ code to have something working at reasonable performance. The other option is what i highly suggest you as the route to take is to use game in window mode. This allows you to have ANY kind of application shows on top of ANY type of content. So you could show a basic Java Swing interface on top of a Win32, DirectX or OpenGL as of an example.

 

And at that point i better suggest simple Win32 calls to instead shift the window position by 1 or 2 pixel in a random direction up/down/left/right so that the pixel do not always show the same thing. 1 or 2 pixels wont be visible to you and will increase your display life and this will not hurt the performance by any perceivable amount. A couple cycle on the CPU and that's it.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Programming aside, OLED panels usually have native pixel shifting to help prevent pixel burn-in, if I'm remember correctly.

 

Knowing this, are you still interested in your original idea?

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, Sauron said:
10 hours ago, Streetguru said:

It told me it was C++ lol

Blindly trusting chatgpt with anything is a bad idea. it doesn't know what it's saying, it just predicts what is likely to follow in a conversation.

It's good to know that my job is safe... for now.

ಠ_ಠ

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Franck said:

 

Wait a minute...I just had an idea

Using VLC and it's ability to always remain on top

 

 

2 hours ago, Toxocious said:

Programming aside, OLED panels usually have native pixel shifting to help prevent pixel burn-in, if I'm remember correctly.

 

Knowing this, are you still interested in your original idea?

Yes because this method is surefire lol

I edit my posts a lot, Twitter is @LordStreetguru just don't ask PC questions there mostly...
 

Spoiler

 

What is your budget/country for your new PC?

 

what monitor resolution/refresh rate?

 

What games or other software do you need to run?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

To me your snake/rest idea is nonsensical.

There's wear when subpixels emit light, that's it. You use the TV there's wear. Wether you snake something in or not.

 

But you've got a C2 which is supposed to be better than my E7 (for example) which is still good after 14000h.

Remember avoid high brightness if you can and static bright red elements (I had red windows icon which had burned in once)

 

I'm willing to swim against the current.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×