mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
iphone tweaks
This commit is contained in:
parent
d676bccb8e
commit
91efcfbf10
@ -1008,7 +1008,11 @@ reset() {
|
|||||||
_glBlendColor = null_glBlendColor;
|
_glBlendColor = null_glBlendColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OPENGLES_1
|
||||||
|
_edge_clamp = GL_REPEAT;
|
||||||
|
#else
|
||||||
_edge_clamp = GL_CLAMP;
|
_edge_clamp = GL_CLAMP;
|
||||||
|
#endif
|
||||||
if (has_extension("GL_SGIS_texture_edge_clamp") ||
|
if (has_extension("GL_SGIS_texture_edge_clamp") ||
|
||||||
is_at_least_version(1, 2)) {
|
is_at_least_version(1, 2)) {
|
||||||
_edge_clamp = GL_CLAMP_TO_EDGE;
|
_edge_clamp = GL_CLAMP_TO_EDGE;
|
||||||
@ -5514,20 +5518,29 @@ get_internal_image_format(Texture *tex) const {
|
|||||||
} else {
|
} else {
|
||||||
return GL_DEPTH_COMPONENT;
|
return GL_DEPTH_COMPONENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Texture::F_rgba:
|
case Texture::F_rgba:
|
||||||
case Texture::F_rgbm:
|
case Texture::F_rgbm:
|
||||||
return GL_RGBA;
|
return GL_RGBA;
|
||||||
case Texture::F_rgba4:
|
case Texture::F_rgba4:
|
||||||
return GL_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:
|
case Texture::F_rgba8:
|
||||||
return GL_RGBA8;
|
return GL_RGBA8;
|
||||||
case Texture::F_rgba12:
|
case Texture::F_rgba12:
|
||||||
return GL_RGBA12;
|
return GL_RGBA12;
|
||||||
|
|
||||||
case Texture::F_rgba16:
|
case Texture::F_rgba16:
|
||||||
return GL_RGBA16F_ARB;
|
return GL_RGBA16F_ARB;
|
||||||
case Texture::F_rgba32:
|
case Texture::F_rgba32:
|
||||||
return GL_RGBA32F_ARB;
|
return GL_RGBA32F_ARB;
|
||||||
|
#endif // OPENGLES_1
|
||||||
|
|
||||||
case Texture::F_rgb:
|
case Texture::F_rgb:
|
||||||
return GL_RGB;
|
return GL_RGB;
|
||||||
@ -5535,10 +5548,18 @@ get_internal_image_format(Texture *tex) const {
|
|||||||
return GL_RGB5;
|
return GL_RGB5;
|
||||||
case Texture::F_rgba5:
|
case Texture::F_rgba5:
|
||||||
return GL_RGB5_A1;
|
return GL_RGB5_A1;
|
||||||
|
|
||||||
|
#ifdef OPENGLES_1
|
||||||
|
case Texture::F_rgb8:
|
||||||
|
case Texture::F_rgb12:
|
||||||
|
return GL_RGB;
|
||||||
|
#else
|
||||||
case Texture::F_rgb8:
|
case Texture::F_rgb8:
|
||||||
return GL_RGB8;
|
return GL_RGB8;
|
||||||
case Texture::F_rgb12:
|
case Texture::F_rgb12:
|
||||||
return GL_RGB12;
|
return GL_RGB12;
|
||||||
|
#endif // OPENGLES_1
|
||||||
|
|
||||||
case Texture::F_rgb332:
|
case Texture::F_rgb332:
|
||||||
return GL_R3_G3_B2;
|
return GL_R3_G3_B2;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#import "EAGLView.h"
|
#import "EAGLView.h"
|
||||||
|
|
||||||
#define USE_DEPTH_BUFFER 0
|
#define USE_DEPTH_BUFFER 1
|
||||||
|
|
||||||
// A class extension to declare private methods
|
// A class extension to declare private methods
|
||||||
@interface EAGLView ()
|
@interface EAGLView ()
|
||||||
@ -93,6 +93,7 @@
|
|||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
|
||||||
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
|
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
|
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) {
|
if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
|
||||||
|
@ -24,10 +24,46 @@
|
|||||||
@synthesize animationInterval;
|
@synthesize animationInterval;
|
||||||
|
|
||||||
PandaFramework framework;
|
PandaFramework framework;
|
||||||
int startup = 0;
|
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(UIApplication *)application {
|
- (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];
|
[self startAnimation];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,28 +93,8 @@ int startup = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawView {
|
- (void)drawView {
|
||||||
if (startup == 0) {
|
Thread *current_thread = Thread::get_current_thread();
|
||||||
int argc = 0;
|
framework.do_frame(current_thread);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user