Hi, I am trying to port an application from gl4java to jogl and I am having a probelm with getting textures to work.
I had read somewhere (I don’t remember where) that texture at one point wern’t working in jogl. However I note from the recent postings that they seem to be working.
I have tried the hwShadowmapsSimple demo but that dosen’t do anything after opening up the frame and I have to kill it to get it to go away.
My test code looks like:
Inside init:
int[] terrainTextureId = new int[1];
gl.glGenTextures(1, terrainTextureId);
gl.glEnable(GL_TEXTURE_2D);
gl.glBindTexture(GL_TEXTURE_2D, terrainTextureId[0]);
gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
gl.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
where image is a byte array filled with one color.
Inside display I bind it and display it but the texture dosen’t show. Now this is code which works perfectly in gl4java so I feel sure that it’s procedurally correct.
Is there something that I’m missing?
Thanks.