Hi All
I have got a texture , when the user zooms in i get a better resolution image and then replace the texture with the new image. the following is the code … but the texture replace returns without any effect , the texture is not replaced.
Please help
Thanks
Schiz
my display method
Extents imgExtents = mbr.getImgExtents();
Extents scrExtents = mbr.getScrExtents();
// if(features.isReady())
// GLQueue.getInstance().add(features);
GL gl = drawable.getGL();
GLQueue.getInstance().execute(gl);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glShadeModel(GL.GL_SMOOTH);
texture.enable();
texture.bind();
gl.glTexEnvf(GL.GL_TEXTURE_ENV,GL.GL_TEXTURE_ENV_MODE,GL.GL_REPLACE);
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2d(imgExtents.myBottomX,imgExtents.myBottomY);
gl.glVertex2d(scrExtents.myBottomX, scrExtents.myBottomY);
gl.glTexCoord2d(imgExtents.myBottomX, imgExtents.myTopY);
gl.glVertex2d(scrExtents.myBottomX,scrExtents.myTopY);
gl.glTexCoord2d(imgExtents.myTopX, imgExtents.myTopY);
gl.glVertex2d(scrExtents.myTopX, scrExtents.myTopY);
gl.glTexCoord2d(imgExtents.myTopX, imgExtents.myBottomY);
gl.glVertex2d(scrExtents.myTopX, scrExtents.myBottomY);
gl.glEnd();
texture.disable();
texture.enable();
texture.bind();
ImagePool.getInstance().replace(texture);
texture.disable();
// features.execute(gl);
drawable.swapBuffers();
the replace method
public void replace(Texture texture)
{
if(data[curPos] == null || exts[curPos] == null) return;
System.out.println("Replacing ");
MyConverter conv = IVContext.getContext().getWinToWorld();
for(int i = 0 ; i < 3 ; i ++ )
{
if(exts[i] == null) continue;
Extents temp = conv.toScreen(exts[i]);
texture.updateSubImage(data[i], 0,(int)temp.getBottomX(),(int)temp.getBottomY());
}