Here’s some code
//create an empty texture…
GLuint texnum;
glGenTextures(1, &texnum);
glBindTexture(GL_TEXTURE_2D, texnum);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZEX, SIZEY, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
//render to texture…
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glViewport (0, 0, SIZEX, SIZEY);
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
glMatrixMode(GL_PROJECTION); glLoadIdentity();
glOrtho(0, SIZEX, 0, SIZEY, -1, 1);
draw_text(white, “Testing!”);
glBindTexture(GL_TEXTURE_2D, texnum);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, SIZEX, SIZEY, 0);
//draw texture to screen…
glColor4ub(255,255,0,255);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f);
glBindTexture(GL_TEXTURE_2D, texnum);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0f); glVertex2i(left, bottom);
glTexCoord2f(0.0f,1.0f); glVertex2i(left, top);
glTexCoord2f(1.0f,1.0f); glVertex2i(right,top);
glTexCoord2f(1.0f,0.0f); glVertex2i(right,bottom);
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_ALPHA_TEST);
I’m getting no transparency in my final draw-to-screen step, just white text on a solid black rectangle.
I would like to see the white text areas, but no rectangle.
Thanks.