png without alpha fine, png with alpha, nothing
hmm, now I'm having a different problem... (the alpha's working finally, phew!)
all my textures are displaying the same, despite the fact that I'm binding them to unique GLuints. Interestingly, it's the last texture image that's loaded that's displayed in place of all textures, rather than the last one drawn (which is what I initially assumed).
So now I believe the problem must be in my loading code... I've revised it quite a bit i believe, so here's the most up to date version
I call the following routine, which loads all the individual images (i'm just trying to get the title screen up and running for the time being):
and the 5 variables are given tex_image_ref #s 1,2,3,4, and 5 respectively, as I would expect.
then i bind glBindTexture( GL_TEXTURE_2D, img ) for each of the 5 textures, onto different rectangles on the screen. they all display correctly in terms of position, but they all display the quit button! yahoo!
all my textures are displaying the same, despite the fact that I'm binding them to unique GLuints. Interestingly, it's the last texture image that's loaded that's displayed in place of all textures, rather than the last one drawn (which is what I initially assumed).
So now I believe the problem must be in my loading code... I've revised it quite a bit i believe, so here's the most up to date version
Code:
glPixelStorei(GL_UNPACK_ROW_LENGTH, image_size.width);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures (1, &texImage_ref);
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texImage_ref);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_size.width, image_size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data_buffer);I call the following routine, which loads all the individual images (i'm just trying to get the title screen up and running for the time being):
Code:
void OGL_LoadGraphics(void)
{
titleImg = OGL_LoadImage(CFSTR("title.png"));
button_start = OGL_LoadImage(CFSTR("button1_start.png"));
button_options = OGL_LoadImage(CFSTR("button2_options.png"));
button_help = OGL_LoadImage(CFSTR("button3_help.png"));
button_quit = OGL_LoadImage(CFSTR("button4_quit.png"));
}and the 5 variables are given tex_image_ref #s 1,2,3,4, and 5 respectively, as I would expect.
then i bind glBindTexture( GL_TEXTURE_2D, img ) for each of the 5 textures, onto different rectangles on the screen. they all display correctly in terms of position, but they all display the quit button! yahoo!
as an update, it does seem to be the background color that's drawn in place of what I'm trying to draw. ie, nothing is drawn at all. or it's 100% destination. or something.
I believe you also need to set these:
Code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
See 15.080 here for a few more details:
http://www.opengl.org/resources/faq/tech...arency.htm
http://www.opengl.org/resources/faq/tech...arency.htm
hmm, now I'm having a different problem... (the alpha's working finally, phew!)
all my textures are displaying the same, despite the fact that I'm binding them to unique GLuints. Interestingly, it's the last texture image that's loaded that's displayed in place of all textures, rather than the last one drawn (which is what I initially assumed).
So now I believe the problem must be in my loading code... I've revised it quite a bit i believe, so here's the most up to date version
I call the following routine, which loads all the individual images (i'm just trying to get the title screen up and running for the time being):
and the 5 variables are given tex_image_ref #s 1,2,3,4, and 5 respectively, as I would expect.
then i bind glBindTexture( GL_TEXTURE_2D, img ) for each of the 5 textures, onto different rectangles on the screen. they all display correctly in terms of position, but they all display the quit button! yahoo!
all my textures are displaying the same, despite the fact that I'm binding them to unique GLuints. Interestingly, it's the last texture image that's loaded that's displayed in place of all textures, rather than the last one drawn (which is what I initially assumed).
So now I believe the problem must be in my loading code... I've revised it quite a bit i believe, so here's the most up to date version
Code:
glPixelStorei(GL_UNPACK_ROW_LENGTH, image_size.width);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures (1, &texImage_ref);
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texImage_ref);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
image_size.width,
image_size.height,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
data_buffer);I call the following routine, which loads all the individual images (i'm just trying to get the title screen up and running for the time being):
Code:
void OGL_LoadGraphics(void)
{
titleImg = OGL_LoadImage(CFSTR("title.png"));
button_start = OGL_LoadImage(CFSTR("button1_start.png"));
button_options = OGL_LoadImage(CFSTR("button2_options.png"));
button_help = OGL_LoadImage(CFSTR("button3_help.png"));
button_quit = OGL_LoadImage(CFSTR("button4_quit.png"));
}and the 5 variables are given tex_image_ref #s 1,2,3,4, and 5 respectively, as I would expect.
then i bind glBindTexture( GL_TEXTURE_2D, img ) for each of the 5 textures, onto different rectangles on the screen. they all display correctly in terms of position, but they all display the quit button! yahoo!
One of these things is not like the other:
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texImage_ref);
glTexImage2D(GL_TEXTURE_2D,
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texImage_ref);
glTexImage2D(GL_TEXTURE_2D,
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL Alpha Channel Problem | Moganza | 1 | 1,456 |
Jan 19, 2013 08:25 AM Last Post: sealfin |
|
| Trouble with alpha when drawing into FBO | TomorrowPlusX | 19 | 5,777 |
Oct 23, 2012 02:07 PM Last Post: TomorrowPlusX |
|
| Alpha woes | esunder | 7 | 6,154 |
Feb 15, 2011 08:32 PM Last Post: esunder |
|
| Signed Distance Fields for Alpha Tested Magnification of Vector Textures | maximile | 2 | 4,589 |
Mar 29, 2010 10:59 AM Last Post: Skorche |
|
| OpenGL ES 2.0, 2D Alpha Transparency Artifacts | Macmenace | 3 | 6,105 |
Mar 28, 2010 11:18 PM Last Post: AnotherJake |
|
