Note that there are some explanatory texts on larger screens.

plurals
  1. POloading texture from bitmap
    primarykey
    data
    text
    <p>It appears that i am loading the image wrong. The image appears all scrambled. What am i doing wrong here?</p> <pre><code>int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glEnable(GL_TEXTURE_2D); GLuint texture = 0; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glBindTexture(GL_TEXTURE_2D, texture); FIBITMAP* bitmap = FreeImage_Load(FreeImage_GetFileType("C:/Untitled.bmp", 0), "C:/Untitled.bmp", BMP_DEFAULT); FIBITMAP *pImage = FreeImage_ConvertTo32Bits(bitmap); int nWidth = FreeImage_GetWidth(pImage); int nHeight = FreeImage_GetHeight(pImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, nWidth, nHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, (void*)FreeImage_GetBits(pImage)); FreeImage_Unload(pImage); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(-1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex2f(-1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex2f(1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex2f(1.0f, -1.0f); glEnd(); RECT desktop; const HWND hDesktop = GetDesktopWindow(); GetWindowRect(hDesktop, &amp;desktop); long horizontal = desktop.right; long vertical = desktop.bottom; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glDisable(GL_TEXTURE_2D); return TRUE; // Keep Going } </code></pre> <p><strong>what i see when the program runs</strong> <img src="https://i.stack.imgur.com/A6doz.png" alt="What i see when the program runs"> <strong>what i expect to see when the program runs (bitmap i am loading)</strong> <img src="https://i.stack.imgur.com/fUcHK.png" alt="What i expect to see"></p>
    singulars
    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.
    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