/// <summary> /// Copy the supplied image onto a newly-allocated OpenGL texture, returning the allocated texture name /// </summary> public virtual int AllocateAndSetupTexture(Bitmap par1Bitmap) { SingleIntBuffer.Clear(); GLAllocation.GenerateTextureNames(SingleIntBuffer); int i = SingleIntBuffer.Get(0); SetupTexture(par1Bitmap, i); TextureNameToImageMap.AddKey(i, par1Bitmap); return(i); }
/// <summary> /// Compiles a GL display list for this model /// </summary> private void CompileDisplayList(float par1) { DisplayList = GLAllocation.GenerateDisplayLists(1); //GL.NewList(DisplayList, ListMode.Compile); Tessellator tessellator = Tessellator.Instance; for (int i = 0; i < CubeList.Count; i++) { CubeList[i].Render(tessellator, par1); } //GL.EndList(); Compiled = true; }
public virtual int GetTexture(string par1Str) { TexturePackBase texturepackbase = TexturePack.SelectedTexturePack; if (TextureMap.ContainsKey(par1Str)) { return(TextureMap[par1Str]); } try { SingleIntBuffer.Clear(); GLAllocation.GenerateTextureNames(SingleIntBuffer); int i = SingleIntBuffer.Get(0); if (par1Str.StartsWith("##")) { SetupTexture(UnwrapImageByColumns(ReadTextureImage(texturepackbase.GetResourceAsStream(par1Str.Substring(2)))), i); } else if (par1Str.StartsWith("%clamp%")) { ClampTexture = true; SetupTexture(ReadTextureImage(texturepackbase.GetResourceAsStream(par1Str.Substring(7))), i); ClampTexture = false; } else if (par1Str.StartsWith("%blur%")) { BlurTexture = true; SetupTexture(ReadTextureImage(texturepackbase.GetResourceAsStream(par1Str.Substring(6))), i); BlurTexture = false; } else if (par1Str.StartsWith("%blurclamp%")) { BlurTexture = true; ClampTexture = true; SetupTexture(ReadTextureImage(texturepackbase.GetResourceAsStream(par1Str.Substring(11))), i); BlurTexture = false; ClampTexture = false; } else { Stream inputstream = texturepackbase.GetResourceAsStream(par1Str); if (inputstream == null) { SetupTexture(MissingTextureImage, i); } else { SetupTexture(ReadTextureImage(inputstream), i); } } TextureMap.Add(par1Str, i); return(i); } catch (Exception exception) { Utilities.LogException(exception); } GLAllocation.GenerateTextureNames(SingleIntBuffer); int j = SingleIntBuffer.Get(0); SetupTexture(MissingTextureImage, j); TextureMap.Add(par1Str, j); return(j); }