Note that there are some explanatory texts on larger screens.

plurals
  1. PODDS DXT1 loading in OpenGL, crashes
    primarykey
    data
    text
    <p>Any idea whats wrong with my code? when i execute glCompressedTexImage2D() the program just crashes (comes the Windows XP crash message thing...)</p> <p>Im trying to load DDS image without mipmaps, the image format is DDS DXT1</p> <p>Am i missing some include file, or what did i do wrong? I downloaded the included files from: <a href="http://sourceforge.net/projects/glew/files/glew/1.5.1/glew-1.5.1-win32.zip/download" rel="nofollow noreferrer">http://sourceforge.net/projects/glew/files/glew/1.5.1/glew-1.5.1-win32.zip/download</a></p> <p>I have glew32.dll in the same folder as my .exe is.</p> <p>The code below has only the parts i changed to be able to load DDS images:</p> <pre><code>#pragma comment(lib, "glew32.lib") #include &lt;GL\glew.h&gt; #include &lt;GL\gl.h&gt; ... typedef struct { GLuint dwSize; GLuint dwFlags; GLuint dwFourCC; GLuint dwRGBBitCount; GLuint dwRBitMask; GLuint dwGBitMask; GLuint dwBBitMask; GLuint dwABitMask; } DDS_PIXELFORMAT; typedef struct { GLuint dwMagic; GLuint dwSize; GLuint dwFlags; GLuint dwHeight; GLuint dwWidth; GLuint dwLinearSize; GLuint dwDepth; GLuint dwMipMapCount; GLuint dwReserved1[11]; DDS_PIXELFORMAT ddpf; GLuint dwCaps; GLuint dwCaps2; GLuint dwCaps3; GLuint dwCaps4; GLuint dwReserved2; } DDS_HEADER; DDS_HEADER DDS_headers; ... FILE *fp = fopen("test.dds", "rb"); fread(&amp;DDS_headers, 1, sizeof(DDS_headers), fp); img_width = DDS_headers.dwWidth; img_height = DDS_headers.dwHeight; maxsize = (img_width*img_height)/2; unsigned char *imgdata = (unsigned char *)malloc(maxsize); fread(imgdata, 1, maxsize, fp); fclose(fp); GLuint texID; glGenTextures(1, &amp;texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_PALETTE4_R5_G6_B5_OES, img_width, img_height, 0, maxsize, imgdata); // NOTICE: // Ive also tried with function: // glCompressedTexImage2DARB(); // and internalformats: GL_COMPRESSED_RGB_S3TC_DXT1_EXT and all of the possible formats... its not a format error. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload