Note that there are some explanatory texts on larger screens.

plurals
  1. POzooming and scrolling texture of image using opengl in android
    primarykey
    data
    text
    <p>i want to zoom a image in doubleTap, make it smoothly scrollable, please help me,my draw method is below:</p> <pre><code>public void draw(GL10 gl) { // bind the previously generated texture //zooming in image if(Globalconfig.flag==1 &amp;&amp; Globalconfig.flag2==true){ currentVertex=0; Globalconfig.b_height=texture.length; //Log.d("length",""+Globalconfig.b_height); gl.glViewport(0, 0, 444, 555); gl.glOrthof(0.0f, 444, 0.0f,555, -0.1f, 0.1f); for (int y = 0; y &lt; 10+ 1; y++) { for (int x = 0; x &lt;10 + 1; x++) { //vertices[currentVertex]=vertices[currentVertex]*1.5f; //vertices[currentVertex+1]=vertices[currentVertex+1]*1.5f; texture[currentVertex]/=1.5f; texture[currentVertex+1]/=1.5f; currentVertex +=2; } } Globalconfig.flag2=false; Log.d("instextureBufferide for", "nhjfghfx" ); //vertexBuffer.put(vertices); //vertexBuffer.position(0); textureBuffer.put(texture); textureBuffer.position(0); } //zooming out image //gl.glTranslatef(0,0 , 3); if(Globalconfig.flag==2 &amp;&amp; Globalconfig.flag2==true){ currentVertex=0; for (int y = 0; y &lt;10 + 1; y++) { for (int x = 0; x &lt;10 + 1; x++) { //vertices[currentVertex]=vertices[currentVertex]/3.5f; //vertices[currentVertex+1]=vertices[currentVertex+1]/3.5f; texture[currentVertex]*=1.5f; texture[currentVertex+1]*=1.5f; currentVertex +=2; } } transtaleT=false; Globalconfig.flag2=false; Log.d("inside for2", "nhjfghfx" ); //vertexBuffer.put(vertices); //vertexBuffer.position(0); textureBuffer.put(texture); textureBuffer.position(0); } if(Globalconfig.transFlag==true &amp;&amp; Globalconfig.flag==1 ){ currentVertex=0; for (int y = 0; y &lt; 10+ 1; y++) { for (int x = 0; x &lt;10 + 1; x++) { //vertices[currentVertex]=vertices[currentVertex]*3.5f; //vertices[currentVertex+1]=vertices[currentVertex+1]*3.5f; texture[currentVertex]+=Globalconfig.x/1000 ; texture[currentVertex+1]+=Globalconfig.y/1000; currentVertex +=2; Globalconfig.x1=(int)Globalconfig.x; Globalconfig.y1=(int)Globalconfig.y; } } vertexBuffer.put(vertices); vertexBuffer.position(0); Log.d("trans", "kjgvgv"); Globalconfig.transFlag=false; Log.d("trans1", "kjgvgv"); } //gl.glViewport(50, 50, 200, 200); gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); // Point to our buffers gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Set the face rotation gl.glFrontFace(GL10.GL_CW); // Enable face culling. gl.glEnable(GL10.GL_CULL_FACE); // What faces to remove with the face culling. gl.glCullFace(GL10.GL_CONSTANT_ATTENUATION); // Point to our vertex buffer gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT ); // Draw the vertices as triangle strip //gl.glTranslatef(0, 0, -4); //gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); gl.glDrawElements(GL10.GL_TRIANGLES, numOfIndices, GL10.GL_UNSIGNED_SHORT, indicesBuffer); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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