Hi,
I am wanting to project a movie onto a rectangle into a rectangle in 3D space. The code I found for playing movies is fine, the example of texturing works, but when I put them together they don’t seem to work. After trying to see what is going wrong, it looks like I am probably doing something wrong in the OpenGL code. So I tried reducing it to the most simple case and tried creating a blue texture, but I still get a white rectangle, as if the texture was not being applied:
Buffer pixels = null;
ByteBuffer byteBuffer = ByteBuffer.allocate(width * height * 3);
for ( int row=0; row<heigh; row++ ) {
for ( int col=0; col<width; col++ ) {
byteBuffer.put((byte)0);
byteBuffer.put((byte)0);
byteBuffer.put((byte)0xFF);
}
}
byteBuffer.rewind();
pixels = byteBuffer;
gl.glGenTextures(3, textures,0); /* * */
gl.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexImage2D(GL.GL_TEXTURE_2D,
0,
GL.GL_RGB,
320,
240,
0,
GL.GL_RGB,
GL.GL_UNSIGNED_BYTE,
pixels);
Any ideas?
On a separate note is that I can load to textures, but sometimes when I give them different names they all seem to be using the same image.