Argh problems with blending

Mars_999
Unregistered
 
Post: #1
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();
}
Quote this message in a reply
Member
Posts: 177
Joined: 2002.08
Post: #2
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...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
Code:
glEnable(GL_BLEND);
Quote this message in a reply
Mars_999
Unregistered
 
Post: #4
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?
Quote this message in a reply
Mars_999
Unregistered
 
Post: #5
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!!!!!!!!!!!!!!!!!!!!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  2d shadow blending problems tesil 1 5,613 Mar 17, 2011 10:12 AM
Last Post: Skorche
  general blending versus texture blending questions WhatMeWorry 2 5,041 Dec 7, 2006 02:43 PM
Last Post: arekkusu
  Problems with transparency/blending, .pngs, and SDL_image Nick 22 9,316 Mar 1, 2005 02:04 PM
Last Post: Nick
  QTValuePak... Argh! Fenris 9 4,345 Sep 29, 2004 07:22 AM
Last Post: Steven