Graphics Reference
In-Depth Information
/Applications/Imagination/PowerVR/GraphicsSDK/PVRTexTool/CL/OSX_x86/PVRTexToolCL -i
{input_file_name}.png -o {output_file_name}.pvr -legacypvr -p -f PVRTC1_4 -q
pvrtcbest
Listing 14.8 shows the code required to load and display a PVRTC image (adapted from the
CAEAGLLayer example code in Chapter 6).
Listing 14.8 Loading and Displaying a PVRTC Image
#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
#import <GLKit/GLKit.h>
@interface ViewController ()
@property ( nonatomic , weak ) IBOutlet UIView *glView;
@property ( nonatomic , strong ) EAGLContext *glContext;
@property ( nonatomic , strong ) CAEAGLLayer *glLayer;
@property ( nonatomic , assign ) GLuint framebuffer;
@property ( nonatomic , assign ) GLuint colorRenderbuffer;
@property ( nonatomic , assign ) GLint framebufferWidth;
@property ( nonatomic , assign ) GLint framebufferHeight;
@property ( nonatomic , strong ) GLKBaseEffect *effect;
@property ( nonatomic , strong ) GLKTextureInfo *textureInfo;
@end
@implementation ViewController
- ( void )setUpBuffers
{
//set up frame buffer
glGenFramebuffers ( 1 , & _framebuffer );
glBindFramebuffer ( GL_FRAMEBUFFER , _framebuffer );
//set up color render buffer
glGenRenderbuffers ( 1 , & _colorRenderbuffer );
glBindRenderbuffer ( GL_RENDERBUFFER , _colorRenderbuffer );
glFramebufferRenderbuffer ( GL_FRAMEBUFFER , GL_COLOR_ATTACHMENT0 ,
GL_RENDERBUFFER , _colorRenderbuffer );
[ self . glContext renderbufferStorage : GL_RENDERBUFFER
fromDrawable : self . glLayer ];
glGetRenderbufferParameteriv (
GL_RENDERBUFFER , GL_RENDERBUFFER_WIDTH , & _framebufferWidth );
glGetRenderbufferParameteriv (
GL_RENDERBUFFER , GL_RENDERBUFFER_HEIGHT , & _framebufferHeight );
Search WWH ::




Custom Search