   Too much time for a bitmap!!
  Hi there :)I was rendering an object composed of simple QUADS ,and this object keeps rotating along x as the rotation angle value changes every time the drawing method is called .My problem started when I tried to perform texture mapping using bitmap images .When the quads were finally textured , I found that the rotation of the object was too slow .. and then I noticed that the loadBitmap function was the one which took too much time .I'm using Tao framework with C#.Texture class :public class Texture    {   #region Attributes   public uint[] texture;   public string path;   public double texSStep;   public double texTStep;   #endregion   #region Methods   public Texture(string path)   {  texture = new uint[1];  this.path = path;  this.texTStep = 1.0 / 256.0;  this.texSStep = 1.0 / 256.0;  loadBitmap();   }   private void loadBitmap()   {  Bitmap image = null;  System.Drawing.Imaging.BitmapData bitmapdata = null;  Rectangle rect;  try  { image = new Bitmap(this.path); image.RotateFlip(RotateFlipType.RotateNoneFlipY); rect = new Rectangle(0, 0, image.Width, image.Height); bitmapdata = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Gl.glGenTextures(1, texture); Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture[0]); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR); // Linear Filtering Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR); // Linear Filtering Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGB8, image.Width, image.Height, 0, Gl.GL_BGR_EXT, Gl.GL_UNSIGNED_BYTE, bitmapdata.Scan0);  }  catch (Exception e)  { // Handle Any Exceptions While Loading Textures, Exit App string errorMsg = "An Error Occurred While Loading Texture:\n\t" + path + "\n" + "\n\nStack Trace:\n\t" + e.StackTrace + "\n"; MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);  }  finally  { if (image != null) {image.UnlockBits(bitmapdata);image.Dispose(); }  }   }   #endregion    }I found out that the loader was the bottle neck when I tried to "hint" it and rebuild my project, so .. any ideas ??Regards ..   
Quote:I found that the rotation of the object was too slow .. and then I noticed that the loadBitmap function was the one which took too much time .Are you reloading the texture every time you draw it? This is a huge amount of data and it should only be uploaded once during initialization. Doing it every frame will definitely be very slow. I don't know anything about Tao, but you should only have to load the texture once and then you can draw it / rotate it as many times as you want.   ;  Aha .. that's it !!New textures were defined every time the Draw function was called .Thank you karwosts :)   