iphone tweaks

This commit is contained in:
David Rose 2009-04-21 15:04:25 +00:00
parent d676bccb8e
commit 91efcfbf10
3 changed files with 64 additions and 26 deletions

View File

@ -1008,7 +1008,11 @@ reset() {
_glBlendColor = null_glBlendColor;
}
#ifdef OPENGLES_1
_edge_clamp = GL_REPEAT;
#else
_edge_clamp = GL_CLAMP;
#endif
if (has_extension("GL_SGIS_texture_edge_clamp") ||
is_at_least_version(1, 2)) {
_edge_clamp = GL_CLAMP_TO_EDGE;
@ -5514,20 +5518,29 @@ get_internal_image_format(Texture *tex) const {
} else {
return GL_DEPTH_COMPONENT;
}
case Texture::F_rgba:
case Texture::F_rgbm:
return GL_RGBA;
case Texture::F_rgba4:
return GL_RGBA4;
#ifdef OPENGLES_1
case Texture::F_rgba8:
case Texture::F_rgba12:
case Texture::F_rgba16:
case Texture::F_rgba32:
return GL_RGBA;
#else
case Texture::F_rgba8:
return GL_RGBA8;
case Texture::F_rgba12:
return GL_RGBA12;
case Texture::F_rgba16:
return GL_RGBA16F_ARB;
case Texture::F_rgba32:
return GL_RGBA32F_ARB;
#endif // OPENGLES_1
case Texture::F_rgb:
return GL_RGB;
@ -5535,10 +5548,18 @@ get_internal_image_format(Texture *tex) const {
return GL_RGB5;
case Texture::F_rgba5:
return GL_RGB5_A1;
#ifdef OPENGLES_1
case Texture::F_rgb8:
case Texture::F_rgb12:
return GL_RGB;
#else
case Texture::F_rgb8:
return GL_RGB8;
case Texture::F_rgb12:
return GL_RGB12;
#endif // OPENGLES_1
case Texture::F_rgb332:
return GL_R3_G3_B2;

View File

@ -17,7 +17,7 @@
#import "EAGLView.h"
#define USE_DEPTH_BUFFER 0
#define USE_DEPTH_BUFFER 1
// A class extension to declare private methods
@interface EAGLView ()
@ -93,6 +93,7 @@
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
}
if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {

View File

@ -24,10 +24,46 @@
@synthesize animationInterval;
PandaFramework framework;
int startup = 0;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
animationInterval = 1.0 / 60.0;
ConfigVariableString pview_args("pview-args", "");
int argc = pview_args.get_num_words() + 1;
typedef char *charp;
char **argv = new charp[argc + 1];
argv[0] = (char *)"pview";
for (int i = 1; i < argc; ++i) {
cerr << i << ". " << pview_args.get_word(i - 1) << "\n";
argv[i] = strdup(pview_args.get_word(i - 1).c_str());
}
argv[argc] = NULL;
framework.open_framework(argc, argv);
WindowFramework *window = framework.open_window();
if (window != (WindowFramework *)NULL) {
window->enable_keyboard();
window->setup_trackball();
framework.get_models().instance_to(window->get_render());
if (argc < 2) {
window->load_default_model(framework.get_models());
} else {
window->load_models(framework.get_models(), argc, argv);
}
int hierarchy_match_flags = PartGroup::HMF_ok_part_extra |
PartGroup::HMF_ok_anim_extra;
window->loop_animations(hierarchy_match_flags);
window->center_trackball(framework.get_models());
ConfigVariableBool want_pstats("want-pstats", false);
if (want_pstats) {
PStatClient::connect();
}
}
ConfigVariableDouble timer_fps("timer-fps", 60.0);
animationInterval = 1.0 / timer_fps;
[self startAnimation];
}
@ -57,28 +93,8 @@ int startup = 0;
}
- (void)drawView {
if (startup == 0) {
int argc = 0;
char **argv = NULL;
framework.open_framework(argc, argv);
startup = 1;
} else if (startup == 1) {
WindowFramework *window = framework.open_window();
if (window != (WindowFramework *)NULL) {
window->enable_keyboard();
window->setup_trackball();
framework.get_models().instance_to(window->get_render());
window->load_default_model(framework.get_models());
window->center_trackball(framework.get_models());
}
startup = 2;
} else {
Thread *current_thread = Thread::get_current_thread();
framework.do_frame(current_thread);
}
Thread *current_thread = Thread::get_current_thread();
framework.do_frame(current_thread);
}
- (void)dealloc {