ZhouWeikuan/cocos2d — Issue #53: How to create the buffer used in GL10.glVertexPointer(int size, int type, int stride, Buffer pointer) ?
Author: agGitHub
Created: 2011-12-14 21:48:22+00:00
State: open

I have got the following code in Cocos2D-iOS:

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...