+ if (NumHeads == 0) {
+ /* create texture object now */
+ static const GLubyte checker[2][2][4] = {
+ { {255, 255, 255, 255}, { 0, 0, 0, 255} },
+ { { 0, 0, 0, 0}, {255, 255, 255, 255} }
+ };
+ glGenTextures(1, &TexObj);
+ assert(TexObj);
+ glBindTexture(GL_TEXTURE_2D, TexObj);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGB,
+ GL_UNSIGNED_BYTE, checker);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ }
+ else {
+ /* bind 0th context's texture in this context too */
+ assert(TexObj);
+ glBindTexture(GL_TEXTURE_2D, TexObj);
+ }
+ glEnable(GL_TEXTURE_2D);
+