Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>EDIT: my bad, I just saw that you're looking for an gl 1.0 example</p> <p>Looks like you're looking for a multi-texture example: <a href="http://code.google.com/p/opengles-book-samples/source/browse/trunk/Android/Ch10_MultiTexture/src/com/openglesbook/multitexture/MultiTextureRenderer.java?r=45" rel="nofollow">http://code.google.com/p/opengles-book-samples/source/browse/trunk/Android/Ch10_MultiTexture/src/com/openglesbook/multitexture/MultiTextureRenderer.java?r=45</a></p> <p>It's an opengl es 2.0 example. When you read the code, you'll see that the actual blending of the texture is done is in the fragmentshader.</p> <p>EDIT 2 : I couldn't find a opengl-es 1.1 example, but I have some old opengl 2.0 code lying around. It's in c/c++, so you'll have to convert it to java yourself.</p> <p>I looked up the GLES 1.1 spec, and it seems it supports the key functions from my code: glActiveTexture, glMultiTexCoord and glTexEnvi, so this may help get you started...</p> <pre><code>glActiveTextureARB( GL_TEXTURE0_ARB ); glBindTexture( GL_TEXTURE_2D, KdMapIndex ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glActiveTextureARB( GL_TEXTURE1_ARB ); glBindTexture(GL_TEXTURE_2D, KaMapIndex); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); glBegin(GL_TRIANGLES); for (face = faces.begin(); face != faces.end(); face++) { CVector3f normal; CVector2f texture0, texture1, texture2; CVector3f vertex0, vertex1, vertex2; normal.x = data.normals[face-&gt;nIndex[0]-1].x; normal.y = data.normals[face-&gt;nIndex[1]-1].y; normal.z = data.normals[face-&gt;nIndex[2]-1].z; normal.normalize(); texture0 = data.texcoords[face-&gt;tIndex[0]-1]; texture1 = data.texcoords[face-&gt;tIndex[1]-1]; texture2 = data.texcoords[face-&gt;tIndex[2]-1]; vertex0 = data.vertices[face-&gt;vIndex[0]-1]; vertex1 = data.vertices[face-&gt;vIndex[1]-1]; vertex2 = data.vertices[face-&gt;vIndex[2]-1]; glNormal3f(normal.x, normal.y, normal.z); // Face normal glMultiTexCoord2fARB( GL_TEXTURE0_ARB, texture0.x, texture0.y ); // texcoord 0 glMultiTexCoord2fARB( GL_TEXTURE1_ARB, texture0.x, texture0.y ); glVertex3f(vertex0.x, vertex0.y, vertex0.z); // vertex 0 glMultiTexCoord2fARB( GL_TEXTURE0_ARB, texture1.x, texture1.y ); // texcoord 1 glMultiTexCoord2fARB( GL_TEXTURE1_ARB, texture1.x, texture1.y ); glVertex3f(vertex1.x, vertex1.y, vertex1.z); // vertex 1 glMultiTexCoord2fARB( GL_TEXTURE0_ARB, texture2.x, texture2.y ); // texcoord 2 glMultiTexCoord2fARB( GL_TEXTURE1_ARB, texture2.x, texture2.y ); glVertex3f(vertex2.x, vertex2.y, vertex2.z); // vertex 2 } glEnd(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload