如何使用python为3D图形设置动画

时间:2017-09-26 04:01:20

标签: python pandas animation matplotlib

我正在努力使用python动画3d图形。我希望代码逐帧绘制图形,以便我知道主题随时间的移动。 (我使用运动分析数据,我试图绘制主体的运动图。)我的所有数据都存储在csv文件中,我将其配置为3 * 200阵列。 (x,y,z轴为3列; import matplotlib.pyplot as plt import pandas as pd import matplotlib.animation as animation df = pd.DataFrame(data4, columns = ["x", "y", "z"]) fig = plt.figure() ax = fig.add_subplot(111, projection = "3d") def update(i): offsets3d = (df.x.values[:i], df.y.values[:i], df.y.values[:i]) ax.set_xlim(-500,500) ax.set_ylim(-500,500) ax.set_zlim(-500,500) ani = animation.FuncAnimation(fig, update, frames =len(df), interval = 250) plt.show() )这是我的代码:

void TextureManager::createTexture3D(TextureManager::TexturesInfo 
*texturesInfo, GLuint textureName)
{
    glError();
    glBindTexture(GL_TEXTURE_3D, texturesInfo->tex[textureName]);
    glError();
    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glError();
    GLint level = 0, border = 0;

    GLint rgbType = GL_RGBA32F;
    GLint format = GL_RGBA;
    glTexImage3D(GL_TEXTURE_3D, level, rgbType, LPV::LPV_WIDTH, LPV::LPV_HEIGHT, LPV::LPV_DEPTH, border, format, GL_FLOAT, NULL);
    glError();
}

0 个答案:

没有答案