mirror of
https://github.com/libretro/RetroArch
synced 2025-01-28 14:54:03 +00:00
more camera changes, still no image
This commit is contained in:
parent
5dc58dc461
commit
b6af8b0e92
@ -26,6 +26,7 @@ public final class RetroActivity extends NativeActivity
|
||||
|
||||
public void onCameraStart()
|
||||
{
|
||||
Log.i("RetroActivity", "onCameraStart");
|
||||
mCamera.startPreview();
|
||||
}
|
||||
|
||||
@ -43,7 +44,12 @@ public final class RetroActivity extends NativeActivity
|
||||
public boolean onCameraPoll()
|
||||
{
|
||||
boolean ret;
|
||||
if (texture != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
if (texture == null)
|
||||
{
|
||||
Log.i("RetroActivity", "no texture");
|
||||
ret = false;
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
{
|
||||
long newTimestamp = texture.getTimestamp();
|
||||
if (newTimestamp != lastTimestamp)
|
||||
@ -72,9 +78,10 @@ public final class RetroActivity extends NativeActivity
|
||||
@SuppressLint("NewApi")
|
||||
public void onCameraSetTexture(int gl_texid) throws IOException
|
||||
{
|
||||
Log.i("RetroActivity", "onCameraSetTexture: " + gl_texid);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
{
|
||||
texture = new SurfaceTexture(gl_texid);
|
||||
texture = new SurfaceTexture(gl_texid);
|
||||
mCamera.setPreviewTexture(texture);
|
||||
}
|
||||
else
|
||||
|
@ -115,6 +115,11 @@ static bool android_camera_start(void *data)
|
||||
(void)androidcamera;
|
||||
|
||||
glGenTextures(1, &androidcamera->tex);
|
||||
glBindTexture(GL_TEXTURE_EXTERNAL_OES, androidcamera->tex);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
CALL_VOID_METHOD_PARAM(androidcamera->env, android_app->activity->clazz, androidcamera->onCameraSetTexture, (int) androidcamera->tex);
|
||||
|
||||
@ -159,7 +164,7 @@ static bool android_camera_poll(void *data, retro_camera_frame_raw_framebuffer_t
|
||||
|
||||
if (frame_gl_cb)
|
||||
frame_gl_cb(androidcamera->tex,
|
||||
GL_TEXTURE_2D, // TODO: This is likely GL_TEXTURE_EXTERNAL_OES.
|
||||
GL_TEXTURE_EXTERNAL_OES,
|
||||
affine);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user