Texture stops rendering

Posts: 2
Joined: 2011.07
Post: #1
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! Rasp

Quote this message in a reply
Posts: 452
Joined: 2008.04
Post: #2
It looks like vertex colors are being set that are causing the drawBezier call to fade out to transparent (alpha).

[Image: upshot_BQdLW61X.png]

I modified the background a bit.

I guess you have to disable the vertex coloring stuff, if that's an optin, or pass glColorPointers along with the glVertexPointer. I'm probably the wrong person to ask, but I bet Keith will see this and correct me.

By the way, welcome to the forums, and fantastic writeup for your first post. You managed to include all the relevant details, the entire project, and you can spell words! It's very refreshing!

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Posts: 2
Joined: 2011.07
Post: #3
Thanks for the quick reply and positive feedback Smile

I tried to list all of the relevant information so that it would be easier on the people trying to help me out (I hate it when someone just lists a code block in a huge app and expects someone to be able to fix the problem instantly Rasp).

Good idea about changing the background, I've done the same. It makes such a big difference!

At one point I added color pointers to the draw function but I couldn't get it to work right. I'll take another look at it, that could very well solve my problem. But if that doesn't solve it... is there anything else that could explain the behavior I'm experiencing?

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  NSString and tab stops? bmantzey 6 5,637 Mar 5, 2010 12:51 AM
Last Post: bmantzey
  rendering framebuffer texture not working lookitsash 2 4,037 Oct 30, 2009 09:49 AM
Last Post: arekkusu