How to make Texture???

Hi,

I wanted to create a 2D game, first of all i had made it only with Canvas but the Pogramm had a bad performance.
I had read that OpenGL is even ideal for 2DGraphics, so I made a few tutorials but my Problem is, that the tutorials are not up-to-date, for exapmle there is a class named factory used for creating the GLCanvas.

And the Tutorial wich explain how to make a 2Dgame with OpenGL is written for Delphi.

I had written all the Programm in Java(wich connects with a server…because it should be a OnlineRGPGame) so i want to write still in java.

Maybe there is a easier way for Programming a 2d Game with a nice performance, and i will be thankful if somebody could tell me, but i also would know how actually textures are going to create in JOGL.

I had allready my Images created in a BufferedImage, so i would to prefer not to use a ImageFileLoader.

I only want to know how to draw a Texture(BufferedImage) on a simple Polygon.

I made my Homework so i know that there is a class named TextureData with the constructor:

TextureData(int internalFormat, int pixelFormat, boolean mipmap, BufferedImage image)

And i knows that Textures had to be activated first with: gl.glEnable(GL.GL_TEXTURE_2D);

and i know that there is a function: gl.glTexImage2D(GL.GL_TEXTURE_2D,0,GL.GL_RGBA,8,8,0,GL.GL_RGBA,GL.GL_INT,texDat.getBuffer());

but i dont know actually what i had to do that Jogl draws the texture wich is in my BufferedImage on a Polygone.

Thanks for Answers.

P.S.

If u dont want to write me a answer but u know either a easier way or an up-to-date, well done tutorial i would be glad.

Thanks

http://www.cokeandcode.com/node/10

The source code for demos.texture.TestTexture in the jogl-demos workspace shows how to draw a Texture on a polygon. You don’t need to make any explicit calls to glTexImage2D or glEnable; these are done in the Texture implementation.

Thanks…

I had read the TestTexture demo src and then I saw in the API, that the Class TextureIO is not only good for file reading.
It is general responsible for creating the Texture object and i found the function:
newTextureData(BufferedImage image, boolean mipmap)

so I could create my Textureobjekt out of my BufferedImage.