1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00
Samo Pajk a2ab2a84e5 Changes:
- added render to texture features (RenderTarget2D)
- optimized SpriteFont for faster access and allocations
- fixed iOS6 bug witch prevented proper device orientation 
- fixed some problems when handling touch events

git-svn-id: http://xni.googlecode.com/svn/XNI@112 ac433895-eea3-a490-d80a-17149a75e588
2012-09-15 15:33:22 +00:00

68 lines
1.6 KiB
Objective-C

//
// RenderTarget2D.m
// XNI
//
// Created by Samo Pajk on 9/3/12.
// Copyright (c) 2012 Samo Pajk. All rights reserved.
//
#import "RenderTarget2D.h"
#import "Retronator.Xni.Framework.h"
#import "Retronator.Xni.Framework.Graphics.h"
#import <QuartzCore/QuartzCore.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
@interface RenderTarget2D (){
GLuint framebuffer;
GLuint renderBuffer;
}
@end
@implementation RenderTarget2D
- (id)initWithGraphicsDevice:(GraphicsDevice *)theGraphicsDevice
width:(int)theWidth
height:(int)theHeight
mipmap:(BOOL)theMipmap
surfaceFormat:(SurfaceFormat)theSurfaceFormat
depthFormat:(DepthFormat)theDepthFormat
multiSampleCount:(int) theMultisampleCount
usage:(RenderTargetUsage)theUsage{
self = [super initWithGraphicsDevice:theGraphicsDevice width:theWidth height:theHeight mipMaps:theMipmap format:theSurfaceFormat];
if (self) {
//Texture is already created by super object.
//Here we only create a framebuffer.
glGenFramebuffersOES(1, &framebuffer);
glGenRenderbuffersOES(1, &renderBuffer);
}
return self;
}
@synthesize renderTargetUsage, isContentLost;
-(GLuint) colorFramebuffer{
return framebuffer;
}
-(GLuint) colorRenderbuffer{
return renderBuffer;
}
- (void)dealloc{
glDeleteFramebuffers(1, &framebuffer);
[super dealloc];
}
- (void) saveAsPng:(NSData*)textureData width:(int)width height:(int)height{
}
@end