ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

How to create the buffer used in GL10.glVertexPointer(int size, int type, int stride, Buffer pointer) ? #53

Open agGitHub opened 12 years ago

agGitHub commented 12 years ago

I have got the following code in my Cocos2D-iOS program:

CGPoint corners[10];

for(int i = 0; i < 10; i++) { corners[i] = CGPointMake(0, 0); }

glVertexPointer(2, GL_FLOAT, 0, corners);

that I would like to "translate" like this in Cocos2D-Android:

CGPoint[] corners = new CGPoint[4];

for(int i = 0; i < 10; i++) { corners[i] = CGPoint.make(0, 0); }

(CCDirector.gl).glVertexPointer(2, GL10.GL_FLOAT, 0, corners);

but corners should be a "Buffer" according to GL10.glVertexPointer definition.

How to create such a buffer with my CGPoints ?

Thanks !

PS: I am new on Cocos2D-Android, sorry for my potentially trivial questions...

gwennguihal commented 12 years ago

See CCDrawPrimitives.java

agGitHub commented 12 years ago

Thanks for your answer but I don't see any CCDrawPrimitives in the ZhouWeikuan source files (I dont' use the jar but the source files). Where can I find this class ? Thanks.