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
This commit is contained in:
Philippe Houdoin 2009-09-13 10:03:12 +00:00
parent 615e223aae
commit 78a79f339e
3 changed files with 33 additions and 17 deletions

View File

@ -5,8 +5,8 @@
* Author:
* Artur Wyszynski <harakash@gmail.com>
*/
#include "ExtensionsView.h"
#include "ExtensionsList.h"
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
@ -14,7 +14,7 @@
#include <SpaceLayoutItem.h>
#include <String.h>
#include <GL/gl.h>
#include "ExtensionsList.h"
#include <GL/glu.h>
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 !
}
}

View File

@ -9,9 +9,10 @@
#ifndef EXTENSIONS_VIEW_H
#define EXTENSIONS_VIEW_H
#include <View.h>
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);
};

View File

@ -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);