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

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

Draw This
($0.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-06-2009, 12:22 PM   #50 (permalink)
kingbombs
Registered Member
 
Join Date: Jun 2009
Location: currently AZ
Posts: 112
kingbombs is on a distinguished road
Send a message via MSN to kingbombs
Default

Hey,
I have a question regarding your code for loading textures.
- (void)loadTextureNSString *)name intoLocationGLuint)location {....}
this is the method im refering to

Code:
    CGContextRef textureContext = CGBitmapContextCreate(textureData,	texWidth, texHeight, 8, texWidth * 4, CGImageGetColorSpace(textureImage),
kCGImageAlphaPremultipliedLast);

	// This is code added
	CGContextClearRect(textureContext, CGRectMake(0, 0, (float)texWidth, (float)texHeight));

	CGContextDrawImage(textureContext, CGRectMake(0.0, 0.0, (float)texWidth, (float)texHeight), textureImage);
	CGContextRelease(textureContext);
I had noticed that if i applied a block image to the texture, then apply an image thats not square, then around the outside of the last image the block texture would appear.
I used that line to stop the last texture being drawn behind the current one. (this works and fixes it)

But i noticed behind the image thats not a square it appears black. (for example a leg image takes up apart of the square and the rest is black around it (as a texture))
I was wondering how i could get the outside part of the texture transparent, so only the leg image would be applied and around it would be transparent. (so if i had a texture having two legs that doesnt move you could see between its legs)

(sorry if i made no sense),
Is there also a reason why you haven't used that line of code? Or am i being an idiot for using that and should be using something else?

Last edited by kingbombs; 07-06-2009 at 12:28 PM.
kingbombs is offline   Reply With Quote
 

» Advertisements
» Online Users: 539
14 members and 525 guests
Alexj17, avors, baja_yu, bazookaBen, clarky07, ditren, Droverson, flamingliquid, idiot_2008, KZS, linda368, NetGuru, quantranbr, Rudy
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 174,541
Threads: 93,723
Posts: 401,259
Top Poster: BrianSlick (7,954)
Welcome to our newest member, linda368
Powered by vBadvanced CMPS v3.1.0

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