• Advertisement
Sign in to follow this  

[.net] S3TC in taoframework

This topic is 4431 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 have been having problems with taoframework throwing an access violation exception while calliing glCompressedTexImage2DARB and was wondering if any one else has come across this or has any way i can avoid it.
                Gl.glBindTexture(Gl.GL_TEXTURE_2D, TexID);

                int cWidth = (int)m_ddsHeader.dwWidth;
                int cHeight = (int)m_ddsHeader.dwHeight;
                int offset = 0;
                int size = 0;
                int format = (int)ddsInfo.internalFormat;
                byte[] temp;
                for (int i = 1; i < m_ddsHeader.dwMipMapCount; i++)
                    size =(int)((cWidth/4)*(cHeight/4)*ddsInfo.blockBytes);
                    temp = new byte[size];
                    cWidth = Math.Max(1,cWidth >> 1);
                    cHeight = Math.Max(1,cHeight >> 1);

Share this post

Link to post
Share on other sites
Simple answer: is your buffer big enough? Looks to me like you're trying to fill it with (cWidth×cHeight) pixels but only allocating a sixteenth of that ... even allowing for the pixel format (more than one byte per pixel), which I presume is covered by ddsInfo.blockBytes.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement