TexCoordGeneration planes

I’m having trouble getting the planes in TexCoordGeneration to have an effect on the actual texture coordinate generation. I am generating 2D tex coords for a sphere, and have tried many combination of S and T planes, but the resulting tex coords do not seem to vary as a function of the planes. Has anyone else had a similar experience? I don’t see any problems in the JOGL code…

Out of curiosity, why not just use the GeoSphere (or Sphere) primitives (passing in GeometryArray.TEXTURE_COORDINATE_2)?

I believe that generates quite good texture coordinates.

Regarding your actual question, I’m afraid I havn’t used it so I’m not much help. Hopefully someone else might be able to shed some light if the alternative solution is no good.

Cheers,

Will.

The Sphere was just an example. I can generate texture coordinates for an arbitrary object just fine. In general, I want to change the orientation of a texture relative to an object (which wouldn’t really matter for a Sphere anyway). I just realized that I can use the texture transform. I’ll try that :slight_smile: It is curious that changing the tex coord generation planes doesn’t seem to have any effect though.

Is this problem relating to the bug Matthais reported in Issue 91?

Will.

Yes! I just updated from CVS and can now adjust the tex coord generation planes! Thanks Will and Matthais!

I’m having a similar problem with TexCoordGeneration.

How can I download the patch you were talking about?

And about this topic I have another question :

is there any way to normalize the vertex mapped coordinates between 0 and 1?

bye!

I just hit the same problem: the bug reappeared in the JSR renderer. I just copied the fixes over from the lwjgl renderer.

Here is the patch:


89c89,90
<     
---
> 
>     private FloatBuffer tmpPlaneBuffer = BufferUtil.newFloatBuffer(4);
154c155,162
<     
---
> 
>     private void copyPlaneToFloatBuffer(FloatBuffer planeBuf, Vector4f plane) {
>         planeBuf.put(plane.x);
>         planeBuf.put(plane.y);
>         planeBuf.put(plane.z);
>         planeBuf.put(plane.w);
>         planeBuf.flip();
>     }
157,158c165,166
<         //float[] plane = null;
<         FloatBuffer planeBuffer = null;
---
>         int glPlaneName = GL.GL_EYE_PLANE;
>         FloatBuffer planeBuf = null;
162,163c170,171
<                 //plane = new float[4];
<                 planeBuffer = BufferUtil.newFloatBuffer(4);
---
>                 glPlaneName = GL.GL_OBJECT_PLANE;
>                 planeBuf = tmpPlaneBuffer;
167,168c175,176
<                 //plane = new float[4];
<                 planeBuffer = BufferUtil.newFloatBuffer(4);
---
>                 glPlaneName = GL.GL_EYE_PLANE;
>                 planeBuf = tmpPlaneBuffer;
180c188
<       
---
> 
188,196c196,198
<               if (planeBuffer != null) {
<                   Vector4f plane = texGen.getPlaneS();
<                   planeBuffer.put(plane.x);
<                   planeBuffer.put(plane.y);
<                   planeBuffer.put(plane.z);
<                   planeBuffer.put(plane.w);
<                   planeBuffer.rewind();
<                   //texGen.getPlaneS().get(plane);
<                   gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
---
>               if (planeBuf != null) {
>                   copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                   gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
198d199
<               
207,221c208,213
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
223c215
<                
---
> 
233,256c225,233
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneR();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_R, glGenMode, planeBuffer);
<                    //texGen.getPlaneR().get(plane);
<                    //  gl.glTexGenfv(GL.GL_R, glGenMode, plane);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneR());
>                     gl.glTexGenfv(GL.GL_R, glPlaneName, planeBuf);
258d234
<                
269,297c245,256
<                if (planeBuffer != null) {
<                    Vector4f plane = texGen.getPlaneS();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_S, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneT();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_T, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneR();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_R, glGenMode, planeBuffer);
<                    plane = texGen.getPlaneQ();
<                    planeBuffer.put(plane.x);
<                    planeBuffer.put(plane.y);
<                    planeBuffer.put(plane.z);
<                    planeBuffer.put(plane.w);
<                    planeBuffer.rewind();
<                    gl.glTexGenfv(GL.GL_Q, glGenMode, planeBuffer);
---
>                 if (planeBuf != null) {
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneS());
>                     gl.glTexGenfv(GL.GL_S, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneT());
>                     gl.glTexGenfv(GL.GL_T, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneR());
>                     gl.glTexGenfv(GL.GL_R, glPlaneName, planeBuf);
> 
>                     copyPlaneToFloatBuffer(planeBuf, texGen.getPlaneQ());
>                     gl.glTexGenfv(GL.GL_Q, glPlaneName, planeBuf);

@Marvin, @Amos, @Will
You have to incorporate this patch, since I don’t have write access.
However, do you have any objections to grant CVS write access to me? Only for fixing bugs like this while toying around with the Terrain code.

Mathias

I guess you tried it out, did you? Since jogl doesn’t work with float buffers but with floats, I suspect it won’t work this way.

Is is the CanvasPeerImpl file you’re talking about?

Since this is a core related fix, you’ll have to wait for Will, to ask him for dev-role-granting. Or you can jaut mail him. Do you have his mail address? (the one in his profile is incorrect). Even if I wouldn’t object, I don’t have a vote as long has we still stay on dev.java.net :(.

Marvin

Sure 8)

Where do you get that from? Buffers just work fine in the JSR version, but you have to rewind or flip the buffer before passing it to JOGL.

Sorry for forgetting that. It’s ShapeAtomPeer.

Ok, I will write WIll a PM and have to wait…

Be it blessed, the day we’re on sourceforge. Then we could grant you fifty times the core CVS access, if you wanted to ;D ;D ;D