cocos2d-x Enable OpenGLES Stencil Buffer
cocos2d-x Sample의 ClippingNodeTest 쪽을 보면 위와같이 스텐실 버퍼와 관련된 샘플을 확인할 수 있습니다. 이번 신규 프로젝트가 이 스텐실 버퍼를 사용하고 있어서 약간의 수정이 필요하더군요.
iOS
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples:0 ];
iOS
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples:0 ];
위 부분에서 볼드 처리한 부분을 GL_DEPTH24_STENCIL8_OES 로 변경하면 됩니다.
Android
///< import 추가
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
public class MyGame extends Cocos2dxActivity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
///< 추가
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
...
...
}
안드로이드는 개발중인 프로젝트.java 파일을 위와 같이 추가합니다.
댓글
댓글 쓰기