Hello.
I sure it’s impossible but I prefer to ask.
I’m holding position two square in one FloatBuffer. Changing position only one of them is no problem but
if is there a way to rotate only one of them (and stel holding them in same FloatBuffer)?
In code below all square rotating
float rquad;
FloatBuffer vertexData;
FloatBuffer colorData;
public void gameLoop(){
final int amountOfVertices = 64;
final int vertexSize = 3;
final int colorSize = 3;
vertexData = BufferUtils.createFloatBuffer(amountOfVertices * vertexSize);
vertexData.put(new float[]{
-0.5f, 0.5f, 0.0f, 0.5f, 0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, -0.5f, 0.0f,
1.0f, 0.5f, 0.0f, 2.0f, 0.5f, 0.0f, 2.0f, -0.5f, 0.0f, 1.0f, -0.5f, 0.0f
});
vertexData.flip();
colorData = BufferUtils.createFloatBuffer(amountOfVertices * colorSize);
colorData.put(new float[]{
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f});
colorData.flip();
while(running) {
update();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();//Matrix reseting.
GL11.glTranslatef(0.0f, 0.0f, -6.0f); // Move Right And Into The Screen
GL11.glRotatef(rquad, 0.5f, 0.5f, -0.5f); // Rotate The Cube On X, Y & Z
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(vertexSize, 0, vertexData);
glColorPointer(colorSize, 0, colorData);
glDrawArrays(GL_QUADS, 0, amountOfVertices);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
Display.sync(60);
Display.update();
}
Display.destroy();
}
private void update(){
rquad-=0.05f;
}