Argh problems with blending
When I was on the PC I had no problems with setting up alpha transparency now I am on the Mac again I am having a problem getting my textures to use alpha? I have almost tried all the possible combos to get it to work and no dice. Anyone have any ideas what might be wrong?
Code:
//these functions are used in the init opengl function
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
void Render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glLoadIdentity();
glTranslatef(0.5f, 0.0f, -10.0f);
glBindTexture(GL_TEXTURE_2D, textures[1]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -10.0f);
glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glBindTexture(GL_TEXTURE_2D, textures[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
glDisable(GL_BLEND);
glDisable(GL_ALPHA);
glDisable(GL_TEXTURE_2D);
SDL_GL_SwapBuffers();
}
What are you setting the blend function to?
Also, if you are loading the texture image with Carbon you will have to convert it from ARGB to RGBA for OpenGL. There are several ways to do this, but I can't recall any of them offhand...
Also, if you are loading the texture image with Carbon you will have to convert it from ARGB to RGBA for OpenGL. There are several ways to do this, but I can't recall any of them offhand...
Code:
glEnable(GL_BLEND);Quote:Originally posted by OneSadCookie
Code:
glEnable(GL_BLEND);
That didn't work? I removed it and still am having the same problem? I have a texture on the screen that has no alpha value and is behind the texture that has alpha. The texture in front has alpha and is a explosion and when rendered covers up half of the texture with no alpha? I am totally baffled now?
Think I fixed it? I do need glEnable(GL_BLEND). Also OSC remember when you said try and use transparency in Photoshop Elements 2 for alpha well I have been using that to make images and no dice. I downloaded someone elses gfx that had alpha in a tiff format and used gfxconverter to convert it to .tga and now it works? So is it possible Photoshop Elements isn't able to do alpha? GOD what a nerve racking time!!!!!!!!!!!!!!!!!!!!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| 2d shadow blending problems | tesil | 1 | 4,746 |
Mar 17, 2011 10:12 AM Last Post: Skorche |
|
| general blending versus texture blending questions | WhatMeWorry | 2 | 4,306 |
Dec 7, 2006 02:43 PM Last Post: arekkusu |
|
| Problems with transparency/blending, .pngs, and SDL_image | Nick | 22 | 8,821 |
Mar 1, 2005 02:04 PM Last Post: Nick |
|
| QTValuePak... Argh! | Fenris | 9 | 4,147 |
Sep 29, 2004 07:22 AM Last Post: Steven |
|

