Giter VIP home page Giter VIP logo

natario1 / egloo Goto Github PK

View Code? Open in Web Editor NEW
140.0 140.0 21.0 5.07 MB

A lightweight Kotlin multiplatform framework for OpenGL ES and EGL management based on object-oriented components, inspired by Google's Grafika.

Home Page: https://natario1.github.io/Egloo

License: MIT License

Kotlin 100.00%
android android-library android-sdk egl egl-wrapper gles gles2 gles3 google-grafika kotlin kotlin-multiplatform multiplatform native opengl-drawing opengl-es opengl-framework opengles

egloo's People

Contributors

dependabot[bot] avatar natario1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

egloo's Issues

Use VirtualDisplay as texture source, seems only render the topleft point of the display

In my project, I want render a virtual display use opengl and then encode to H264 stream, I change some code of VideoActivity
infoflow 2020-09-02 20-07-10
infoflow 2020-09-02 20-07-27
Instead pass surface to VideoPlay, I use it to create VirtualDisplay, then show a simple Presentation on it.
infoflow 2020-09-02 20-12-56
infoflow 2020-09-02 20-19-03
The third picture is the layout of my presentation, on top left, I have 1dp x 1dp ImageView with background color #ffff00.
the forth picture is actual render result, It seems it just render top left point of my layout, other part of my layout does't show up.
I'm new to opengl, I google this problem and found nothing.
Please help me! thanks.

Can't add the library

Hi,
Although I followed the step in README, I couldn't add the library to my project.

App level gradle file:

plugins {
   id 'com.android.application'
   id 'kotlin-android'
}

android {
   compileSdk 31

   defaultConfig {
       applicationId "com.myapps.myapplication"
       minSdk 23
       targetSdk 31
       versionCode 1
       versionName "1.0"

       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   }

   buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
       }
   }
   compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_8
       targetCompatibility JavaVersion.VERSION_1_8
   }
   kotlinOptions {
       jvmTarget = '1.8'
   }
   buildFeatures {
       viewBinding true
   }
}

dependencies {

   implementation 'androidx.core:core-ktx:1.6.0'
   implementation 'androidx.appcompat:appcompat:1.3.1'
   implementation 'com.google.android.material:material:1.4.0'
   implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
   implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
   implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
   implementation("com.otaliastudios.opengl:egloo-android:0.6.1")
   testImplementation 'junit:junit:4.+'
   androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Top level gradle file:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.2"
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Errors:

* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.otaliastudios.opengl:egloo-android:0.6.1.
     Required by:
         project :app
      > No matching variant of com.otaliastudios.opengl:egloo-android:0.6.1 was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - Variant 'releaseApiElements-published' capability com.otaliastudios.opengl:egloo-android:0.6.1 declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
          - Variant 'releaseRuntimeElements-published' capability com.otaliastudios.opengl:egloo-android:0.6.1 declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)

and there are other similar errors.

Thanks.

GlTextureProgram don't have TextureId

Hi, I'm trying to combine CameraView and Transcoder in my app
they both working great,
but when I download the CameraView project to my app and used it as an implementation project
i got this weird bug in VideoDecoderOutput class line 60 -

.NoSuchMethodError: No virtual method getTextureId()I in class Lcom/otaliastudios/opengl/program/GlTextureProgram; or its super classes

I've noticed when i use the libraries as implementation as describe in the docs... its working fine but the
Egloo library in the gradle external libraries is version 23... can you tell me whats going on?

Unable to add Egloo to the android project

Hello!

I tried to add the library to the demo android project from the current repo and got an error. It also not importing into my project. Could you please help me with it?

I replaced
implementation(project(":library"))
with
implementation("com.otaliastudios.opengl:egloo-android:0.5.3")

error:
`Could not determine the dependencies of task ':app:compileDevDebugJavaWithJavac'.

Could not resolve all task dependencies for configuration ':app:devDebugCompileClasspath'.
Could not resolve com.otaliastudios.opengl:egloo-android:0.5.3.
Required by:
project :app
> Unable to find a matching variant of com.otaliastudios.opengl:egloo-android:0.5.3:
- Variant 'androidJvm-releaseApiElements' capability com.otaliastudios.opengl:egloo-android:0.5.3:
- Incompatible attribute:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Other attributes:
- Required cloud 'dev' but no value provided.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
- Variant 'androidJvm-releaseRuntimeElements' capability com.otaliastudios.opengl:egloo-android:0.5.3:
- Incompatible attribute:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Other attributes:
- Required cloud 'dev' but no value provided.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
- Variant 'metadata-api' capability com.otaliastudios.opengl:egloo-android:0.5.3:
- Incompatible attributes:
- Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-metadata'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found incompatible value 'common'.
- Other attributes:
- Required cloud 'dev' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Found org.gradle.status 'release' but wasn't required.
- Variant 'metadata-commonMainMetadataElements' capability com.otaliastudios.opengl:egloo-android:0.5.3:
- Incompatible attributes:
- Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found incompatible value 'common'.
- Other attributes:
- Required cloud 'dev' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Found org.gradle.status 'release' but wasn't required.

`

Documentation: How to use the GlFrameBuffer?

Hey, I am trying to render to a texture using a framebuffer, but I can't seem to make it work, could you help me out here?

So I am setting up a SurfaceView and tried a simple rendering, which works just fine:

        val core = EglCore(flags = EglCore.FLAG_TRY_GLES3)
        val window = EglWindowSurface(core, surface)
        window.makeCurrent()

        val simpleProgram = GlFlatProgram()
        simpleProgram.setColor(Color.GREEN)
        val circle = GlCircle()
        circle.radius = 0.15F
        simpleProgram.draw(circle)

        // Publish
        window.swapBuffers()

But when I am trying to render to a FBO it crashes:

        val core = EglCore(flags = EglCore.FLAG_TRY_GLES3)
        val window = EglWindowSurface(core, surface)
        window.makeCurrent()

        val simpleProgram = GlFlatProgram()
        simpleProgram.setColor(Color.GREEN)
        val circle = GlCircle()
        circle.radius = 0.15F

        val fbTexture = GlTexture()
        val fbo = GlFramebuffer()
        fbo.attach(fbTexture, GLES20.GL_COLOR_ATTACHMENT0)
        fbo.bind()

        simpleProgram.draw(circle)

        // Publish
        window.swapBuffers()

java.lang.RuntimeException: Error during draw start: glError 0x502: invalid operation

Could you help me out with a working sample or a pinpoint in what's wrong? I couldn't glean much more from the docs.

Kotlin 1.4.0 compatibility

Hey, it seems that egloo has a compatibility issue with kotlin 1.4

java.lang.NoSuchMethodError: No static method get-impl([II)I in class Lkotlin/UIntArray; or its super classes (declaration of 'kotlin.UIntArray' appears in [...]
        at com.otaliastudios.opengl.texture.GlTexture.<init>(GlTexture.kt:90)
        at com.otaliastudios.opengl.texture.GlTexture.<init>(GlTexture.kt:30)
        at com.otaliastudios.opengl.texture.GlTexture.<init>(GlTexture.kt:29)
...

Hi! - sponsoring Egloo development

Hi! ๐Ÿ‘‹

I am Mattia, the main developer and maintainer here, and I have enabled the GitHub Sponsor button on this repository which will let you support the library development by sponsoring my open source work through GitHub itself.

In the last years, I have spent countless unpaid hours on this and other projects, designing and developing tools that solve real problems, for everyone to use. I am very happy to know that companies of all sizes benefit from my work everyday.

GitHub is now offering you the opportunity to thank back with a sponsorship. For individuals, it could be a small amount. For companies that are powered by my tools, it could be a fairly small percentage of their revenue. In any case, your support will be greatly appreciated (and for bigger amounts, you get things like private support hours, or something else if you prefer).

https://github.com/sponsors/natario1

I will experiment leaving this as a pinned issue - for a while at least - since it's where people are most likely to see it. Sorry if this bothers you, and thank you all for your help.

Validate shaders at runtime

This is possibly a kind of niche request, but I am building an application that lets users write their own shaders. I am looking for a way to catch compile errors before they are eventually caught in draw (resulting in a Fatal exception). I have tried with the following, but this fails to compile:

            val dummyShader = """
                precision mediump float;
                void main() {
                    gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
                }
            """.trimIndent()
            GlShader(GL_FRAGMENT_SHADER.toInt(), dummyShader)

I am not sure what else I need to do to get any shader to compile in this context (I am calling this outside of any Egloo class, in my own code).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.