Texture Image Mapping

Hey guys,

We had a question about texture mapping

we’d like to map an image on a basic Quads(made) cube in basis JOGL

but we don’t no where to start, googled alot, but couldnt find (easy enough) information

Could somebody explain us how we can do this is JAVA OpenGL?

grtz

team22

PS.: 3D JOGL Environment. :smiley:

Check out Slick2d and TextureLoader. After that, use:



texture.bind();
		
glBegin(GL_QUADS);
	glTexCoord2f(0, 0);
	glVertex2f(0, 0);
	glTexCoord2f(0, texture.getHeight());
	glVertex2f(0, 50);
	glTexCoord2f(texture.getWidth(), texture.getHeight());
	glVertex2f(50, 50);
	glTexCoord2f(texture.getWidth(), 0);
	glVertex2f(50, 0);
glEnd();


Hope That Helped!

Slick’s texture loader is pretty awful. Instead you should write your own in order to understand what’s going on. Understanding textures properly should be one of the first things you learn when starting with OpenGL.

See here:


Once you’ve got a texture loader, you can implement texture atlases (AKA sprite sheets) with a TextureRegion class.