“EXC_BAD_ACCESS” accessing CPVRTModelPOD.pCamera

This topic contains 1 reply, has 1 voice, and was last updated by  MachCUBED 6 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30456

    MachCUBED
    Member

    Hello everyone,

    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:

    ES2Renderer.h

    ES2Renderer.m

    PlayTest.h

    PlayTest.mm

    Ship.h

    Ship.mm

    Sprite3D.h

    Sprite3D.mm

    Model.h

    Model.mm

    GLProgram.h

    GLProgram.m

    GameState protocol:

    Code:
    #import <UIKit/UIKit.h>

    @protocol GameState

    -(void) updateLoop;

    @optional

    -(BOOL) handleEvent:(void*)event;

    @end

    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/.MachCUBED2011-02-18 23:22:16

    #34758

    MachCUBED
    Member

    Ok, I decided to change my Model.mm file with the code from the PVR tutorial. Model.h now looks like this:

    Model.h

    Model.mm

    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”.

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.