Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

How to use pgl.drawElement ?

$
0
0
Hello !

First of all, sorry if my english is not perfect, I'm from France and speak english approximately.

I'm new in Processing / OpenGL (I discovered it one month ago) but I'm good enough in ActionScript3 and have already done some projects based on GPU with FlashPlayer 11.

I'm trying to build a java library to "simulate" a Flash-project structure in Processing  (with different kinds of displayObject / DisplayObjectContainer , customEvents , ...). I actually know how to do it easily with pushMatrix and popMatrix but what I really want to do is calculate all these stuffs inside a VertexShader. 

My vertexShader works as expected with a single plane using pgl.drawArrays , but because I have no access to the 'IndexBuffer' (-> the buffer that registers the indices) with pgl.drawArray , I can't figure out how I can draw more than one "shape" in the same 'drawArrays' call.

I mean... If I undestand well (but maybe I don't) how works pgl.drawArrays , all the triangles must be interconnected , but I want to draw thousands of 'single plane' in the same 'draw call'. 

I look around in the source code of PGL.java and found pgl.drawElements and I think that's what I want :)
But, obviously, there is a problem : drawElements needs 4 int arguments and no int[]. I guess it works like pgl.getAttribLocation but I don't find the good method... I searched a lot, found some stuff for processing 1.5 but nothing for processing 2...

Can someone help me ?


Thanks !




Viewing all articles
Browse latest Browse all 1768

Trending Articles