i am developing an openGL application, where different images are positioned in a circle.
See picture:

Turning the circle works perfect.
But my big problem is, to move all images to the front image.
My draw()-methode in the renderer is this:
- Code: Select all
// -10° around x-axis
gl.glRotatef(10, 1, 0, 0);
// turns the circle (y-axis)
gl.glRotatef(m_Modell.getRotation(), 0, 1, 0);
for (int i = 0; i < m_Modell.getNrOfCovers() ; i++)
{
cover = m_Modell.getCover(i);
gl.glPushMatrix();
fX = cover.getX();
fY = 0;
fZ = cover.getZ();
// moves the cover to the position
gl.glTranslatef(fX, fY, fZ);
// turns each cover against the rotation (Y-axis)
gl.glRotatef(-m_Modell.getRotation(), 0, 1, 0);
// turns each cover against the x-rotation
gl.glRotatef(-10, 1, 0, 0);
// moves the cover to center
gl.glTranslatef(-fX, -fY, -fZ);
// DRAWING
// loading cover coordinates
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, m_alCoverPoints.get(i));
// reset color
gl.glColor4f(0, 0, 0, 0);
// bind texture
gl.glBindTexture(GL10.GL_TEXTURE_2D, cover.getClip().getCoverTexturId());
// load texture coordinates
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, m_fbTexturPunkte);
// draw
gl.glDrawElements(GL10.GL_TRIANGLES, 2 * 3, GL10.GL_UNSIGNED_SHORT, m_sbIndices);
gl.glPopMatrix();
}
In m_Modell i change de cover coordinates with this calculation formula:
Xnew = Xold + (Xgoal - Xold) * movingProgress // moving progress 0.0 - 1.0 where 0.0 = no moving
Znew = Zold + (Zgoal - Zold) * movingProgress
This works in one position from the carousel, but in all different positions the images moving confused.
I hope you understand my bad english.
I need your help.
Thx and regards Harry

