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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-08-2009, 01:15 PM   #1 (permalink)
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
Old 07-08-2009, 06:02 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: currently AZ
Posts: 112
Send a message via MSN to kingbombs
Default

i dont see any attachments
kingbombs is offline   Reply With Quote
Old 07-08-2009, 06:16 PM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 3
Default

Attachments are there, but I suppose something's broken. I've uploded samples here: ImageShack Gallery

I've just tested the code on windows with use of OGLES PVRVFrame and the results are as expected: black is rendered as black.
sfider is offline   Reply With Quote
Old 07-08-2009, 07:52 PM   #4 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 3
Default

Found the problem. I've forgot to set opaque property of CAEAGLLayer of EAGLView to YES.
sfider is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 158,294
Threads: 89,032
Posts: 379,808
Top Poster: BrianSlick (7,086)
Welcome to our newest member, Marian123
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:47 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0