Coder Social home page Coder Social logo

regar007 / shapesinopengles2.0 Goto Github PK

View Code? Open in Web Editor NEW
19.0 6.0 8.0 2.63 MB

Create basic shapes in opnegles2. And for abstraction purpose, its a class implementation using VBO's to create basic shapes in Open GLES2.0

License: MIT License

Java 91.08% GLSL 8.92%
gles android shapes point line triangle plane quad cube sphere

shapesinopengles2.0's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

shapesinopengles2.0's Issues

Display a Buffer Array of pixels in 2D OpenGL 2.0 ES

I want to display a fullscreen texture in 2D.
I'm implementing a mirror protocol.
The client sends me a buffer object of pixels (1920x1080) and I just grab it and I just want to display it in my
Android Screen.

Here is my buffer how I construct it :
static IntBuffer mybuffer = BufferUtils.createIntBuffer(8300000); byteBuffer.put(256) // ALPHA byteBuffer.put(150) // RED byteBuffer.put(152) // GREEN byteBuffer.put(23) // BLUE byteBuffer.put(152) // ALPHA ... etc etc

Here is my renderer :
`private class Renderer implements GLSurfaceView.Renderer {
private int[] textures = new int[1];
private int[] vertexes = new int[1];

    public void onDrawFrame(GL10 gl) {
        GLES20.glClearColor(0.1f, 0.1f, 1.0f, 1.0f);
        GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
        //step();
        GLES20.glGenTextures(1, vertexes, 0);
        GLES20.glBindTexture(GL10.GL_VERTEX_ARRAY, vertexes[0]);

        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);

        GLES20.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 1920, 1080, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, mybuffer);

        //Here I should draw but don't know how to do it.
    }

    public void onSurfaceChanged(GL10 gl, int width, int height) {
        init(width, height);
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    }
}`

I know that the order to draw something in therory is : load the texture, setup a vertex and fragment shader, create a vertex buffer for a fullscreen quad and a create vertex arrays. Then go about binding it all and issue a draw call.
Can I have some help about that ?

Thank you !

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.