Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-08-2009, 01:15 PM   #1 (permalink)
sfider
New Member
 
Join Date: Jul 2009
Posts: 3
Default OpenGL ES alpha blending problem

Hi all

This is my code for creating texture object:
Code:
glGenTextures(1, &tex_name);
glBindTexture(GL_TEXTURE_2D, tex_name);
glTextImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, tex_data);
'tex_data' is loaded from raw RGBA8888 data packed with zlib. It loads as it should, wich i've checked with a debugger.

This is my code for setting up texture before rendering:
Code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glBindTexture(GL_TEXTURE_2D, tex_name);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
I've attached a sample of what I've expected and what I've got. In the sample most of the texture in the bottom is pitch-black with 70% opacity. However openGL renders it as gray. This problem affects all of my textures I use blend with.

If anybody has any idea where the problem is, I would really appreciate the help.

Cheers
sfider
Attached Images
File Type: png alpha_blend_good.png (5.9 KB, 3 views)
File Type: png alpha_blend_bad.png (3.3 KB, 2 views)
sfider is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,868
Threads: 89,225
Posts: 380,691
Top Poster: BrianSlick (7,129)
Welcome to our newest member, stokesreece
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:17 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.