Comments (8)
I took a look at this. My first inclination was to dismiss it, as I couldn't reproduce the jank. But I looked very closely and did perceive a little jank, occasionally. A tiny amount, maybe once every 100 frames. Barely perceptible unless you look for it continuously and closely for a while.
So I decided to measure it. Here's a histogram, with milliseconds-per-frame on the x axis:
go-gl/glfw
C program using just glfw/glfw
Thoughts
Note the extremes on the left and the right. This data only represents a few seconds of runtime, so those individual data points are significant.
In any case I don't know if the effect I'm seeing is the same as @rucuriousyet is reporting, since we don't know what kind of choppiness he was experiencing. What we need is more data. Can someone report back with their frame timings? If you dump them in a file and attach them here, I can make a histogram. I'm just taking the elapsed
time variable in gl41core-cube
.
You can see there is quite a wide skew. I have run with GODEBUG=gctrace=1,schedtrace=1
, but don't see anything correlating with the long frames on the Go side. There is no garbage collection occurring. This effect is observable even if I turn off all code except for glfw.SwapBuffer
.
Based on what I've seen I think this could be a real (but subtle) effect, but I don't know what is at fault. It looks like it is glfw or something deeper in the stack. (I'm on recentish Nvidia drivers on Linux on a powerful card). The effect is so subtle to my eye that if it were present in other software I may not have noticed it. I can notice the effect worsening if I inject random delays of 1-5ms, implying that the delays shown in the above histograms might be the cause.
We're at the limits of what I'm able to debug for now. It would be interesting if someone is able to grab a fine time resolution trace and figure out where the time is getting lost. Maybe there is a bug in to be fixed somewhere in the stack :)
from example.
I don't see any choppiness or lag on my computer. It's a MacBook Pro with AMD Radeon HD 6770M 1 GB video card, running macOS 10.13.3. It seems to run locked to vsync at 60 hz (my monitor's refresh rate), without any skipped or dropped frames. I'm running go1.10beta2
, but I never had issues with Go 1.9 or earlier.
What system do you have (CPU, GPU, OS, Go version, etc.)? If other people with similar systems can reproduce your issue, then it might be an issue in the code.
One way you can find out if the issue is with Go or elsewhere is by running a similar example from the GLFW C library (http://www.glfw.org/). If it happens there too, then it's not Go. If it doesn't, then the issue is somewhere here.
from example.
from example.
@rucuriousyet are you getting > 60 FPS ? in my experience, vsync is usually disabled (or broken) by the driver and the higher framerate can cause choppiness & input lag due to having less CPU/GPU cycles when needed.
from example.
from example.
Ah, gotcha. In that case I'm not really sure what the cause would be. Sorry I couldn't help!
from example.
from example.
Oh, I just noticed cube.go
isn't turning vsync on. Maybe it should be?
@rucuriousyet Can you try adding glfw.SwapInterval(1) // Vsync.
to the source code (after window is created and its context is made current) and see if that helps your issue?
from example.
Related Issues (20)
- Improve unfriendly requirement that examples must be run in their package directory. HOT 2
- Go 1.6 -msan option error (memory sanitizer) HOT 6
- build error on OSX, go1.6 HOT 2
- [Question] Unable to run examples, only background windows showing in GL window HOT 4
- multiple contexts HOT 6
- Proposal: Rename repository to "example". HOT 6
- Specify permissive license. HOT 5
- Examples are broken HOT 1
- More information in examples HOT 2
- gl21-cube: Cube in demo appears squashed. HOT 6
- frame rate drops proportionally to number of process instances HOT 5
- Handle leak on Windows at SetSize? HOT 4
- fatal error: checkptr: unsafe pointer arithmetic on Go 1.14rc1 HOT 1
- Re: github.com/go-gl/example/gl41core-cube/cube.go HOT 1
- Can I render a webpage at the window HOT 1
- c:\go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 HOT 1
- gl.GenTextures
- Error when binding in loop HOT 1
- Cel Shader Example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from example.