{"id":13400005,"url":"https://github.com/googlecreativelab/shadercam","last_synced_at":"2025-05-07T17:47:55.570Z","repository":{"id":70992180,"uuid":"39399473","full_name":"googlecreativelab/shadercam","owner":"googlecreativelab","description":"Simple OpenGL Shaders with the camera2 apis in Android 5.0+","archived":false,"fork":false,"pushed_at":"2018-12-05T19:25:25.000Z","size":190,"stargazers_count":240,"open_issues_count":12,"forks_count":66,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-07-31T19:23:15.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.androidexperiments.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlecreativelab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-07-20T17:56:03.000Z","updated_at":"2024-06-07T13:46:52.000Z","dependencies_parsed_at":"2024-01-18T11:11:57.743Z","dependency_job_id":"b9fd2be6-2f88-4d6c-bd49-d2d8bc73db49","html_url":"https://github.com/googlecreativelab/shadercam","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlecreativelab%2Fshadercam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlecreativelab%2Fshadercam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlecreativelab%2Fshadercam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlecreativelab%2Fshadercam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlecreativelab","download_url":"https://codeload.github.com/googlecreativelab/shadercam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252930387,"owners_count":21827043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:46.423Z","updated_at":"2025-05-07T17:47:55.523Z","avatar_url":"https://github.com/googlecreativelab.png","language":"Java","funding_links":[],"categories":["Image Processing"],"sub_categories":[],"readme":"shadercam\n=========\n\nSimple OpenGL Shaders with the [camera2](https://developer.android.com/reference/android/hardware/camera2/package-summary.html) apis in Android 7.0+\n\nexamples\n--------\n\nCheck out [`shadercam-example`](https://github.com/googlecreativelab/shadercam/tree/master/shadercam-example) here for basic usage.\n\nAlso, **shadercam** was built for usage with a couple Android Experiments:\n\n* [Lip Swap](https://github.com/googlecreativelab/lipswap)\n* [Tunnel Vision](https://github.com/googlecreativelab/tunnelvision)\n\npermissions\n-----------\n\n**updated 10/31/18**\n\n**shadercam** is now using [RecordableSurfaceView](https://github.com/UncorkedStudios/recordablesurfaceview) to draw to the screen as well as record video. This means some things have changed but compatibility across devices has improved. See below for a guide on upgrading. All previous classes and methods are still available, so the new API is non-breaking, but includes no fixes for pre-2.0 versions.\n\nusage (as of release-2.0)\n-----\n\nImport **shadercam** in your `build.gradle` file:\n\n```\nimplementation project(':shadercam')\n```\nor\n\nIn the project gradle add jitpack:\n\n```\nrepositories {\n        google()\n        jcenter()\n        maven { url 'https://www.jitpack.io' }\n\n    }\n```\nAnd then in your app gradle, add the dependency for shadercam:\n\n```\nimplementation 'com.github.uncorkedstudios:shadercam:2.0.1'\n```\n\nIntegration Example\n-----\n_**Changed from v1.0:** shadercam now expects that a VideoRenderer be created and attached before  connecting to the Camera preview service. This is more in line with OpenGL renderer lifecycle patterns_\n\n**shadercam** comes with a simple implementation of the camera2 apis called `VideoFragment`, which only\nrequires that you add a `RecordableSurfaceView` to your layout.\n\n```\n    \u003ccom.uncorkedstudios.android.view.recordablesurfaceview.RecordableSurfaceView\n        android:id=\"@+id/texture\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_alignParentTop=\"true\" /\u003e\n```\n\nThen it is a fairly simple matter of configuring and attaching the Camera management fragment:\n\n```\nprivate void setupCameraFragment(VideoRenderer renderer) {\n\n        mVideoFragment = VideoFragment.getInstance();\n        mVideoFragment.setCameraToUse(VideoFragment.CAMERA_FORWARD);\n        \n        //pass in a reference to the RecordableSurfaceView - this is important\n        mVideoFragment.setRecordableSurfaceView(mRecordableSurfaceView);\n\n        //Connect your renderer\n        mVideoFragment.setVideoRenderer(renderer);\n\n        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\n        transaction.add(mVideoFragment, TAG_CAMERA_FRAGMENT);\n        transaction.commit();\n    }\n```\nOnce the VideoFragment has been provided a renderer (a default one is provided in the case where you do not provide a custom one), and a RecordableSurfaceView to render onto, it can then be added to the activity and brought to life for viewing the camera feed. \n\nIn order to record to a video file, there are a few more steps to take.\n\nFor example, in this implementation of  onResume, we make sure that `RecordableSurfaceView` has a handle to a file that it has permissions to write a movie file to: \n\n```\npublic void onResume() {\n   ...\n               \n    mRecordableSurfaceView.initRecorder(mCurrentVideoFile, size.x, size.y, null, null);\n    \n    ...\n}\n```\n\n\u003e Note that phones with Notches may behave differently based on the underlying system's implementation, for example, the outputs of [getRealSize](https://developer.android.com/reference/android/view/Display#getRealSize(android.graphics.Point)) vs. [getSize](https://developer.android.com/reference/android/view/Display#getSize(android.graphics.Point)) in the [Display](https://developer.android.com/reference/android/view/Display) class will return different shapes that either include or exclude the notch. \n\n\nLifecycle\n----\nThe new `VideoRenderer` class implements `RecordableSurfaceView.RendererCallbacks` so your top-level renderer can recieve lifecycle callbacks like onSurfaceChanged and onDrawFrame - closer to the native [GLSurfaceView.Renderer](https://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer) pattern.\n\n\u003e `public void onSurfaceCreated()`\n\n\n\u003e `public void onSurfaceChanged(int width, int height) `\n\netc. \n\nExamples:\n----\nCheck out `MeetupActivityV2`, `SimpleRSVShaderActivity` and `ExampleVideoRenderer` in `shadercam-example` for some straightforward example code.\n\nmore info\n---------\n\nIf you make something cool with shadercam, let us know by heading over to [Android Experiments](http://www.androidexperiments.com) and submitting your experiment!\n\nReport any issues [here](https://github.com/googlecreativelab/shadercam/issues) - we love pull requests!\n\nlicense\n-------\n\n```\nCopyright 2018 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecreativelab%2Fshadercam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecreativelab%2Fshadercam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecreativelab%2Fshadercam/lists"}