🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Texture Mapping problem

Started by
3 comments, last by slaugh 17 years, 3 months ago
I have been using tao 2.0 opengl and I was doing the NeHe tutorials and I got to tutorial 6 but my cube just shows up white and I and trying to figure out where it not applying the texture the texture. was trying to do it on my own and convert it my self but then I ran into this problem and went back through the examples source and change my code here and there Thanks http://rafb.net/p/YE2wJF83.html
Advertisement
ok heres the full code

http://rafb.net/p/5fuH5x94.html

maybe someone can help with that

thanks
Azteroth
Nevermind I got it

            texName = new string[1];            texName[0] = "NeHe006.bmp";            texture = new int[1];            if (File.Exists(DataDirectory + GetTextureName()[0]))            {                FilePath = "";            }            // Status indicator            bool status = false;            Bitmap[] textureImage = new Bitmap[GetTextureName().Length];            // Create Storage Space for the texture            for (int i = 0; i < GetTextureName().Length; i++)            {                textureImage = new Bitmap(FilePath + DataDirectory + GetTextureName());            }            // Load the Bitmap            // CHeck for errors, if bitmap not found, quit            if (textureImage[0] != null)            {                status = true;                // Create the texture                Gl.glGenTextures(GetTexture().Length, GetTexture());                for (int i = 0; i < textureImage.Length; i++)                {                    textureImage.RotateFlip(RotateFlipType.RotateNoneFlipY);                    // Flip the bitmap along the Y axis                    // rectangle for locking the bitmap in memory                    Rectangle rectangle = new Rectangle(0, 0, textureImage.Width, textureImage.Height);                    // Get the bitmap's pixel data from the locked bitmap                    BitmapData bitmapData =                        textureImage.LockBits(rectangle, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);                    // Typical texture generation using data from the bitmap                     Gl.glBindTexture(Gl.GL_TEXTURE_2D, GetTexture());                    Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGB8, textureImage.Width, textureImage.Height, 0, Gl.GL_BGR, Gl.GL_UNSIGNED_BYTE, bitmapData.Scan0);                    Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR);                    Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);                    if (textureImage != null)                    {                        // if texture exists                        textureImage.UnlockBits(bitmapData);                        // unlock the pixel data from memory                        textureImage.Dispose();                        // Dispose the bitmap                    }                }            }            return status;


thanks anyway
Hi. I have the same problem: my object is white, but is should be covered with a texture. How did you solve this ?
Uff I've got it..

This topic is closed to new replies.

Advertisement