luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is the Android sample "HelloTriangle.Xamarin.Android" broken?

BradChase2011 opened this issue · comments

I have switched my code over from OpenTK for android to see how OpenGL.Net is. Everything I have tried only gives me a black screen with the latest code.

So I decided to try the sample and start with something simple. Only problem is, that renders a black screen as well. The .Clear color will show but that is it. Is it currently broken or am I missing something that I need to put in?

Thanks much!
Brad

Probably the sample cannot be run on all devices. Context is created, otherwise ClearColor wouldn't work. Probably is the shader source that is missing something.

Is some error returned? Is the shader source correct for the GL version where running on? I'm not an expert when talking about GLES....

Maybe #version directive should be specified?

Yea I noticed there was no version declared, but it wasn't throwing an error so I didn't put too much into it as I am in the same boat when it comes to ES. I'll take a peak tomorrow and try to get it running as it's a heck of alot smaller than our codebase. On the other hand I did notice we had to change alot of the Gen** functions like GenTexture because they weren't working. Once we moved them to the plurals like GenTextures then we could move on. So there might be some larger issues at hand

Well I changed it over to 320 es and still cant get anything to render on screen.

Here is the code I used:


		private readonly string[] _Es2_ShaderVertexSource = new string[] {
            "#version 320 es\n",
            "uniform mat4 uMVP;\n",
            "layout (location = 0) in vec2 aPosition;\n",
            "layout (location = 1) in  vec3 aColor;\n",
            "out vec3 vColor;\n",
			"void main() {\n",
			"	gl_Position = uMVP * vec4(aPosition, 0.0, 1.0);\n",
			"	vColor = aColor;\n",
			"}\n"
		};
		private readonly string[] _Es2_ShaderFragmentSource = new string[] {
            "#version 320 es\n",
            "precision mediump float;\n",
            "out vec4 outputColor;\n",
            "in vec3 vColor;\n",
			"void main() {\n",
            "	outputColor = vec4(vColor, 1.0);\n",
			"}\n"
		};

If you have any ideas I can try, I would love to give them a shot. The example is so simple I just cant see what is wrong. Would you mind running a test on an android device?

Would you mind running a test on an android device?

The sample was run on Android emulator and on my old Samsung S4 device, and in both cases the sample was presenting the colored triangle. It was 2 year ago, but I think that nothing has changed from then.

I'll try to get the sample running again when my spare time and my computer are available.

Ok thanks much. We're going to move back to opentk for the time being but would love if you could get that chance, thanks much for putting the time into all of this. Btw I'll run it on the emulator today just to check that.