Browse Source

Merge branch 'release/1.9.x'

rdb 10 years ago
parent
commit
194a43fa2a

+ 58 - 1
panda/src/display/displayInformation.cxx

@@ -15,10 +15,52 @@
 #include "graphicsStateGuardian.h"
 #include "displayInformation.h"
 
+////////////////////////////////////////////////////////////////////
+//     Function: DisplayMode::Comparison Operator
+//       Access: Published
+//  Description: Returns true if these two DisplayModes are identical.
+////////////////////////////////////////////////////////////////////
+bool DisplayMode::
+operator == (const DisplayMode &other) const {
+  return (width == other.width && height == other.height &&
+          bits_per_pixel == other.bits_per_pixel &&
+          refresh_rate == other.refresh_rate &&
+          fullscreen_only == other.fullscreen_only);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DisplayMode::Comparison Operator
+//       Access: Published
+//  Description: Returns false if these two DisplayModes are identical.
+////////////////////////////////////////////////////////////////////
+bool DisplayMode::
+operator != (const DisplayMode &other) const {
+  return !operator == (other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DisplayMode::output
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+void DisplayMode::
+output(ostream &out) const {
+  out << width << 'x' << height;
+  if (bits_per_pixel > 0) {
+    out << ' ' << bits_per_pixel << "bpp";
+  }
+  if (refresh_rate > 0) {
+    out << ' ' << refresh_rate << "Hz";
+  }
+  if (fullscreen_only > 0) {
+    out << " (fullscreen only)";
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DisplayInformation::Destructor
 //       Access: Published
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DisplayInformation::
 ~DisplayInformation() {
@@ -181,6 +223,21 @@ get_total_display_modes() {
   return _total_display_modes;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: DisplayInformation::get_display_mode
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+const DisplayMode &DisplayInformation::
+get_display_mode(int display_index) {
+#ifndef NDEBUG
+  static DisplayMode err_mode = {0};
+  nassertr(display_index >= 0 && display_index < _total_display_modes, err_mode);
+#endif
+
+  return _display_mode_array[display_index];
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DisplayInformation::get_display_mode_width
 //       Access: Published

+ 14 - 9
panda/src/display/displayInformation.h

@@ -17,29 +17,30 @@
 
 #include "typedef.h"
 
-typedef struct {
+struct EXPCL_PANDA_DISPLAY DisplayMode {
+PUBLISHED:
   int width;
   int height;
   int bits_per_pixel;
   int refresh_rate;
   int fullscreen_only;
-}
-DisplayMode;
+
+  bool operator == (const DisplayMode &other) const;
+  bool operator != (const DisplayMode &other) const;
+  void output(ostream &out) const;
+};
 
 ////////////////////////////////////////////////////////////////////
 //       Class : DisplayInformation
 // Description : This class contains various display information.
 ////////////////////////////////////////////////////////////////////
-
 class EXPCL_PANDA_DISPLAY DisplayInformation {
-
 PUBLISHED:
-
   enum DetectionState {
-    DS_unknown,  
-    DS_success,  
+    DS_unknown,
+    DS_success,
 
-    DS_direct_3d_create_error,  
+    DS_direct_3d_create_error,
     DS_create_window_error,
     DS_create_device_error,
   };
@@ -54,6 +55,10 @@ PUBLISHED:
   int get_window_bits_per_pixel();
 
   int get_total_display_modes();
+  const DisplayMode &get_display_mode(int display_index);
+  MAKE_SEQ(get_display_modes, get_total_display_modes, get_display_mode);
+
+  // Older interface for display modes.
   int get_display_mode_width(int display_index);
   int get_display_mode_height(int display_index);
   int get_display_mode_bits_per_pixel(int display_index);

+ 5 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -4759,8 +4759,8 @@ prepare_shader(Shader *se) {
       return NULL;
     }
 
-#if defined(HAVE_CG) && !defined(OPENGLES)
   case Shader::SL_Cg:
+#if defined(HAVE_CG) && !defined(OPENGLES)
     if (_supports_basic_shaders) {
       result = new CLP(CgShaderContext)(this, se);
       break;
@@ -4769,6 +4769,10 @@ prepare_shader(Shader *se) {
         << "Tried to load Cg shader, but basic shaders not supported.\n";
       return NULL;
     }
+#elif defined(OPENGLES)
+    GLCAT.error()
+      << "Tried to load Cg shader, but Cg support is not available for OpenGL ES.\n";
+    return NULL;
 #else
     GLCAT.error()
       << "Tried to load Cg shader, but Cg support not compiled in.\n";

File diff suppressed because it is too large
+ 286 - 391
panda/src/windisplay/winGraphicsPipe.cxx


Some files were not shown because too many files changed in this diff