Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Creating and Attaching Scripts to a Breakpoint

OpenGL Profiler allows you to execute (at a performance cost) small amounts of OpenGL code or other scripting calls when your application pauses at a breakpoint. A script is a text file that contains OpenGL function calls. For example, a script can be as simple as the following line of code:

glClear(1.0, 0.0, 0.0, 1.0);

Or it can be more complex, containing many lines of code, such as:

glBegin(GL_POINTS);
glVertex3f(0,0,1);
glVertex3f(1,0,1);
glVertex3f(1,1,1);
glVertex3f(0,1,1);
glEnd();

You can create a script using any text editor, or you can enter a script directly into the Scripts window.

To add a script:

  1. Choose Views > Scripts to open the Scripts window.


    The Scripts window.
  2. If you created the script in a text editor, click Open, navigate to the script, and choose it. If you want to create a script in the Scripts window, click the plus (+) button, enter a script name, then type commands in the text window on the right.

    Any script that you add in the Scripts window will be available from the Breakpoints window.

After you add a script to OpenGL Profiler, you can either execute it manually or attach it to a breakpoint.

To execute a script manually when your application pauses at a breakpoint:

  1. Choose a script in the Scripts window.

  2. Click Execute.

    OpenGL Profiler sends the commands to your application for execution. Errors in your script appear in the pane located in the lower left of the Scripts window.

To attach a script to a breakpoint:

  1. Open the Breakpoints window.

  2. Choose Actions > Attach Script.

  3. In the sheet that appears, choose a script.

  4. Select one or more execution options.

    You can choose to have OpenGL Profiler execute the script before, after, or both before and after the OpenGL function. You can also choose to have your application continue after executing the script.

  5. Click Attach.

    A small document icon appears in the functions list next to the blue breakpoint indicator for the function.

Note: Attaching a script to a function that your application uses repeatedly is an expensive operation. Data that you look at when the script executes is not an accurate measure of performance.

To remove a script from a breakpoint, choose Actions > Remove Script.



< Previous PageNext Page > Hide TOC


Last updated: 2008-02-08




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice