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

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

Open
BradChase2011 opened this issue Aug 13, 2019 · 5 comments
Open

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

BradChase2011 opened this issue Aug 13, 2019 · 5 comments

Comments

@BradChase2011
Copy link

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

@luca-piccioni
Copy link
Owner

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?

@BradChase2011
Copy link
Author

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

@BradChase2011
Copy link
Author

BradChase2011 commented Aug 15, 2019

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?

@luca-piccioni
Copy link
Owner

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.

@BradChase2011
Copy link
Author

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.

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