- February 17, 2011 at 10:54 pm #30456
After starting a project using xCode’s OpenGL app template, I decided to modify it to render a POD file straight to a renderer object from a container class. However, only my glClearColor is showing up. Here are the relevant classes on Pastehub.com:
GameState protocol:Code:#import <UIKit/UIKit.h>
GLCommon.h is included in the example project in this blog post. The needed POD files are in the project at http://sourceforge.net/projects/iphonegamebook/files/iPhoneGameBook_CH5/.
MachCUBED 2011-02-18 23:22:16March 7, 2011 at 8:32 pm #34758
Ok, I decided to change my Model.mm file with the code from the PVR tutorial. Model.h now looks like this:
I’m getting an EXC_BAD_ACCESS in the debugger console at the following line in -(void)draw:Code:if(model.pCamera[i32CamID].nIdxTarget != -1) // Does the camera have a target?
This is despite the fact that it works just fine in the IntroducingPOD Tutorial example, in the C++ method RenderScene(). In fact, -(void)draw is just an Obj-C implementation of RenderScene(), except that the following timer code is commented out:Code://Calculates the frame number to animate in a time-based manner.
//Uses the shell function PVRShellGetTime() to get the time in milliseconds.
int iTime = PVRShell::PVRShellGetTime();
int iDeltaTime = iTime – m_iTimePrev;
m_iTimePrev = iTime;
m_fFrame += (float)iDeltaTime * g_fDemoFrameRate;
if (m_fFrame > scene->nNumFrame – 1)
m_fFrame = 0;
What’s going on? Changing model back to a void pointer and typecasting it, the changing everything to pointers in my class only cases an EXC_BAD_ACCESS in PVRTModelPOD. Please help. Moderator, please change this thread’s title to “”/EXC_BAD_ACCESS”/ when accessing CPVRTModelPOD.pCamera”.