Cleaning up Some..

This commit is contained in:
Roger Hughston 2006-03-11 01:54:02 +00:00
parent 5a52512d8e
commit 325e42d530
10 changed files with 568 additions and 530 deletions

View File

@ -1,10 +1,7 @@
// Filename: config_glxdisplay.cxx
// Created by: cary (07Oct99)
//
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// //
// PANDA 3D SOFTWARE // PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved // Copyright (c) 2001 - 2006, Disney Enterprises, Inc. All rights reserved
// //
// All use of this software is subject to the terms of the Panda 3d // All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license // Software license. You should have received a copy of this license
@ -55,8 +52,6 @@ init_libosxdisplay() {
} }
initialized = true; initialized = true;
printf("****** In libosx init \n");
osxGraphicsStateGuardian::init_type(); osxGraphicsStateGuardian::init_type();
osxGraphicsPipe::init_type(); osxGraphicsPipe::init_type();
osxGraphicsWindow::init_type(); osxGraphicsWindow::init_type();
@ -69,8 +64,4 @@ init_libosxdisplay() {
PandaSystem *ps = PandaSystem::get_global_ptr(); PandaSystem *ps = PandaSystem::get_global_ptr();
ps->set_system_tag("OpenGL", "window_system", "OSX"); ps->set_system_tag("OpenGL", "window_system", "OSX");
printf("****** out libosx init \n");
} }

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// //
// PANDA 3D SOFTWARE // PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved // Copyright (c) 2001 - 2006, Disney Enterprises, Inc. All rights reserved
// //
// All use of this software is subject to the terms of the Panda 3d // All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license // Software license. You should have received a copy of this license
@ -26,6 +26,5 @@ NotifyCategoryDecl( osxdisplay , EXPCL_PANDAGL, EXPTP_PANDAGL);
extern EXPCL_PANDAGL void init_libosxdisplay(); extern EXPCL_PANDAGL void init_libosxdisplay();
extern ConfigVariableString display_cfg; extern ConfigVariableString display_cfg;
extern ConfigVariableBool osx_error_abort;
#endif /* __CONFIG_OSXDISPLAY_H__ */ #endif /* __CONFIG_OSXDISPLAY_H__ */

View File

@ -38,8 +38,6 @@ osxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
osxGraphicsPipe *osx_pipe; osxGraphicsPipe *osx_pipe;
DCAST_INTO_V(osx_pipe, _pipe); DCAST_INTO_V(osx_pipe, _pipe);
// Since the pbuffer never gets flipped, we get screenshots from the
// same buffer we draw into.
_screenshot_buffer_type = _draw_buffer_type; _screenshot_buffer_type = _draw_buffer_type;
} }
@ -74,13 +72,10 @@ begin_frame(FrameMode mode) {
DCAST_INTO_R(osxgsg, _gsg, false); DCAST_INTO_R(osxgsg, _gsg, false);
// osxMakeCurrent(_display, _pbuffer, osxgsg->_context); // osxMakeCurrent(_display, _pbuffer, osxgsg->_context);
// Now that we have made the context current to a window, we can
// reset the GSG state if this is the first time it has been used.
// (We can't just call reset() when we construct the GSG, because
// reset() requires having a current context.)
osxgsg->reset_if_new(); osxgsg->reset_if_new();
if (mode == FM_render) { if (mode == FM_render)
{
// begin_render_texture(); // begin_render_texture();
clear_cube_map_selection(); clear_cube_map_selection();
} }
@ -99,7 +94,8 @@ end_frame(FrameMode mode) {
end_frame_spam(); end_frame_spam();
nassertv(_gsg != (GraphicsStateGuardian *)NULL); nassertv(_gsg != (GraphicsStateGuardian *)NULL);
if (mode == FM_render) { if (mode == FM_render)
{
// end_render_texture(); // end_render_texture();
copy_to_textures(); copy_to_textures();
} }
@ -138,7 +134,7 @@ release_gsg() {
void osxGraphicsBuffer:: void osxGraphicsBuffer::
close_buffer() { close_buffer() {
// _is_valid = false; _is_valid = false;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -26,14 +26,11 @@
#include "graphicsBuffer.h" #include "graphicsBuffer.h"
#include "glgsg.h" #include "glgsg.h"
// This must be included after we have included glgsg.h (which
// includes gl.h).
//#include "wglext.h"
//#include <windows.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : OSXGraphicsBuffer // Class : OSXGraphicsBuffer
// rhh mar-2006
// Sorry ... this is not functional at all... I have no need for it yet ?
//
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer { class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
public: public:
@ -42,20 +39,16 @@ public:
int x_size, int y_size); int x_size, int y_size);
virtual ~osxGraphicsBuffer(); virtual ~osxGraphicsBuffer();
virtual bool begin_frame(FrameMode mode); virtual bool begin_frame(FrameMode mode);
virtual void end_frame(FrameMode mode); virtual void end_frame(FrameMode mode);
virtual void release_gsg(); virtual void release_gsg();
// virtual void begin_render_texture();
// virtual void end_render_texture();
protected: protected:
virtual void close_buffer(); virtual void close_buffer();
virtual bool open_buffer(); virtual bool open_buffer();
private:
public: public:
static TypeHandle get_class_type() { static TypeHandle get_class_type() {

View File

@ -19,7 +19,6 @@
#include "osxGraphicsBuffer.h" #include "osxGraphicsBuffer.h"
#include "osxGraphicsStateGuardian.h" #include "osxGraphicsStateGuardian.h"
//typedef enum {Software, MCD, ICD} OGLDriverType;
TypeHandle osxGraphicsPipe::_type_handle; TypeHandle osxGraphicsPipe::_type_handle;

View File

@ -64,6 +64,4 @@ private:
friend class osxGraphicsBuffer; friend class osxGraphicsBuffer;
}; };
//#include "osxGraphicsPipe.I"
#endif #endif

View File

@ -60,7 +60,6 @@ osxGraphicsStateGuardian(const FrameBufferProperties &properties,
_aglPixFmt(NULL), _aglPixFmt(NULL),
_aglcontext(NULL) _aglcontext(NULL)
{ {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -102,7 +101,8 @@ void osxGraphicsStateGuardian::reset()
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: osxGraphicsStateGuardian::buildGL // Function: osxGraphicsStateGuardian::buildGL
// Access: Public, Virtual // Access: Public, Virtual
// Description: // Description: This function will build up a context for a gsg..
// rhh.. This does not respect the flags passed into it for context type ?? hmmm things to do things to do..
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
OSStatus osxGraphicsStateGuardian::buildGL (osxGraphicsWindow &window) OSStatus osxGraphicsStateGuardian::buildGL (osxGraphicsWindow &window)

View File

@ -39,19 +39,15 @@ public:
osxGraphicsStateGuardian(const FrameBufferProperties &properties, osxGraphicsStateGuardian(const FrameBufferProperties &properties,
osxGraphicsStateGuardian *share_with, osxGraphicsStateGuardian *share_with,
int pfnum); int pfnum);
virtual ~osxGraphicsStateGuardian(); virtual ~osxGraphicsStateGuardian();
virtual void reset(); virtual void reset();
AGLContext get_context(void) { return _aglcontext; };
OSStatus buildGL (osxGraphicsWindow &window);
protected: protected:
virtual void *get_extension_func(const char *prefix, const char *name); virtual void *get_extension_func(const char *prefix, const char *name);
private: private:
OSStatus buildGL (osxGraphicsWindow &window);
AGLContext get_context(void) { return _aglcontext; };
// We have to save a pointer to the GSG we intend to share texture // We have to save a pointer to the GSG we intend to share texture
// context with, since we don't create our own context in the // context with, since we don't create our own context in the

File diff suppressed because it is too large Load Diff

View File

@ -43,20 +43,19 @@ public:
const string &name); const string &name);
virtual ~osxGraphicsWindow(); virtual ~osxGraphicsWindow();
// virtual bool move_pointer(int device, int x, int y); virtual bool move_pointer(int device, int x, int y);
//virtual bool make_context();
virtual void make_current(); virtual void make_current();
virtual void release_gsg(); virtual void release_gsg();
virtual bool begin_frame(FrameMode mode); virtual bool begin_frame(FrameMode mode);
virtual void end_frame(FrameMode mode); virtual void end_frame(FrameMode mode);
virtual void begin_flip(); virtual void begin_flip();
virtual void process_events(); virtual void process_events();
private:
void ReleaseSystemResources(); void ReleaseSystemResources();
@ -65,11 +64,19 @@ protected:
virtual bool open_window(); virtual bool open_window();
private: private:
//
// a singleton .. for the events to find the right pipe to push the event into
//
static osxGraphicsWindow * FullScreenWindow;
static osxGraphicsWindow * GetCurrentOSxWindow (WindowRef hint);
public: // do not call direct .. public: // do not call direct ..
OSStatus handleKeyInput (EventHandlerCallRef myHandler, EventRef event, Boolean keyDown); OSStatus handleKeyInput (EventHandlerCallRef myHandler, EventRef event, Boolean keyDown);
OSStatus handleTextInput (EventHandlerCallRef myHandler, EventRef event); OSStatus handleTextInput (EventHandlerCallRef myHandler, EventRef event);
OSStatus handleWindowMouseEvents (EventHandlerCallRef myHandler, EventRef event); OSStatus handleWindowMouseEvents (EventHandlerCallRef myHandler, EventRef event);
ButtonHandle OSX_TranslateKey( UInt32 key, EventRef event );
void HandleModifireDeleta(UInt32 modifiers); void HandleModifireDeleta(UInt32 modifiers);
void DoResize(void); void DoResize(void);
@ -92,10 +99,10 @@ public: // do not call direct ..
} }
inline bool IsAlive(void) // inline bool IsAlive(void)
{ // {
return (_is_fullsreen || _osx_window != NULL); // return (_is_fullsreen || _osx_window != NULL);
} // }
WindowProperties & properties() { return _properties; }; WindowProperties & properties() { return _properties; };
private: private: