Archived

This topic is now archived and is closed to further replies.

how to use GL.glTexImage2D () using CSGL Library in C#

This topic is 5127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i was wonder how to use this commnad using Bitmaps ;for example like this : Bitmap bmp= new Bitmap(File_Name); GL.glTexImage2D (GL.GL_TEXTURE_2D ,0,4,BMP.Width ,BMP.Height ,0,GL.GL_RGBA ,GL.GL_UNSIGNED_BYTE ,BMP ); notice that latest parameter in glteximage2d() is a pointer so this way is not possible ; please help me how can i pass my bmp file in parameter correctly cause i need it in my project ; i,m new opengl programmer ; Thanks New Trend toward emulation [edited by - MGS 2 on November 30, 2003 6:15:03 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Bitmap bitmap = new Bitmap("blah");
Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData bitmapData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
... whatever you want ...
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, 4, bitmap.Width, bitmap.Height, 0, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, bitmap.Scan0);

if(bitmap != null) {
bitmap.UnlockBits(bitmapData);
bitmap.Dispose();
}


CsGL is now dead, use Tao.

Share this post


Link to post
Share on other sites
Thanks for help ; now i can understand understand how to do this and thanks for your advice

[edited by - MGS 2 on December 1, 2003 7:23:57 PM]

Share this post


Link to post
Share on other sites