English 中文(简体)
公开数据表2.0
原标题:orthographic projection matrix in Opengl-es 2.0
float pfIdentity[] =
{
    -1.0f,0.0f,0.0f,0.0f,
    0.0f,1.0f,0.0f,0.0f,
    0.0f,0.0f,1.0f,0.0f,
    0.0f,0.0f,0.0f,1.0f
};

=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

    const char* pszVertShader = "
    attribute highp vec4    myVertex;
    uniform mediump mat4    myPMVMatrix;
    invariant gl_Position;
    void main(void)
    {
        gl_Position = myPMVMatrix * myVertex;
}";

================================================================================================================================================================================================================================================================

for(int i = 0; i < 80000; ++i)
{
    glClear(GL_COLOR_BUFFER_BIT);
    int i32Location = glGetUniformLocation(uiProgramObject, "myPMVMatrix");
    glUniformMatrix4fv( i32Location, 1, GL_FALSE, pfIdentity);
    glEnableVertexAttribArray(VERTEX_ARRAY);
    glVertexAttribPointer(VERTEX_ARRAY, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glDrawArrays(GL_TRIANGLES, 0,i);
    eglSwapBuffers(eglDisplay, eglSurface);
}

return 0;
}

p.s : i 正在Bubuntu 10.10中与Kronos头盔进行开关,后者是开放式电筒2.0。

最佳回答

你们根本不会有预测。 页: 1

float pfIdentity[] =
{
    -1.0f,0.0f,0.0f,0.0f,
    0.0f,1.0f,0.0f,0.0f,
    0.0f,0.0f,1.0f,0.0f,
    0.0f,0.0f,0.0f,1.0f
};

/* ... */

glUniformMatrix4fv( i32Location, 1, GL_FALSE, pfIdentity);

BTW: The idea of uniforms is, that you don t set them at each primitive iteration.

不管怎么说,这是个特征矩阵,由于它是唯一的转变,它只会通过vert,因为它们正处于碎块阶段。 解决你的问题的方法是,对它进行地理预测,即用直线预测矩阵把这一矩阵乘起来,而是使用这一作业的结果。 rel=“nofollow” http://www.songho.ca/opengl/gl_projectionmatrix.html

问题回答

暂无回答




相关问题
OpenGL ES iPhone - drawing anti aliased lines

Normally, you d use something like: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); glLineWidth(2.0f); glVertexPointer(2, GL_FLOAT, 0, points); ...

iPhone: Quartz2d vs. OpenGL ES

OK, I m still brand new to iPhone development. I have a free game on the app store, Winner Pong, but it s just a Pong clone (who would ve guessed) that uses the standard UIImageViews for the sprites. ...

GLPaint with white background

I m trying draw on a white background by reverse engineering GLPaint. I ve gone through every combination of kSaturation, kLuminosity and glBlendFunc, AND just about every combination I can think of ...

OpenGL ES - how to keep some object at a fixed size?

I m working on a little game in OpenGL ES. In the background, there is a world/map. The map is just a large texture. Zoom/pinch/pan is used to move around. And I m using glOrthof (left, right, bottom,...

Any free polygon library for the iPhone?

I need a library that can manage polygon modeling and basic transformation like rotating and translating. I d rather not redevelop everything from scratch Thanks

热门标签