3 line OpenGL strangeness....?
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?
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?
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.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Xcode #include strangeness | WhatMeWorry | 4 | 3,937 |
Jul 1, 2005 12:31 AM Last Post: DoG |
|

