IPhone OpenGL Bug?

Hi,
I'm trying to mask out a certain part of the screen by using GLDEPTHTEST ( writing a certain value to an area, then rendering with the glDepthFunc at GL_GEQUAL ). This works fine in regular OpenGL, however the depth test doesn't seem to do anything on the iPhone. I've even tried glDepthFunc at GL_NEVER, yet it still renders everything. I've made certain that I'm calling glEnable( GLDEPTHTEST ) and that at the beginning of each frame I clear the depth buffer.
Any ideas as to why the depth test doesn't seem to work on the iPhone?

Whoops! Sorry for the post, I just realized that I'm using the OpenGL GLSprite sample app and didn't set "USEDEPTHBUFFER" to "1". Problem fixed

Similar Messages

  • [iPhone] OpenGL ES Antialiasing?

    Hi,
    I'm writing an OpenGL ES application and I'm wondering if any form of antialiasing is supported on the iPhone hardware. I'm mainly drawing a textured polygons, so it would be great if there were something like (GLPOYGONSMOOTH), which doesn't exist in ES. I've also tried to use multisampling, but it appears that isn't supported by the hardware either. Does anyone know of any way to do some form of antialiasing in iPhone OpenGL ES apps?
    Thanks,
    -Greg

    Your best bet is probably to go to the source and check out the documentation of the PowerVR MBX chipsets directly if you want to know what's in hardware. You can also check out the Khronos OGL ES spec for 1.1 but alot of the added functionality comes from extensions and you don't have control over which extensions are being used.
    http://www.imgtec.com/PowerVR/mbx.asp
    http://www.khronos.org/opengles/
    Good luck,
    =Tod

  • [ iPhone ] OpenGL ES glLineWidth()

    Hey guys,
    Quick question: I'm using OpenGL on the iPhone and have code to set the width of rendered lines using glLineWidth(). This works great in the simulator but doesn't seem to work on an actual device.
    I've searched the specification for OpenGL ES and it definitely should be functioning correctly. Anyone know i need to do anything special to get this feature to work on a device? Or if it's just not supported ( hopefully not )?
    Thanks!

    Is GLLINESMOOTH enabled? The iPhone does not support anti-aliased lines. If you query the SMOOTHLINE_WIDTHRANGE, it reports (1,1), which is kind of a hint that it doesn't work (ie, line widths are clamped to 1). Smoothed lines (and points) have long been a very inconsistent thing in OpenGL implementations, so the iPhone is not alone in having problems with it.
    See http://homepage.mac.com/arekkusu/bugs/invariance/index.html for an example of desktop GL renderers, and also some sample code on how to use Framebuffer Blending + Texturing to create fake smooth lines. Note, by 'fake', I mean 'much better quality than most built-in smoothed-line implementations', and perfectly portable as well (unlike lines themselves).
    Your other (easier) option is to use non-smoothed lines.

  • IPhone iCal bug- appointments suddenly 1 hour off

    After 2 days of searching and 1 hour on tech support, I've concluded Apple has a bug with iCal on iPhone that still needs to be addressed.
    I realized 2 days ago after missing a scheduled conference call that my iCal appointments on my iPhone (3GS) were all showing 1 hour ahead AFTER March 23 (that FYI did NOT coincide with the recent shift to Daylight Savings Time, which I originally thought could be the culprit).
    I'm a seasoned Mac/iPhone user (one of the early adopters of iPhone) and this iCal problem just showed up out of the blue.
    I searched Apple Discussions and found other instances of this in recent years, and tried every recommended fix:
    --Ensured all time zone settings on Mac and iPhone were correct and matched at EST/New York (general AND iCal)
    --Tried toggling time zone support off then on again on iPhone
    --Tried turning time zone support on and off, in every conceivable combination, on both Mac and iPhone
    --Tried posting new entries on the Mac iCal, but same problem: a new 5pm ET appointment on Mac showed up as 6pm on iPhone
    --Rebooted
    After an hour of troubleshooting, the tech support person today said the only thing they could suggest is a complete restore of iPhone, NOT using previously stored info-- meaning, among other things, many text messages of sentimental value to me would be lost forever.
    Eventually, my Mac iCal entries got messed up too, overridden by the incorrect iPhone ones (fortunately only after March 23).
    Ready to give up, I tried changing "bad" appointment times on the iPhone to see if Mac iCal would match them upon sync. THEY DID!
    So then I deleted every single appointment on my Mac iCal after March 23, created entirely new appointments (putting correct time for each in the title for every entry in case this happens again), then synched: For now, everything matches.
    I've lost about 5 hours on this that I didn't have to spare.
    APPLE: PLEASE INVESTIGATE THIS. My iPhone is my "Blackberry"-- I rely on it for work and tell other PC "power users" that it's totally reliable. This has shaken my faith...

    bruce1964,
    Are your Mac, go to the Date & Time preferences. Is it set to set date and time automatically, and pulling time information from Apple Americas/U.S. Time?
    Is the Time Zone correct?
    Hope this helps,
    Nathan C.

  • [iPhone] OpenGL IPhone Question

    Greetings, I am new to programming on the iPhone and Objective-C so I hope you will excuse me if I ask a stupid question. I am experienced at Java (having worked with it for 14 years professionally) and I have some background in C and C++ that I have half forgotten but not completely.
    I am trying to learn OpenGL programming on the iPhone and I have encountered a problem. In my test application I want to draw a icosahedron and I am having trouble with several sides completely missing. I was hoping someone could lead me in the right direction. Pasted below are the relevant sections of code based off the template for the OpenGL template.
    It draws a good portion of the icosahedron but there appear to be sides missing and that causes odd things. I have been fiddling with this for hours and im out of ideas. I assume it must be something simple.
    #import <UIKit/UIKit.h>
    #import <OpenGLES/EAGL.h>
    #import <OpenGLES/ES1/gl.h>
    #import <OpenGLES/ES1/glext.h>
    #import "GameBead.h"
    This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
    The view content is basically an EAGL surface you render your OpenGL scene into.
    Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
    @interface EAGLGameView : UIView {
    @private
    GLint backingWidth;
    GLint backingHeight;
    EAGLContext *context;
    GLuint viewRenderbuffer, viewFramebuffer;
    GLuint depthRenderbuffer;
    GameBead* bead;
    - (void)drawWithRotationX:(GLfloat)rotX Y:(GLfloat)rotY;
    @end
    #import <QuartzCore/QuartzCore.h>
    #import <OpenGLES/EAGLDrawable.h>
    #import "EAGLGameView.h"
    #define USEDEPTHBUFFER 0
    @interface EAGLGameView ()
    @property (nonatomic, retain) EAGLContext *context;
    - (BOOL) createFramebuffer;
    - (void) destroyFramebuffer;
    @end
    @implementation EAGLGameView
    @synthesize context;
    // You must implement this
    + (Class)layerClass {
    return [CAEAGLLayer class];
    //The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
    - (id)initWithCoder:(NSCoder*)coder {
    bead = [[GameBead alloc] init];
    if ((self = [super initWithCoder:coder])) {
    // Get the layer
    CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
    eaglLayer.opaque = YES;
    eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
    context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
    if (!context || ![EAGLContext setCurrentContext:context]) {
    [self release];
    return nil;
    return self;
    - (void)drawWithRotationX:(GLfloat)rotX Y:(GLfloat)rotY {
    [EAGLContext setCurrentContext:context];
    glBindFramebufferOES(GLFRAMEBUFFEROES, viewFramebuffer);
    glViewport(0, 0, backingWidth, backingHeight);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrthof(-2.0f, 2.0f, -3.0f, 3.0f, -2.0f, 2.0f);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GLCOLOR_BUFFERBIT| GLDEPTH_BUFFERBIT | GLSTENCIL_BUFFERBIT);
    glPushMatrix();
    GLfloat rotZ = 0.0f;
    [bead drawWithRotationX: rotX Y: rotY Z:rotZ];
    glPopMatrix();
    glBindRenderbufferOES(GLRENDERBUFFEROES, viewRenderbuffer);
    [context presentRenderbuffer:GLRENDERBUFFEROES];
    - (void)layoutSubviews {
    [EAGLContext setCurrentContext:context];
    [self destroyFramebuffer];
    [self createFramebuffer];
    [self drawWithRotationX: 0.0f Y:0.0f];
    - (BOOL)createFramebuffer {
    glGenFramebuffersOES(1, &viewFramebuffer);
    glGenRenderbuffersOES(1, &viewRenderbuffer);
    glBindFramebufferOES(GLFRAMEBUFFEROES, viewFramebuffer);
    glBindRenderbufferOES(GLRENDERBUFFEROES, viewRenderbuffer);
    [context renderbufferStorage:GLRENDERBUFFEROES fromDrawable:(CAEAGLLayer*)self.layer];
    glFramebufferRenderbufferOES(GLFRAMEBUFFEROES, GLCOLOR_ATTACHMENT0OES, GLRENDERBUFFEROES, viewRenderbuffer);
    glGetRenderbufferParameterivOES(GLRENDERBUFFEROES, GLRENDERBUFFER_WIDTHOES, &backingWidth);
    glGetRenderbufferParameterivOES(GLRENDERBUFFEROES, GLRENDERBUFFER_HEIGHTOES, &backingHeight);
    if (USEDEPTHBUFFER) {
    glGenRenderbuffersOES(1, &depthRenderbuffer);
    glBindRenderbufferOES(GLRENDERBUFFEROES, depthRenderbuffer);
    glRenderbufferStorageOES(GLRENDERBUFFEROES, GLDEPTH_COMPONENT16OES, backingWidth, backingHeight);
    glFramebufferRenderbufferOES(GLFRAMEBUFFEROES, GLDEPTH_ATTACHMENTOES, GLRENDERBUFFEROES, depthRenderbuffer);
    if(glCheckFramebufferStatusOES(GLFRAMEBUFFEROES) != GLFRAMEBUFFER_COMPLETEOES) {
    NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GLFRAMEBUFFEROES));
    return NO;
    // -- set up the lighting.
    GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat mat_shininess[] = { 50.0 };
    GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
    GLfloat matambdiff[] = { 0.6, 1.0, 0.6, 1.0 };
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glShadeModel (GL_SMOOTH);
    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glMaterialfv(GL_FRONT, GLAMBIENT_ANDDIFFUSE, matambdiff);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GLDEPTHTEST);
    // -- done
    return YES;
    - (void)destroyFramebuffer {
    glDeleteFramebuffersOES(1, &viewFramebuffer);
    viewFramebuffer = 0;
    glDeleteRenderbuffersOES(1, &viewRenderbuffer);
    viewRenderbuffer = 0;
    if(depthRenderbuffer) {
    glDeleteRenderbuffersOES(1, &depthRenderbuffer);
    depthRenderbuffer = 0;
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint now = [touch locationInView:self];
    CGPoint old = [touch previousLocationInView:self];
    CGFloat rotX = now.x - old.x * 1.0f;
    CGFloat rotY = now.y - old.y * 1.0f;
    [self drawWithRotationX:rotX Y:rotY];
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    - (void)dealloc {
    if ([EAGLContext currentContext] == context) {
    [EAGLContext setCurrentContext:nil];
    [context release];
    [bead release];
    [super dealloc];
    @end
    #import <OpenGLES/EAGL.h>
    #import <OpenGLES/ES1/gl.h>
    #import <OpenGLES/ES1/glext.h>
    @interface GameBead : NSObject {
    GLfloat vertexData[20 * 3 * 3];
    -(id)init;
    -(void)drawWithRotationX:(GLfloat)xrot Y:(GLfloat)yrot Z:(GLfloat)zrot;
    @end
    #import "GameBead.h"
    @implementation GameBead
    - (id)init {
    // ---- The data that makes up a unit Icosahedron. ----
    // References:
    // http://en.wikipedia.org/wiki/Golden_ratio
    // http://en.wikipedia.org/wiki/Golden_rectangle
    const uint sideCount = 20;
    const GLfloat x = 0.525731112119133606f;
    const GLfloat z = 0.850650808352039932f;
    const GLfloat ico_vertices[12][3] = {
    {-x, 0.0, z}, {x, 0.0, z}, {-x, 0.0, -z}, {x, 0.0, -z},
    {0.0, z, x}, {0.0, z, -x}, {0.0, -z, x}, {0.0, -z, -x},
    {z, x, 0.0}, {-z, x, 0.0}, {z, -x, 0.0}, {-z, -x, 0.0}
    const GLuint ico_triangles[20][3] = {
    {0,4,1}, {0,9,4}, {9,5,4}, {4,5,8}, {4,8,1},
    {8,10,1}, {8,3,10}, {5,3,8}, {5,2,3}, {2,7,3},
    {7,10,3}, {7,6,10}, {7,11,6}, {11,0,6}, {0,1,6},
    {6,1,10}, {9,0,11}, {9,11,2}, {9,2,5}, {7,2,11}
    uint idx, vidx;
    [super init];
    for (idx = 0; idx < sideCount; idx++) {
    for (vidx = 0; vidx < 3; vidx++) {
    vertexData[(idx * 9) + (vidx * 3) + 0] = icovertices[icotriangles[idx][vidx]][0];
    vertexData[(idx * 9) + (vidx * 3) + 1] = icovertices[icotriangles[idx][vidx]][1];
    vertexData[(idx * 9) + (vidx * 3) + 2] = icovertices[icotriangles[idx][vidx]][2];
    return self;
    - (void)drawWithRotationX:(GLfloat)rotX Y:(GLfloat)rotY Z:(GLfloat)rotZ {
    glMatrixMode(GL_MODELVIEW);
    glEnableClientState(GLVERTEXARRAY);
    glVertexPointer(3, GL_FLOAT, 0, vertexData);
    glEnableClientState(GLNORMALARRAY);
    glNormalPointer(GL_FLOAT, 0, vertexData);
    glDrawArrays(GL_TRIANGLES, 0, 180);
    glRotatef(rotX, 0.0f, 1.0f, 0.0f); // x rotation is about y axis
    glRotatef(rotY, 1.0f, 0.0f, 0.0f); // y rotation is about x axis
    glRotatef(rotZ, 0.0f, 0.0f, 1.0f); // z rotation is about z axis
    - (void) normalizeVertex:(GLfloat*)vertex {
    GLfloat d = sqrt((vertex[0]vertex[0])(vertex[0]*vertex[0])(vertex[0]vertex[0]));
    // guarantee that the vector isnt zero length
    if (d == 0.0) {
    NSException* ex = [NSException exceptionWithName:@"Bad Arguments" reason:@"Arguments resulted in a zero length vector." userInfo:nil];
    @throw ex;
    vertex[0] /= d; vertex[1] /= d; vertex[2] /= d;
    - (void)dealloc {
    free(vertexData);
    [super dealloc];
    @end

    hausy wrote:
    have you skype ? we can learn from each other
    Im sorry, I cant give out personal information like that on an open forum. Especially when you arent willing to state your reasons. That would just be stupid.
    -- Robert

  • More than 1000 photos - iPhone naming bug???

    I have more than 1000 pictures on my iPhone. When I tried to import them onto my Mac using iPhoto I realised that for some reason iPhone names the pictures incorrectly.
    Instead of going from 0999 to 1000 Phone goes from 0999 back to 0000. It appends the file name with "_2".
    Is this a bug?
    I keep all my iPhone pictures organised in a separate folder rather than use iPhoto.
    This means that I have to rename all the new photos above 0999. Very annoying.

    It doesn't make sense to provide 4 digits and then jump back to zero after using up three of them.
    I don't see the problem in keeping 1000+ photos on the iPhone - however, I do back them up very regularly.

  • IPhone charging bug in 3.0

    Hi,
    I am curently using a Dension Gateway 100 to connect my iPhone 3GS to my car audio system. It's the model with the new cradle compatible with USB charging for the iPhone 3G/3GS / Touch 2G.
    However, I do have a charging issue with my iPhone 3GS (running OS 3.0) that I suppose is a software one:
    When I plug the iPhone in the cradle, it vibrates and briefly shows the charging icon, but then about half a second later the icon disappears (gets back to the way it is when it's not charging) and I got the 'this accessory does not support charging ...' message.
    It seems that the iPhone correctly detects the USB current (the vibration and charging icon), but then it also detects the 12V current on the firewire pins, and then disables the charging altogether.
    I got my iPhone to charge correcly using this accessory once or twice, by timing right the insertion into the cradle (couldn't find a pattern to reproduce though), and have no issue charging with USB on my computer, power adapter or using a iPod firewire-to-usb-charging dock adapter.
    So it seems like it could be a bug in the 3.0 firmware. Could you confirm that?
    Is anyone having the same issue with accessories that provide both firewire and usb charging?
    Thanks.

    I'm sorry if I sounded harsh or anything, or trying to find false faults in your arguments. That was not my intent, and if you have any backed up information to contradict me, I'd be more than happy to read it.
    But, when you look at the dock pinout (http://pinouts.ru/PortableDevices/ipod_pinout.shtml I know, it's not an official document and does not states anything about the 3GS, but it's still interesting to have a look to) there are a few things to note:
    Pins 3/4 are for audio line-out. Since my 3GS does play music back to the car radio, my guess is they haven't changed.
    Pins 11/12/13 are for serial communication. Since my 3GS does support the Apple Accessory Protocol that uses serial communication (it supports remote control from the steering wheel remote controls, does communicate track/album names to the car radio (see pin 21) when the car system is in "Gateway Mode") my guess is that they haven't changed either.
    Pin 21 is for accessory indicator. Its the one that triggers the warning message stating that the plugged accessory is incompatible with iPhones, or triggers the "iPod Accessory" mode with serial communication (see pins 11/12/13). Maybe Apple introduced new resisting values to manage 3GS specific accessories, but everything points to the fact that old ones are still supported (as the 3GS goes into "iPod Accessory" mode when the car system is in "Gateway Mode" and communicates correctly track/album names through the Apple Accessory Protocol, or that the volume gets locked into "Dock connection" mode when plugged in, etc.)
    Pins 16/23/25/27 for USB charging. Since the 2G/3G USB charging adapters are still working with the 3GS, my guess is that they haven't changed.
    Finally, for the 3rd party accessories that don't work as designed or at all going from 2G to 3G to 3GS (such as your BOSE SoundDock), the only issues I'm aware of are the firewire charging issue, and the "accessory not made for iphone" message (which is due to the fact that the accessory has not been shielded for radio interferences, thus not having a resisting value on pin 21 that relates to an designed-for-iPhone accessory). There is also the issue of the chip in the video-out cable, but that concerns the migration from iPod 5G to iPhone, not 3G to 3GS, and my car system isn't video cappable, so it's not applicable here. But If you have any information of other bugs affecting these devices, feel free to point me to them.
    That is (AFAIK, again) what happened with the BOSE SoundDock Series I vs Series II : the I was charging via firewire only and had a resisting value on pin 21 that registered it as an iPod accessory (thus the warning message on iPhones, both 2G and 3G), whereas the II has USB charging and a radio frequency shielding, so it is authorized to register itself to an iPhone as an iPhone accessory (different resisting value on pin 21, thus no warning message).
    But I guess we're going slightly out of topic here, which is that when my accessory is plugged in (and provides both firewire and usb charging), the iPhone initially detects the usb charging (thus the vibration and charging icon) but soon after loses it as it seems it detects also firewire charging.
    One might say that this is due to the 3GS detecting a now-unsupported resisting value on pin 21. But when I use the firewire-to-usb charging adapter (link in my previous post) that passes through signal from the other pins, it then has the same resisting value on pin 21, but now only usb charging (no FW) and does not loses charging as it happened without the adapter. *That's what points me to either a hardware firewire-to-USB power conversion problem, or a software bug in my iPhone.*
    Sorry for the long post, I hope I haven't lost you (or an Apple Software/Hardware Engineer reading it).
    Have a nice day.

  • Unibody Nvidia + Photoshop CS4 OpenGL bug?

    I am experiencing a particular bug in Photoshop CS4 Extended which is related to the OpenGL GPU acceleration which is very dependent on the video driver. The particular bug I'm seeing is when I free transform a object/layer or perform a transform selection the transformed object/layer/selection is off by a pixel and that pixel is semi-transparent with whatever is being transformed.
    Can anybody with both a unibody and Photoshop CS4 test this on their system to see if its really an issue with the driver or if it is something with my Photoshop installation?
    Here's what I do to test. 1. creat a new doc at any size/ppi. 2. drag out a selection and fill with a solid color. 3. free transform object/selection. 4. zoom in on transformed object and look at the edges to see if there is this feathered/semi-transparent edge.
    I haven't tested in bootcamp since I don't have a Win version of CS4.
    Thanks.

    Here are screenshots:
    I reset Photoshop preferences. Then reinstalled Photoshop which seemed to make things kinda better. I only get the distortion when free transforming and not transforming a selection.

  • OpenGL bug with Snow Leopard in Photoshop CS4? distorted pixels

    Hi all,
    Has anyone encountered this bug before? If I open any image or start a new document and hit F to change screen mode I am plagued with random purple pixels with more being displayed as I make the document bigger (see attached screenshots).
    However if I turn off OpenGL support, the problem completely disappears. This problem never occured with OS X 10.5.
    Macbook Pro Unibody
    2.93 GHZ
    4GB ram
    OSX 10.6.1
    GeForce 9600M GT 512MB
    Thanks,
    Andrew

    Yes, we have a handful of bugs filed with Apple about similar issues introduced in MacOS 10.6.
    We're all waiting for Apple to release the fixes.

  • IPhone: OpenGL ES Texturing

    I just began writing an iPhone game and I'm having difficulties displaying multiple textures.
    Only the last texture I generate is appearing and all the textures I generated previously appear white.
    Here is major rendering functions so far, is there anything that stands out as incorrect?
    //Generates textures for a game object
    - (void)GenerateTextures:(Hairball::Objects)Obj
    CGImageRef spriteImage;
    CGContextRef spriteContext;
    GLubyte *spriteData;
    size_t width, height;
    GLuint *tempTex;
    // Creates a Core Graphics image from an image file
    switch (Obj)
    case Hairball::PLAYER:
    spriteImage = [UIImage imageNamed:@"Sprite.png"].CGImage;
    tempTex = &(TextureArray[0]);
    break;
    case Hairball::BACKGROUND:
    spriteImage = [UIImage imageNamed:@"BG1.png"].CGImage;
    tempTex = &(TextureArray[1]);
    break;
    case Hairball::HUD:
    spriteImage = [UIImage imageNamed:@"Icon.png"].CGImage;
    tempTex = &(TextureArray[2]);
    break;
    default:
    break;
    // Get the width and height of the image
    width = CGImageGetWidth(spriteImage);
    height = CGImageGetHeight(spriteImage);
    if(spriteImage)
    // Allocated memory needed for the bitmap context
    spriteData = (GLubyte *) malloc(width * height * 4);
    // Uses the bitmatp creation function provided by the Core Graphics framework.
    spriteContext = CGBitmapContextCreate(spriteData, width, height, 8, width * 4, CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast);
    // After you create the context, you can draw the sprite image to the context.
    CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)width, (CGFloat)height), spriteImage);
    // You don't need the context at this point, so you need to release it to avoid memory leaks.
    CGContextRelease(spriteContext);
    // Use OpenGL ES to generate a name for the texture.
    glGenTextures(1, tempTex);
    // Bind the texture name.
    glBindTexture(GLTEXTURE2D, *tempTex);
    // Speidfy a 2D texture image, provideing the a pointer to the image data in memory
    glTexImage2D(GLTEXTURE2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GLUNSIGNEDBYTE, spriteData);
    // Release the image data
    free(spriteData);
    //Inits OpenGl for drawing
    - (void)setupView
    //Creates object Manager to handle
    ObjectMgr = new ObjectManager();
    //Create Objects
    GameObject* Object1 = new GameObject(Hairball::BACKGROUND, 0.0f, 0.0f, 0.0f, 0.0f, 3.2f, 3.2f);
    ObjectMgr->AddToList(Object1);
    GameObject* Object2 = new GameObject(Hairball::PLAYER, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f);
    ObjectMgr->AddToList(Object2);
    //Generate all textures
    [self GenerateTextures:Hairball::PLAYER];
    [self GenerateTextures:Hairball::BACKGROUND];
    //For each obj assign a texture
    std::list<GameObject*>::iterator Object = (ObjectMgr->mObjectList.begin());
    std::list<GameObject*>::iterator End = (ObjectMgr->mObjectList.end());
    //For each game object
    while(Object != End)
    //Apply texture to each object
    switch ((*Object)->mObjectType)
    case Hairball::PLAYER: (*Object)->mSpriteTexture = TextureArray[0]; break;
    case Hairball::BACKGROUND: (*Object)->mSpriteTexture = TextureArray[1]; break;
    case Hairball::HUD: (*Object)->mSpriteTexture = TextureArray[2]; break;
    default:
    break;
    ++Object;
    // Clears the view with grey
    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    // Set the texture parameters to use a minifying filter and a linear filer (weighted average)
    glTexParameteri(GLTEXTURE2D, GLTEXTURE_MINFILTER, GL_LINEAR);
    // Enable use of the texture
    glEnable(GLTEXTURE2D);
    // Set a blending function to use
    glBlendFunc(GL_ONE, GLONE_MINUS_SRCALPHA);
    // Enable blending
    glEnable(GL_BLEND);
    - (void)drawView
    [EAGLContext setCurrentContext:context];
    glBindFramebufferOES(GLFRAMEBUFFEROES, viewFramebuffer);
    glViewport(0, 0, backingWidth, backingHeight);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);
    //Clear the backbuffer
    glClear(GLCOLOR_BUFFERBIT);
    std::list<GameObject*>::iterator Object = (ObjectMgr->mObjectList.begin());
    std::list<GameObject*>::iterator End = (ObjectMgr->mObjectList.end());
    //For each game object
    while(Object != End)
    // Bind the texture name.
    glBindTexture(GLTEXTURE2D, (*Object)->mSpriteTexture);
    //apply transformations
    glPushMatrix();
    glTranslatef((*Object)->mPosition.x, (*Object)->mPosition.y, (*Object)->mPosition.z);
    glRotatef((*Object)->mRotation, 0.0f, 0.0f, 1.0f);
    (*Object)->mRotation += 0.5f; //Rotate
    //Get current sprites verticies
    glVertexPointer(2, GL_FLOAT, 0, (*Object)->mSpriteVertices);
    glEnableClientState(GLVERTEXARRAY);
    //Get current sprites tex coords
    glTexCoordPointer(2, GL_SHORT, 0, (*Object)->mSpriteTexcoords);
    glEnableClientState(GLTEXTURE_COORDARRAY);
    //Render the vertex array
    glDrawArrays(GLTRIANGLESTRIP, 0, 4);
    //pop the transformation matrix
    glPopMatrix();
    ++Object;
    glBindRenderbufferOES(GLRENDERBUFFEROES, viewRenderbuffer);
    [context presentRenderbuffer:GLRENDERBUFFEROES];
    }

    The value generated by glGenTextures() in (*Object)->mSpriteTexture for the BACKGROUND object is 1 and for the sprite object it is 2. Which appear to be correct values?
    If I exchange:
    self GenerateTextures:Hairball::PLAYER;
    self GenerateTextures:Hairball::BACKGROUND;
    To
    self GenerateTextures:Hairball::BACKGROUND;
    self GenerateTextures:Hairball::PLAYER;
    then my scene goes from this:
    http://img207.imageshack.us/img207/8229/picture1nf6.png
    to this:
    http://img253.imageshack.us/img253/5282/picture2gr8.png
    So both textures draw, just not at the same time?
    Oh, here it is formatted better:
    //Generates textures for a game object
    - (void)GenerateTextures:(Hairball::Objects)Obj
    CGImageRef spriteImage;
    CGContextRef spriteContext;
    GLubyte *spriteData;
    size_t width, height;
    int texIndex = 0;
    // Creates a Core Graphics image from an image file
    switch (Obj)
    case Hairball::PLAYER:
    spriteImage = [UIImage imageNamed:@"Sprite.png"].CGImage;
    texIndex = 0;
    break;
    case Hairball::BACKGROUND:
    spriteImage = [UIImage imageNamed:@"BG1.png"].CGImage;
    texIndex = 1;
    break;
    case Hairball::HUD:
    spriteImage = [UIImage imageNamed:@"Icon.png"].CGImage;
    texIndex = 2;
    break;
    default:
    break;
    // Get the width and height of the image
    width = CGImageGetWidth(spriteImage);
    height = CGImageGetHeight(spriteImage);
    if(spriteImage)
    // Allocated memory needed for the bitmap context
    spriteData = (GLubyte *) malloc(width * height * 4);
    // Uses the bitmatp creation function provided by the Core Graphics framework.
    spriteContext = CGBitmapContextCreate(spriteData, width, height, 8, width * 4, CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast);
    // After you create the context, you can draw the sprite image to the context.
    CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)width, (CGFloat)height), spriteImage);
    // You don't need the context at this point, so you need to release it to avoid memory leaks.
    CGContextRelease(spriteContext);
    // Bind the texture name.
    glBindTexture(GLTEXTURE2D, TextureArray[texIndex]);
    // Speidfy a 2D texture image, provideing the a pointer to the image data in memory
    glTexImage2D(GLTEXTURE2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GLUNSIGNEDBYTE, spriteData);
    // Release the image data
    free(spriteData);
    //Inits OpenGl for drawing
    - (void)setupView
    //Creates object Manager to handle
    ObjectMgr = new ObjectManager();
    //Create Objects
    GameObject* Object1 = new GameObject(Hairball::BACKGROUND, 0.0f, 0.0f, 0.0f, 0.0f, 3.2f, 3.2f);
    ObjectMgr->AddToList(Object1);
    GameObject* Object2 = new GameObject(Hairball::PLAYER, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f);
    ObjectMgr->AddToList(Object2);
    //Generate all textures
    glGenTextures(NUMTEXTURES, TextureArray); // Use OpenGL ES to generate a name for the texture.
    [self GenerateTextures:Hairball::BACKGROUND];
    [self GenerateTextures:Hairball::PLAYER];
    //For each obj assign a texture
    std::list<GameObject*>::iterator Object = (ObjectMgr->mObjectList.begin());
    std::list<GameObject*>::iterator End = (ObjectMgr->mObjectList.end());
    //For each game object
    while(Object != End)
    //Apply texture to each object
    switch ((*Object)->mObjectType)
    case Hairball::PLAYER: (*Object)->mSpriteTexture = TextureArray[0]; break;
    case Hairball::BACKGROUND: (*Object)->mSpriteTexture = TextureArray[1]; break;
    case Hairball::HUD: (*Object)->mSpriteTexture = TextureArray[2]; break;
    default:
    break;
    ++Object;
    // Clears the view with grey
    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    // Set the texture parameters to use a minifying filter and a linear filer (weighted average)
    glTexParameteri(GLTEXTURE2D, GLTEXTURE_MINFILTER, GL_LINEAR);
    // Enable use of the texture
    glEnable(GLTEXTURE2D);
    // Set a blending function to use
    glBlendFunc(GL_ONE, GLONE_MINUS_SRCALPHA);
    // Enable blending
    glEnable(GL_BLEND);
    - (void)drawView
    [EAGLContext setCurrentContext:context];
    glBindFramebufferOES(GLFRAMEBUFFEROES, viewFramebuffer);
    glViewport(0, 0, backingWidth, backingHeight);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);
    //Clear the backbuffer
    glClear(GLCOLOR_BUFFERBIT);
    std::list<GameObject*>::iterator Object = (ObjectMgr->mObjectList.begin());
    std::list<GameObject*>::iterator End = (ObjectMgr->mObjectList.end());
    //For each game object
    while(Object != End)
    // Bind the texture name.
    glBindTexture(GLTEXTURE2D, (*Object)->mSpriteTexture);
    //apply transformations
    glPushMatrix();
    glTranslatef((*Object)->mPosition.x, (*Object)->mPosition.y, (*Object)->mPosition.z);
    glRotatef((*Object)->mRotation, 0.0f, 0.0f, 1.0f);
    //(*Object)->mRotation += 0.5f; //Rotate
    //Get current sprites verticies
    glVertexPointer(2, GL_FLOAT, 0, (*Object)->mSpriteVertices);
    glEnableClientState(GLVERTEXARRAY);
    //Get current sprites tex coords
    glTexCoordPointer(2, GL_SHORT, 0, (*Object)->mSpriteTexcoords);
    glEnableClientState(GLTEXTURE_COORDARRAY);
    //Render the vertex array
    glDrawArrays(GLTRIANGLESTRIP, 0, 4);
    //pop the transformation matrix
    glPopMatrix();
    ++Object;
    glBindRenderbufferOES(GLRENDERBUFFEROES, viewRenderbuffer);
    [context presentRenderbuffer:GLRENDERBUFFEROES];

  • IPhone wifi bug and battery drain in iOS 8.1

    I have an iPhone 5s 32GB and updated it to iOS 8.1
    the wifi bug is still there and my battery drains within 4 hours of normal use(no gaming)
    the option to chose 2G/3G isnt there too
    any help ?
    Please fix these bugs soon

    Power cycle the battery, let it fully drain to where your phone shuts off and then fully charge it without using it.
    As for mail if you have it set to push try using manually fetch - the server will only check for emails when you open the mail app, instead of pushing the mail to your phone when you receive one.

  • Ios 8.1, will it fix iphone 4s bugs?

    After uploading 8.0, my 4s iphone took a dive bomb in its functionality.
    I seriously considered driving a screw into its guts and dropping it down a sewer.
    I felt betrayed by Apple, to be honest, after reading some stuff online.
    But a line of hope was tossed out, that Apple would fix the multiple bugs in the 8.1 update.
    So I am holding on for now.
    And now 8.1 is out.
    But nothing in the description suggests any fixes for the 4S users... and it might just make it worse.
    Any experience out there?

    I found a list of advice on the web, and tried one of two of them, but I really can't recall what I tried, to be honest.
    I think I had to reset my location services or something, maybe?
    Let's assume I have done nothing: what is your advice? What did you do?
    My main impression is that everything has ..slooooowed.....dooooown......
    as if the operating system is too big for the hardware.

  • IPhone sensitivity bug in Outlook syncs

    The iPhone does not support the "sensitivity" setting in Outlook contacts/calendar. This setting must be either normal, personal,private or confidential. Other PDAs which don't have a way to set this (to private on the calendar, for example), just set everything to "normal". Since this setting is "blank" on the iPhone, calendar entries which originate on the iPhone will not sync to an exchange server or 3rd party sync app that is set to recognize this feature (ours is). Thus I can sync iphone calendar entries to the desktop (Outlook 2003 using Unicode), but they will not sync to the server.
    The workaround appears to be that all calendar items must be originated at the server (my secy) or the desktop. They can then be modified by the iphone. Otherwise, the desktop must be set to view "sensitivity" and each iPhone calendar entry must be modified on the desktop to the "normal" setting one by one. Does anyone know a better workaround or is Apple going to fix this bug?

    If the user prefers something other than Hebrew, I think the same result can be had by adding a dingbat.  These can easily be found in an app like Unicode Map.  ✈✌✩❄➳

  • IPhone Calendar Bug

    I would report a bug in the iPhone calendar.
    today i've setted an "October 31" event and I setted the monthly repeat of the event, but the result was that the event is repeated only for the 31 days months (such as December, January, ecc) and does not appear in the months with 30 day or less (such as November, February ecc)
    I reported this bug to Apple, and I hope they can find a solution to this problem.

    I found a solution. When using gmail.com follow these steps to fix it:
    http://www.google.com/support/mobile/bin/answer.py?answer=138740&topic=14252
    Cheers,
    Zdary

  • IPhone Gmail bug

    If you add a new Gmail IMAP account using the "Gmail" logo option, you don't have the ability to change the behaviors of the "Sent Mail" from the Advanced Tab. However, if you add a Gmail IMAP account using the "Other" option, then you do have the option to change the behavior of "Sent Mail" from the Advanced Tab.

    The "bug" part is that if you include an IMAP Prefix and you don't have the option to set the "Sent Behavior," then any mail you compose will not be visible under "Sent Messages." It's puzzling why a creating a standard IMAP account gives you more advanced IMAP options than when creating a Gmail IMAP account on the iPhone. Also, if you sync your mail.app settings through iTunes, and mail.app has a Gmail account with an IMAP Prefix and specific "Sent Mail" behavior, none of these particulars get synced to the iPhone. Thus, you have to setup these Gmail particulars manually on the iPhone.

Maybe you are looking for

  • Missing BOOTMGR on Satellite C660

    Hi folks, I have Satellite C660, at first i had a virus, and tried to reinstall windows, but no good. When it came up to the point of saying there was not enough space on the disk to install windows, I realised i had forgot about the partition bit. N

  • How do I turn off audio program in background?

    How do I turn off audio program playing in background?

  • New Convert to Mac.  Did Time Machine wipe out my external hard drive?

    I recently purchased a MacBook Pro. I have all of my files and pictures from my PC on my external hard drive. When I connected it to the USB port, Time Machine came up. I don't remember what I selected, but now when I plug in the drive, "time machine

  • Active Window suddenly drops to background

    Besides not being able to switch to an application window on clicking on the application in the dock, (see previous post) i've also had a concurrent issue that seems to make the active window suddently go right to the back window, this seems to be ha

  • Add Role  to a business partner

    Hello, I'm trying to add the role to a business partner using the BAPI_BUPA_ROLE_ADD_2. but it does not work. more precisely, the following happens . fill the required parameters, run the function BAPI_BUPA_ROLE_ADD_2.  it does not give errors, see t