Jump to content
  • Advertisement

Archived

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

MGS 2

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

This topic is 5435 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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!