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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-13-2010, 06:49 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 3
Spoonsx21 is on a distinguished road
Default OpenGL glBlendFunc Inverted Colors

Hello,

Honestly, I rarely post on forums, as I can usually google search my way to a solution, but I just don't know how to answer this question, or what I'm doing wrong.

When I attempt to draw my images on the screen, the actual images have inverted colors, i.e. 255 = 0, and 0 = 255.

This is my call to:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
and GL_BLEND enabled and all. The images are just negatives of what they should be. Take a look at the pictures,

Here is what it looks like on the iphone simulator (and device):
http://www.flickr.com/photos/26806198@N03/4354347223/
Here's what the images look like:
http://www.flickr.com/photos/26806198@N03/4354347251/
http://www.flickr.com/photos/26806198@N03/4354347275/

What could be causing this? Please help, I've scoured the internet, with no luck. This is my last hope.

-Paul
Spoonsx21 is offline   Reply With Quote
Old 02-14-2010, 11:26 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 3
Spoonsx21 is on a distinguished road
Default

Good news, I found out the answer, and since, maybe, just maybe some day in the future, somebody has the same issue and googles this, they'll find an answer.

When you're initializing OpenGL, in the call to glTexEnvi(...)
You want glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND_SRC)

If you have GL_BLEND instead of GL_BLEND_SRC, you will get inverted colors.
So make GL_BLEND -> GL_BLEND_SRC for the fix.

Hope this helps someone in the future. Thanks anyone who read this, wanted to help, but couldn't.

-Paul
Spoonsx21 is offline   Reply With Quote
Old 02-14-2010, 01:19 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 226
mlfarrell is on a distinguished road
Default

That is still wrong. You should really read the man pages for these routines. You are passing invalid enums to the routine. It should be for default behavior: You want glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
mlfarrell is offline   Reply With Quote
Old 02-14-2010, 02:26 PM   #4 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 3
Spoonsx21 is on a distinguished road
Default

Thank you!

That works just the same, in terms of a fix, but I suppose it's better than what I have since it's not sending openGL invalid enums.

As far as reading the manual, this wouldn't have helped originally, as I was unaware that glTexEnvi was causing my problems. I would have had to read about pretty much every function I was calling, which I'm not sure would be helpful as much as it is time consuming.
Spoonsx21 is offline   Reply With Quote
Old 02-15-2010, 02:51 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 3
angelFrog is on a distinguished road
Default

By any chance are the pix from the simulator running on a PPC Mac? They look an awful lot like what I was seeing when I first started with iPhone programming and tricked the installer into letting me use my old G5. It mostly worked but images on the simulator came out very strangely. Not exactly inverted, but very close. The images should look okay on the device itself though.

If you are running on a PPC then the only way to get the Simulator to draw properly is to get an Intel Mac. Apple doesn't support iPhone development on PPC

If you're not running on a PPC, then I unfortunately have no other ideas...
angelFrog 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
» Online Users: 400
7 members and 393 guests
13dario13, iOS.Lover, jeroenkeij, Leslie80, Wikiboo, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,670
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Yosh_K
Powered by vBadvanced CMPS v3.1.0

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