Thank you very much for the info. We’ve read the manual part once again and that, combined with the tips you gave us, lead to a better understanding. However, our texture doesn’t seem to know that and keeps refusing to show up. So, here’s a follow up to your kind reply.
In init we do something like this.
this.gl.glEnable (GL.GL_TEXTURE_2D);
BufferedImage img = ImageIO.read (new File ("grass.gif"));
byte[] data = ((DataBufferByte) img.getRaster ().getDataBuffer ()).getData ();
this.gl.glBindTexture (GL.GL_TEXTURE_2D, 0);
this.gl.glTexImage2D (target, 0, GL.GL_RGB, img.getWidth (), img.getHeight (), 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, data);
this.gl.glTexEnvf (GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL);
We’ve checked that the byte[] contains something and, in fact, the right number of something’s, namely 2562 elements. So, give or take that the file itself is screwed up, we still got a set of 65536 elements between 0 and 255. It should be suitable for texturing. Please point out any mistakes we’ve done here.
In display we do something like this.
this.gl.glBegin (GL.GL_QUADS);
this.gl.glColor3d (1.0, 0.9, 0.1);
this.gl.glBindTexture (GL.GL_TEXTURE_2D, 0);
this.gl.glTexCoord2d (0, 0); this.gl.glVertex3d (0, 0, 0);
this.gl.glTexCoord2d (1, 0); this.gl.glVertex3d (30, 0, 0);
this.gl.glTexCoord2d (1, 1); this.gl.glVertex3d (30, 30, 0);
this.gl.glTexCoord2d (0, 1); this.gl.glVertex3d (0, 30, 0);
this.gl.glEnd ();
We use glBindTexture (GL.GL_TEXTURE_2D, 0) twice. Once in init, to get the byte[] to the graphic card and assign it an ID (namely zero), and then a second time in display to make it the current texture.
The result is still a yellow square with hardly any grass on it (unless we’re regarding some really hot and dry country where all grass actually is yellow). What did we done stupidishly this time?