Code Monkey home page Code Monkey logo

opengl's Introduction

OpenGL

Create OpenGL shapes and apply transformations using finger gestures

Image

About

Kotlin Library used for detecting finger gestures and applying there corresponding transformation to a 3x3 Matrix that is then converted in to a FloatArray that hold values for the 4x4 OpenGL matrix. That way you can apply the following transformations: scale, translation and rotation to the matrix and then use it to apply the transformations to OpenGL shapes.

Platform API Download

Supported OpenGL shapes are:

  • Circle
  • Ellipse
  • Image
  • Line
  • PassByCurve
  • IrregularPolygon
  • Rectangle
  • RegularPolygon
  • Triangle

Add to your project

Add the jitpack maven repository

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency

dependencies {
  implementation 'com.github.slaviboy:OpenGL:v0.2.0'
}

How to use

Adding shapes is easy, the code below is example of creating a OpenGL rectangle. To learn more on how to implement your own OpenGL view and draw the shapes you can read the official wiki page here.

// gesture detector used for applying transformations to all OpenGL objects: line, images, triangles..
val mainGestureDetector: OpenGLMatrixGestureDetector = OpenGLMatrixGestureDetector()

// create program for shapes that use the same colors
val singleColorsProgram = OpenGLStatic.setSingleColorsProgram()

// create single rectangle
val rectangle = Rectangle(
     x = 300f,
     y = 200f,
     width = 300f,
     height = 150f,
     color = Color.BLACK,
     strokeWidth = 5f,
     gestureDetector = mainGestureDetector,
     preloadProgram = singleColorsProgram,
     style = Shapes.STYLE_FILL
)

opengl's People

Contributors

slaviboy avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

opengl's Issues

Rotation not working properly with Texture

when I rotate a texture with this gesture it is change perspective of texture, it's look like 3d rotation and change vertex position.(convert code in java, if possible)

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.