Two questions about StripBox

Hey everyone,

The first question is about the normals computation for StripBox. See the comments in the method below :slight_smile:
protected void duUpdateGeometryNormals() {
if (getBuffer(Type.Normal) == null){
float[] normals = new float[8 * 3];

        Vector3f[] vert = computeVertices();
        Vector3f norm = new Vector3f();
        for (int i = 0; i < 8; i++) {
            normals[i * 3 + 0] = norm.x;
            normals[i * 3 + 1] = norm.x;//<---------------------- Y ?????
            normals[i * 3 + 2] = norm.x;//<---------------------- Z ?????
        setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));


The second question is about textures. I created s StripBox and applied a material with texture. But the texture only appears on the back faces never on the front ones.
The object looks sunken which is definitely not good :slight_smile:
I tried changing some material properties
but none of the available options work.
Any other suggestions ???

are you sure you want a stripbox not a box?

Yeah, I am pretty sure :slight_smile:

Can you describe more about what you are really trying to achieve?

FaceCullMode.FrontAndBack hides both faces, you’d want FaceCullMode.Off

I just tried the StripBox (never used it before), and the top/bottom texture coordinates seem screwed as well

OK guys, I took the liberty to make the fixes to StripBox :slight_smile:
Sorry that I messed up with somebody’s code without permission. But below I show how the StripBox changed after those fixes :slight_smile:

This picture was made for shadeless material with texture before the change.
bad indexes
You see that the texture is visible inside the cube and not outside.

And here is after my fixes.
good indexes

I changed GEOMETRY_INDICES_DATA to fix that. Now it has the following values:
private static final short[] GEOMETRY_INDICES_DATA =
{ 0, 1, 4,

And one more fix with normals computing.
I applied a lighting material and put a point light at (10, 10, 10).
Here is the view without the change:
bad normals

And here after the change:
good normals

I commited what I pointed out in my first post in this topic :slight_smile:

This class is not used too often but still I think that it should not contain errors.
And I hope I did not mess anything else :wink:

1 Like