OpenGL: flickering/artifacts on integrated Intel HD Graphics

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 816 Views - Last Post: 01 August 2019 - 02:26 AM Rate Topic: -----

#16 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7020
  • View blog
  • Posts: 23,840
  • Joined: 05-May 12

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 16 July 2019 - 04:29 AM

I hope these are not the vertical lines you are talking about because I'm not even pressing any keys to do any phase shifting yet:
Attached Image
Was This Post Helpful? 0
  • +
  • -

#17 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7020
  • View blog
  • Posts: 23,840
  • Joined: 05-May 12

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 16 July 2019 - 04:38 AM

I fixed those vertical lines by changing the internal float to double within generateSineWave():
void generateSineWave(std::vector<float>& vertices, int samplingFreq, int numPoints)
{
    size_t newSize = 4 * size_t(numPoints);
    if (vertices.size() != newSize) {
        vertices.resize(newSize);
    }
    constexpr double waveFreq = 2.f;
    constexpr double coeff = 0.95f;
    double t0 = -1.f;
    double timeStep = 1.f / samplingFreq;
    double omega = 2 * 3.1415927f * waveFreq;
    for (size_t i = 0; i < size_t(numPoints); ++i) {
        double t = t0 + i * timeStep;
        double val = coeff * sinf(omega * (t + phaseShift));
        vertices[4 * i] = t;
        vertices[4 * i + 1] = 0.f;
        vertices[4 * i + 2] = t;
        vertices[4 * i + 3] = val;
    }
}



I'll look into this some more later. If I can revive the laptop, I'll give it a go there too. Anyway, "I owe. I owe. Off to work I go."
Was This Post Helpful? 0
  • +
  • -

#18 GazinAtCode   User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 138
  • Joined: 26-September 16

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 16 July 2019 - 05:57 AM

That's very strange. :) Looks like another possible bug. What I end up seeing is usually something like this. (The screenshot was taken on my other laptop, and the problem is exactly the same as on the first one.) Switching to double precision doesn't seem to fix it.

Attached image(s)

  • Attached Image

This post has been edited by GazinAtCode: 16 July 2019 - 06:19 AM

Was This Post Helpful? 0
  • +
  • -

#19 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7020
  • View blog
  • Posts: 23,840
  • Joined: 05-May 12

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 16 July 2019 - 03:39 PM

I'm using a dedicated GPU (ATI Radeon R9) and got this:
Attached Image

My repro steps were:
Click on Maximize button.
Click on Minimize button.
Click on taskbar to restore.
Click on "Restore Down" button.
Press left or right arrow key.
Was This Post Helpful? 0
  • +
  • -

#20 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7020
  • View blog
  • Posts: 23,840
  • Joined: 05-May 12

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 16 July 2019 - 07:05 PM

Look at the second parameter to glDrawElements(). It is supposed to be a count of items, not a number of bytes.

At least it fixed the problem from my repro steps above. Works on my machine. :)
Was This Post Helpful? 1
  • +
  • -

#21 GazinAtCode   User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 138
  • Joined: 26-September 16

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 19 July 2019 - 09:30 AM

Thanks a lot! Not sure why I thought it was the byte size. That part had actually been copied from some code I had written a few months before, I guess. Maybe there's another similar function with slightly different parameters. I can't test it right now, as I'm away on vacation with no computer around, but when I'm back, God willing, I'll give it a try. I'm positive it will work, though. :)
Was This Post Helpful? 0
  • +
  • -

#22 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7020
  • View blog
  • Posts: 23,840
  • Joined: 05-May 12

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 19 July 2019 - 06:17 PM

Enjoy your vacation!
Was This Post Helpful? 0
  • +
  • -

#23 GazinAtCode   User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 138
  • Joined: 26-September 16

Re: OpenGL: flickering/artifacts on integrated Intel HD Graphics

Posted 01 August 2019 - 02:26 AM

Thanks! And yes, that was the reason.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2