java - Draw a line in Open GL ES 2.0 -


i'd draw line of fixed color given 2 points can change @ will.

i have other objects i've got shaders , textures on take code snippets on have way more code think necessary simple line. i'm new open gl es 2.0 , cant figure out how put yellow 3d line on screen without making holder object.

this in ondrawframe method of renderer

    private void drawtestline() {        float[] lineendpoints = new float[6];        system.arraycopy(nearpoint, 0, lineendpoints , 0, nearpoint.length);        system.arraycopy(farpoint, 0, lineendpoints , 3, farpoint.length);  //need here        gles20.gldrawarrays(gles20.gl_lines, 0, 2);     } 

vertex shader:

attribute vec3 a_posl; uniform mat4 u_mvpmatrix; void main() {     gl_position = u_mvpmatrix*vec4(a_posl,1.0); } 

fragment shader:

precision mediump float; uniform vec4 u_linecolor; void main() {     gl_fragcolor = u_linecolor; } 

once have these shaders, pass position, color , matrix using glvertexattribpointer , gluniforms


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -