简体   繁体   中英

How to tell OpenGL ES 2.0 which vertices to use?

I want to draw a simple texture in 2d. Previously i used OpenGL ES 1.0 and i told OpenGL which vertices to use like this:

glEnableClientState(GL10.GL_VERTEX_ARRAY);
glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);

Now I want to do it in OpenGL ES 2.0, but Eclipse gives me errors when i try it like this, so i googled alot and found code like this:

GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
                                 GLES20.GL_FLOAT, false,
                                 vertexStride, vertexBuffer);

The tutorial first creates a shader program and compiles it and then passes it to this function. But I dont want to use shaders, i dont need them. Is there an other way to tell OpenGL wich vertices to use without shaders?

OpenGL ES 2.0 requires you to provide your own shaders written in GLSL. The fixed pipeline, which you used in ES 1.0, is not available anymore.

The only way around writing your own shaders is to use a higher level toolkit that creates the shaders for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM