Esempio n. 1
0
        public CubeMapTexture(String texturePath, CubeMapType type)
        {
            if (!texturePath.EndsWith("/"))
                texturePath += "/";

            this.type = type;
            textures = new int[1];
            Gl.glGenTextures(1, textures);
            Gl.glBindTexture(Gl.GL_TEXTURE_CUBE_MAP, textures[0]);

            Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
            Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR);
            Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE);
            Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE);
            Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_TEXTURE_WRAP_R, Gl.GL_CLAMP_TO_EDGE);

            Pixmap pixmap;

            for(int i = 0; i < 6; i++)
            {
                // Load this texture map
                Gl.glTexParameteri(Gl.GL_TEXTURE_CUBE_MAP, Gl.GL_GENERATE_MIPMAP, Gl.GL_TRUE);
                pixmap = new Pixmap(texturePath + path[i] + ".bmp");
                Gl.glTexImage2D(cube[i], 0, pixmap.Bpp, pixmap.Width, pixmap.Height, 0, pixmap.getFormat(), Gl.GL_UNSIGNED_BYTE, pixmap.Data);
            }
        }
Esempio n. 2
0
        public BasicTexture(Pixmap pixmap, TextureFilter textureFilter)
        {
            int[] TempGL = new int[1];

            Gl.glGenTextures(1, TempGL);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, TempGL[0]);

            Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, pixmap.Bpp, pixmap.Width, pixmap.Height, pixmap.getFormat(), Gl.GL_UNSIGNED_BYTE, pixmap.Data);

            textureID = TempGL[0];
            this.textureFilter = textureFilter;
            width = pixmap.Width;
            height = pixmap.Height;
        }
Esempio n. 3
0
 public BasicTexture(Pixmap pixmap)
     : this(pixmap, TextureFilter.MipMap)
 {
 }
Esempio n. 4
0
        public void RegenerateTexture(Pixmap pixmap)
        {
            if (pixmap.Width > width || pixmap.Height > height)
                throw new NotSupportedException("Cannot regenerate texture if the new texture is bigger than the old");
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, textureID);

            Gl.glTexSubImage2D(Gl.GL_TEXTURE_2D, 0, 0, 0, pixmap.Width, pixmap.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, pixmap.Data);
        }