3 line OpenGL strangeness....?

Posts: 321
Joined: 2004.10
Post: #1
I've got the Red Book right in front of me and the 3 lines below matches
that found in the texbind.c, Example 9-7 Compilation is fine. But when I
run through the Xcode's debugger with the following lines:

GLuint badTextureName[1];
glGenTextures( 1, badTextureName);
glBindTexture(GL_TEXTURE_2D, badTextureName[0]);

unsigned int goodTextureName[1];
glGenTextures( 1, (GLuint *) goodTextureName);
glBindTexture(GL_TEXTURE_2D, goodTextureName[0]);

The bad snippet is showing badTextureName[] 0f -1 in the Xcode 2.1
debugger. Conversely, The goodTextureName[] is showing 1. Likewise,
the debugger has one of those little triangle icons next to goodTextureName,
whereas badTextureName does not.

I'm surprised that the casting one works. Seems the badTexture is in
OpenGL's native GLuint type and should not only work, but be the
"preferred" method.

Btw, this whole thing started when I originally noticed that the debugger
showed "badTextureName <incomplete type>" Huh?
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
Sounds like a debugger bug. The first snippet is certainly correct, and the second is not, though it will happen to work on most or all current GL implementations.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Xcode #include strangeness WhatMeWorry 4 6,407 Jul 1, 2005 12:31 AM
Last Post: DoG