3 line OpenGL program strangeness...

Member
Posts: 321
Joined: 2004.10
Post: #1
For the last 3 days I've been obsessed with a failure in
the gluBuild2DMipMaps() function. I believe I've simplified
and distilled the problem down to this. But I would welcome
outside comments because the problem/fix wasn't what
I was expecting.

I step through the debugger in the below program and the
result is always a non-zero (failure). When I un-comment out the
commented glutCreateWindow() function line and re-run the
program, the result is zero (success).

I placed the glutCreateWindow() into my real program (several
thousand lines of code and real textures (256x256, 512x512 etc.)
and it now works!

I couldn't even begin to explain why glutCreateWindow() would influence
gluBuild2DMipMaps(). I am running OS 9 so maybe that introduces
strangeness. Could someone with Mac OS X run this and see if
they get the same results.

Could this be a bug or a known specification.

-----------------------------------------------------------------------

#include <glut.h>

int main(int argc, char** argv)
{

//glutCreateWindow("Strange");

GLubyte realSmall[1][1][4] = { 0, 120, 128, 255 }; // extremely small texture

int result = gluBuild2DMipmaps(
GL_TEXTURE_2D, // target
GL_RGBA, // internal format
1, // width
1, // height
GL_RGBA, // format
GL_UNSIGNED_BYTE, // type
realSmall // texels
);
}
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #2
It is invalid to issue any GL commands without an active GL context. glutCreateWindow will create the context when it creates the window. Although, that still isn't a valid glut app since glutInit is missing...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glut polygon winding strangeness OptimisticMonkey 2 2,876 Sep 7, 2009 06:27 PM
Last Post: OptimisticMonkey
  OpenGL Program / Loop Help Jones 5 2,812 Jan 4, 2006 08:36 PM
Last Post: Jones
  Passing values to SDL_LoadBMP strangeness Lunatic 0 2,424 Sep 7, 2005 08:49 PM
Last Post: Lunatic