Announcement

Collapse
No announcement yet.

Renderable with color does not work

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Renderable with color does not work

    So I am currently trying to add color to a renderable. My problem is that the PointCloud that I want to render is just grey. It works fine in a normal OpenGL window but in WorldWind it's just grey.

    I am basically using the same code as here https://worldwind.arc.nasa.gov/java/...om-renderable/ but my draw method is of course different and I am using a VBO.

    public void draw(DrawContext drawContext){

    gl.glEnable(GL2.GL_DEPTH_BUFFER_BIT);

    int stride = 0;

    gl.glEnableClientState(GL2.GL_VERTEX_ARR AY);

    gl.glEnableClientState(GL2.GL_COLOR_ARRA Y);

    gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, VBO.get(0));

    gl.glInterleavedArrays(gl.GL_C3F_V3F,0,0 );

    InterleavedBuf.rewind();

    gl.glPointSize(4);

    gl.glDrawArrays(GL_POINTS, 0, InterleavedBuf.limit()/6);

    InterleavedBuf.rewind();

    gl.glPointSize(1);

    gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);

    gl.glDisableClientState(GL2.GL_VERTEX_AR RAY);

    gl.glDisableClientState(GL2.GL_COLOR_ARR AY);

    gl.glDisable(GL2.GL_DEPTH_BUFFER_BIT);

    }
    //putting the Color and Vertex values into a DirectFloatBuffer and then into the VBO
    //interleaveArrays Method just interleaves the color and vertex arrays.
    // It looks like this as example : 0.8f , 0.0f, 0.7f, <- colorValues
    // 0.75f, 0.3f, 0.4f <- vertexPositions
    // and so on...
    InterleavedBuf = Buffers.newDirectFloatBuffer(interleaveA rrays(normalizeColors(colorValues),verte x_positions));

    InterleavedBuf.position(0);

    gl.glBufferData(GL2.GL_ARRAY_BUFFER, InterleavedBuf.limit()*Float.BYTES, InterleavedBuf,GL_STATIC_DRAW);

    InterleavedBuf.position(0);

    I am using a normal RenderableLayer and haven't done anything regarding picking or ordering. Does anyone know what the issue might be? I have the feeling it has maybe something with the renderable or RenderableLayer to do.
Working...
X