opengl GL.GetUniformLocation always returns ZERO (0)

元气小坏坏 提交于 2019-12-12 05:51:02

问题


Am using OpenGL ES30 with Xamarin/C#.

My issue is that no matter what I do, when I call:

OpenTK.Graphics.ES30.GL.GetUniformLocation(progID, "varName");

It ALWAYS returns ZERO. (not -1).

The following statements all return 0:

int RRRRRRRR = GL.GetUniformLocation(Terrain3D.TileShader.Id, "NOTVALIDNAME");
RRRRRRRR = GL.GetUniformLocation(-1, "ALSONOTVALID");
RRRRRRRR = GL.GetUniformLocation(-1, "BOGUSZZZZ");
RRRRRRRR = GL.GetUniformLocation(-1, "");

These are all bogus values (even for Program ID in all but 1st case), yet they all return ZERO(0) rather than -1. I call them before GL.UseProgram() or after, with valid or invalid arguments -- and all I get back is a the same 0(ZERO), no matter what.

I searched google for any issues that resemble this and found nothing.

It looks to me like my OpenTK ES30 DLL's are hosed in some fashion. This is maddening.

I'm gonna try hooking up to other OpenTK versions. Any help from others would be a god send.

EDIT: Found the Fix!

From the AndroidGameView constructor, I needed to call:

ContextRenderingApi = OpenTK.Graphics.GLVersion.ES3;

Without this, the API defaults to ES1, even though I'm using the ES3.GL for everything.

来源:https://stackoverflow.com/questions/45574726/opengl-gl-getuniformlocation-always-returns-zero-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!