
			
			/*
			//new////////////////
			int bufname[]=new int[1];
			gl.glGenBuffers(1, bufname, 0);
			gl.glBindBuffer(GL.GL_PIXEL_UNPACK_BUFFER, bufname[0]); //BindBuffer(UNPACK, foo)
			
			
			 
			int width=256, height=256;
			int size=width*height;
			gl.glBufferData(GL.GL_PIXEL_UNPACK_BUFFER, size, null, GL.GL_STREAM_DRAW); //Allocate buffer  //gl.glBufferData(UNPACK, size, null, STREAM_DRAW)
			ByteBuffer b = gl.glMapBuffer(GL.GL_PIXEL_UNPACK_BUFFER, GL.GL_WRITE_ONLY);
			
			int i=0;
			for(int y=0;y<height;y++)
				for(int x=0;x<width;x++)
					{
					i=(i+1)%2;
					b.put((byte)(i*128));
					}
			
			//b.put(otherbuffer)
			//TODO write data

			
			gl.glUnmapBuffer(GL.GL_PIXEL_UNPACK_BUFFER);//			UnmapBuffer(UNPACK)
			gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 1, width, height, 0, GL.GL_ALPHA, GL.GL_BYTE,bufname[0]);
			//void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); 
			//http://objectmix.com/graphics/136360-implementing-directx-style-texture-creation-locking-unlocking.html
			//end new ///////////////////////////////////
			*/		
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
//if one ever wish to build it in the background:
//GLContext glc=view.getContext();
//glc.makeCurrent(); 
//GL gl=glc.getGL();
// ... glc.release();


/**
 * should allow multiple texture units to be used, cut texture transfer rate when sorting
 */

/*
uploading texture in BG
http://lists.apple.com/archives/Mac-opengl/2007/Feb/msg00063.html
*/


					
					//gl.GL_MAX_3D_TEXTURE_SIZE
					//gl.GL_MAX_TEXTURE_UNITS
					
					
					/**
					 * 
					 * JOGL http://www.felixgers.de/teaching/jogl/texture3D.html
					 * 
					 * unsigned int texname;
glGenTextures(1, &texname);
glBindTexture(GL_TEXTURE_3D, texname);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, WIDTH, HEIGHT, DEPTH, 0, GL_RGB, 
             GL_UNSIGNED_BYTE, texels);
             
             power of 2 in x,y,z
             
             */ 
             /*
             GL_MAX_TEXTURE_SIZE,
This is only an estimate
    glTexImage2D(GL_PROXY_TEXTURE_2D, level, internalFormat, width, height, border, format, type, NULL); 
Note the pixels parameter is NULL, because OpenGL doesn't load texel data when the target parameter is GL_PROXY_TEXTURE_2D. Instead, OpenGL merely considers whether it can accommodate a texture of the specified size and description. If the specified texture can't be accommodated, the width and height texture values will be set to zero. After making a texture proxy call, you'll want to query these values as follows:
    GLint width; glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); if (width==0) { cannot use } 
             
					 */
			
			
			
			
			
				