Logo
Explore Help
Sign In
railbird/react-native-vision-camera
10
0
Fork 0
You've already forked react-native-vision-camera
Code Issues Pull Requests Packages Projects Releases Wiki Activity
react-native-vision-camera/package/android/src/main/cpp/OpenGLTexture.h

23 lines
408 B
C++
Raw Normal View History

feat: Use C++ OpenGL GPU VideoPipeline again (#1836) 1. Reverts https://github.com/mrousavy/react-native-vision-camera/commit/4e96eb77e0755edf5a4351d61fa36d60415f1db6 (PR #1789) to bring the C++ OpenGL GPU Pipeline back. 2. Fixes the "initHybrid JNI not found" error by loading the native JNI/C++ library in `VideoPipeline.kt`. This PR has two downsides: 1. `pixelFormat="yuv"` does not work on Android. OpenGL only works in RGB 2. OpenGL rendering is fast, but it has an overhead. I think for Camera -> Video Recording we shouldn't be using an entire OpenGL rendering pipeline. The original plan was to use something similar to how it works on iOS by just passing GPU buffers around, but the android.media APIs just aren't as advanced yet. `ImageReader`/`ImageWriter` is way too buggy and doesn't really work with `MediaRecorder`/`MediaCodec`. This sucks, I hope in the future we can use something like `AHardwareBuffer`s.
2023-09-22 17:22:31 +02:00
//
// Created by Marc Rousavy on 30.08.23.
//
#pragma once
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stdexcept>
struct OpenGLTexture {
enum Type { Texture2D, ExternalOES };
// The ID of the texture as returned in glGenTextures(..)
GLuint id;
// GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES
GLenum target;
// Width and height of the texture
int width = 0;
int height = 0;
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.2 Page: 408ms Template: 17ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API