Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation on call of GL.DrawElements in Tutorial 6 #11

Open
uzername opened this issue May 28, 2019 · 1 comment
Open

Access violation on call of GL.DrawElements in Tutorial 6 #11

uzername opened this issue May 28, 2019 · 1 comment
Assignees

Comments

@uzername
Copy link

GL.DrawElements(BeginMode.Triangles, v.IndiceCount, DrawElementsType.UnsignedInt, indiceat * sizeof(uint));

I am using OpenTK 3.0.1 from official Nuget, and I get access violation (writing attempt to protected memory) error on this line. In tutorial 5 you use GL.DrawArrays and it's fine there

@neokabuto
Copy link
Owner

neokabuto commented Jun 2, 2019

This is sort of an embarrassingly long standing issue. It seems to be something non-deterministic that loves to "fix" itself. I've spent hours trying to figure it out, but it's really inconsistent on when it happens.

Can you try the change I added in the OpenTK 3 PR, https://github.com/neokabuto/OpenTKTutorialContent/pull/13/files#diff-816f14b5ba6b1b047326f50ca21fe968R167 (thanks again for inspiring me to finally upgrade these)? I'm pretty sure I finally (not sure why it took me so long) figured out it's a race condition where the first render code was running before the first update code occasionally (which I thought I had tested for previously with no success, but it seems to work). This if statement just prevents it from trying to render until we know we have some vertices to draw.

@neokabuto neokabuto self-assigned this Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants