public static void test() { Matrix44 m = new Matrix44(); m.setValue(0, 0, 1.0f); m.setValue(1, 1, 1.0f); m.setValue(2, 2, 1.0f); m.setValue(3, 3, 1.0f); float[] o1 = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; float[] o2 = m.getVector(); for (int i = 0; i < 16; i++) Check.AssertEquals(o1[i], o2[i]); }
public void Bind() { Gl.glEnable(Gl.GL_TEXTURE_CUBE_MAP); Gl.glBindTexture(Gl.GL_TEXTURE_CUBE_MAP, textures[0]); if (type == CubeMapType.Reflective) { Matrix44 m, invert; float[] modelview = new float[16]; Gl.glGetFloatv(Gl.GL_MODELVIEW_MATRIX , modelview); m = new Matrix44(modelview); invert = m.invert(); Gl.glMatrixMode(Gl.GL_TEXTURE); Gl.glPushMatrix(); Gl.glMultMatrixf(invert.getVector()); Gl.glTexGeni(Gl.GL_S, Gl.GL_TEXTURE_GEN_MODE, Gl.GL_REFLECTION_MAP); Gl.glTexGeni(Gl.GL_T, Gl.GL_TEXTURE_GEN_MODE, Gl.GL_REFLECTION_MAP); Gl.glTexGeni(Gl.GL_R, Gl.GL_TEXTURE_GEN_MODE, Gl.GL_REFLECTION_MAP); Gl.glEnable(Gl.GL_TEXTURE_GEN_S); Gl.glEnable(Gl.GL_TEXTURE_GEN_T); Gl.glEnable(Gl.GL_TEXTURE_GEN_R); } }