Texture stops rendering on iphone

Hello everyone,

I’ve just recently picked up opengl and have ran into a problem that I need some help with. Basically, when I start up my app, a rectangle is supposed to render on the screen with a texture bound to it. Without the texture, I can get the whole texture to fill in perfectly with the colour blue. But when I apply a texture, some of the texture fades out.

I’ve been playing around with it and noticed that this happens only when I increase the amount of triangles used to form the rectangle. It also seems to happen if I make the rectangle ridiculously big.

The texture is a simple 512x512 jpg image so I don’t think that the image itself is the issue.

I’ve created a sample project with most of my game logic stripped out. (This project was made with the help of 71squared.com’s tutorials).

Here’s the file: http://dl.dropbox.com/u/21820920/Example.zip

All code relative to this texture problem can be found in the following files in the project:

  • Primitives.h/Primitives.m
  • Structures.h
  • MenuScene.h/MenuScene.m

There is a setCurrentVertices method in the MenuScene.m file. When I create the vertices for the shapes I only store the top values of the shape. I use setCurrentVertices to fill an array with both the top and bottom vertices of the shape.

Another thing I’ve noticed is that if I comment out the background and the call to the shared render manager at the start of the renderScene method, I run into an error. The program pauses and I’m brought to the drawBezier method in Primitives.m with the error message “Thread 1: Program received signal: ‘EXC_BAD_ACCESS’”. I’m not really sure why this is happening… but I think it most likely is related to my original problem. I added a comment to the method so that it’s easy to find what I’m referring to.

Here’s a picture of my desired output: http://dl.dropbox.com/u/21820920/expectedResult.jpg

I can’t stress enough how much I would really appreciate any help on this matter!! (I’ve been struggling with this for over a month now :/)

Hopefully this issue is related to some stupid mistake that I made somewhere in the code and can easy be fixed! :stuck_out_tongue: