From 78a79f339ecf50b0fba41f18c87e1879212e8fce Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 13 Sep 2009 10:03:12 +0000 Subject: [PATCH] Add GLU extentions too. Fix a gcc4 warning in BGLView construction. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33112 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/opengl/ExtensionsView.cpp | 41 ++++++++++++++--------- src/preferences/opengl/ExtensionsView.h | 7 +++- src/preferences/opengl/OpenGLView.cpp | 2 +- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/preferences/opengl/ExtensionsView.cpp b/src/preferences/opengl/ExtensionsView.cpp index 4e4c29fdf8..d72a673c2f 100644 --- a/src/preferences/opengl/ExtensionsView.cpp +++ b/src/preferences/opengl/ExtensionsView.cpp @@ -5,8 +5,8 @@ * Author: * Artur Wyszynski */ - #include "ExtensionsView.h" +#include "ExtensionsList.h" #include #include @@ -14,7 +14,7 @@ #include #include #include -#include "ExtensionsList.h" +#include ExtensionsView::ExtensionsView() @@ -27,19 +27,8 @@ ExtensionsView::ExtensionsView() ExtensionsList *extList = new ExtensionsList(); - char *list = (char*)glGetString(GL_EXTENSIONS); - if (list) { - while (*list) { - char extName[255]; - int n = strcspn(list, " "); - strncpy(extName, list, n); - extName[n] = 0; - extList->AddRow(new ExtensionRow(extName)); - if (!list[n]) - break; - list += (n + 1); // next ! - } - } + _AddExtensionsList(extList, (char*) glGetString(GL_EXTENSIONS)); + _AddExtensionsList(extList, (char*) gluGetString(GLU_EXTENSIONS)); AddChild(BGroupLayoutBuilder(B_VERTICAL) .Add(extList) @@ -76,3 +65,25 @@ ExtensionsView::DetachedFromWindow() { } + +// #pragma mark + +void +ExtensionsView::_AddExtensionsList(ExtensionsList *extList, char* stringList) +{ + if (!stringList) + // empty extentions string + return; + + while (*stringList) { + char extName[255]; + int n = strcspn(stringList, " "); + strncpy(extName, stringList, n); + extName[n] = 0; + extList->AddRow(new ExtensionRow(extName)); + if (!stringList[n]) + break; + stringList += (n + 1); // next ! + } +} + diff --git a/src/preferences/opengl/ExtensionsView.h b/src/preferences/opengl/ExtensionsView.h index 50ca1da3e9..67e9642e59 100644 --- a/src/preferences/opengl/ExtensionsView.h +++ b/src/preferences/opengl/ExtensionsView.h @@ -9,9 +9,10 @@ #ifndef EXTENSIONS_VIEW_H #define EXTENSIONS_VIEW_H - #include +class ExtensionsList; + class ExtensionsView : public BView { public: ExtensionsView(); @@ -20,6 +21,10 @@ public: virtual void MessageReceived(BMessage* message); virtual void AttachedToWindow(); virtual void DetachedFromWindow(); + +private: + void _AddExtensionsList(ExtensionsList *extList, char* stringList); + }; diff --git a/src/preferences/opengl/OpenGLView.cpp b/src/preferences/opengl/OpenGLView.cpp index 88526d50dc..18822cc329 100644 --- a/src/preferences/opengl/OpenGLView.cpp +++ b/src/preferences/opengl/OpenGLView.cpp @@ -29,7 +29,7 @@ OpenGLView::OpenGLView() const float kInset = 10; BRect dummy(0, 0, 2, 2); - fGLView = new BGLView(dummy, "gl info", B_FOLLOW_NONE, 0, + fGLView = new BGLView(dummy, (char*) "gl info", B_FOLLOW_NONE, 0, BGL_RGB | BGL_DOUBLE); fGLView->Hide(); AddChild(fGLView);