Jump to content
Android Forum - A Community For Android Users and Enthusiasts

Problem with OpenGL image on top of camera preview


TobiasReich
 Share

Recommended Posts

Hello everyone,

I have a problem with my new Galaxy S3 and I hope someone here might help me with that.

I'M trying to make an AR-app. So I have a Camera-Preview and on top of it an OpenGLES SurfaceView.

So I render some objekts on the camera image.

On my old Galaxy S1 and the S2 everything works great.

But now I got a problem on my new S3. The colors look "burning" for the transparent pixels. Opaque pixels look all fine.

 

If you want, here is a picture of my problem:

glProblem.jpg

 

Nobody really seems to know that problem so I'm thinking it might be a problem with my phone.

I made a very small test program to show this. You may download the code here:

dl.dropbox.com/u/13527005/CameraGLTest.zip

or if you only want to test it you will find the .apk here:

dl.dropbox.com/u/13527005/CameraGLTest.apk

So everyone - even if you are not a programmer - may help me finding the problem.

 

I would be very, very glad for any information about this.

Even if you tell me it works perfectly fine on your S3. After all than I would know I have a problem with my phone!

Thank you very much for your help!

Tobias

Link to comment
Share on other sites

Alright, I got an answer for that.

The problem was the premultiplication for the alpha values.

So in the easiest way it is enough to write:

 

vec3 color = clamp(textureColor.rgb * lightWeighting.xyz, 0.0, 1.0);

color *= 0.5; // premultiply by alpha

gl_FragColor = vec4(color, 0.5);

 

Even though I don't see why it worked perfectly fine on older systems and it I'm still not sure how to manage this on Gl1.0 where I can't write my own shader code.

So hope this helps to anyone who has the same problem!

Thanks,

Tobias

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...