private bool loadTexture(String fn, int idx) { if (fn == null) { return(false); } OpenGLTexture tex; tex = tl.Get(fn); if (tex != null) { tex.refcnt++; return(true); } needinittex = true; tex = new OpenGLTexture(idx); tex.name = fn; if (!tex.Load(fn)) { Console.WriteLine("Error:Failed to load texture:" + fn); return(false); } tex.refcnt = 1; tl.Set(fn, tex); return(true); }
public OpenGLScene() { freeglidlist = new List <int>(); reset(); texturePath = ""; blankTexture = new OpenGLTexture(0); blankTexture.Set(new uint[] { 0xffffffff }, 1, 1); //white pixel }
//directly load a texture public bool SetTexture(String fn, uint[] px, int w, int h, int idx) { OpenGLTexture tex = tl.Get(fn); if (tex == null) { tex = new OpenGLTexture(idx); tl.Set(fn, tex); } else { tex.loaded = false; } tex.Set(px, w, h); needinittex = true; return(false); }
private bool InitTexture(OpenGLTexture tex) { return(tex.Load()); }