merged r33072 from gallium3d branch (OpenGL preferences)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33074 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -71,7 +71,7 @@ SYSTEM_APPS = AboutSystem ActivityMonitor CharacterMap CodyCam DeskCalc DiskProb
|
||||
ShowImage SoundRecorder StyledEdit Terminal TextSearch TV Workspaces
|
||||
;
|
||||
SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail
|
||||
FileTypes Fonts Keyboard Keymap Media Mouse Network Printers
|
||||
FileTypes Fonts Keyboard Keymap Media Mouse Network OpenGL Printers
|
||||
Screen ScreenSaver Sounds Time Touchpad <preference>Tracker VirtualMemory
|
||||
;
|
||||
SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo
|
||||
|
||||
@@ -17,6 +17,7 @@ SubInclude HAIKU_TOP src preferences mail ;
|
||||
SubInclude HAIKU_TOP src preferences media ;
|
||||
SubInclude HAIKU_TOP src preferences mouse ;
|
||||
SubInclude HAIKU_TOP src preferences network ;
|
||||
SubInclude HAIKU_TOP src preferences opengl ;
|
||||
SubInclude HAIKU_TOP src preferences print ;
|
||||
SubInclude HAIKU_TOP src preferences screen ;
|
||||
SubInclude HAIKU_TOP src preferences screensaver ;
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "CapabilitiesView.h"
|
||||
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
void
|
||||
AddStringView(BView* view, const char* viewName, const char* name,
|
||||
const char* value, bool spacer)
|
||||
{
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
BRect dummyRect(0, 0, 0, 0);
|
||||
const float kSpacer = 5;
|
||||
|
||||
BString tempViewName(viewName);
|
||||
BStringView *nameView = new BStringView(dummyRect, tempViewName.String(),
|
||||
name, B_FOLLOW_NONE);
|
||||
tempViewName.Append("Value");
|
||||
BStringView *valueView = new BStringView(dummyRect, tempViewName.String(),
|
||||
value, B_FOLLOW_NONE);
|
||||
|
||||
if (spacer) {
|
||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(nameView)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(valueView)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
);
|
||||
} else {
|
||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(nameView)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(valueView)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CapabilitiesView::CapabilitiesView()
|
||||
: BView("Capabilities", 0, NULL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
BRect dummyRect(0, 0, 0, 0);
|
||||
|
||||
const float kInset = 10;
|
||||
|
||||
int lights = 0;
|
||||
int clippingPlanes = 0;
|
||||
int modelStack = 0;
|
||||
int projectionStack = 0;
|
||||
int textureStack = 0;
|
||||
int maxTex3d = 0;
|
||||
int maxTex2d = 0;
|
||||
int nameStack = 0;
|
||||
int listStack = 0;
|
||||
int maxPoly = 0;
|
||||
int attribStack = 0;
|
||||
int buffers = 0;
|
||||
int convolutionWidth = 0;
|
||||
int convolutionHeight = 0;
|
||||
int maxIndex = 0;
|
||||
int maxVertex = 0;
|
||||
int textureUnits = 0;
|
||||
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &lights);
|
||||
glGetIntegerv(GL_MAX_CLIP_PLANES, &clippingPlanes);
|
||||
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &modelStack);
|
||||
glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &projectionStack);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_STACK_DEPTH, &textureStack);
|
||||
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxTex3d);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTex2d);
|
||||
glGetIntegerv(GL_MAX_NAME_STACK_DEPTH, &nameStack);
|
||||
glGetIntegerv(GL_MAX_LIST_NESTING, &listStack);
|
||||
glGetIntegerv(GL_MAX_EVAL_ORDER, &maxPoly);
|
||||
glGetIntegerv(GL_MAX_ATTRIB_STACK_DEPTH, &attribStack);
|
||||
glGetIntegerv(GL_AUX_BUFFERS, &buffers);
|
||||
glGetIntegerv(GL_MAX_CONVOLUTION_WIDTH, &convolutionWidth);
|
||||
glGetIntegerv(GL_MAX_CONVOLUTION_HEIGHT, &convolutionHeight);
|
||||
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxIndex);
|
||||
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxVertex);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &textureUnits);
|
||||
|
||||
BString tempString;
|
||||
BView *rootView = new BView("root view", 0, NULL);
|
||||
rootView->SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
tempString << (int32) buffers;
|
||||
AddStringView(rootView, "Buffers", "Auxiliary buffer(s):",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) modelStack;
|
||||
AddStringView(rootView, "ModelStack", "Model stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) projectionStack;
|
||||
AddStringView(rootView, "ProjectionStack", "Projection stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) textureStack;
|
||||
AddStringView(rootView, "TextureStack", "Texture stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) nameStack;
|
||||
AddStringView(rootView, "NameStack", "Name stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) listStack;
|
||||
AddStringView(rootView, "ListStack", "List stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) attribStack;
|
||||
AddStringView(rootView, "AttribStack", "Attributes stack size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxTex3d;
|
||||
AddStringView(rootView, "MaxTex3D", "Maximum 3D texture size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxTex2d;
|
||||
AddStringView(rootView, "MaxTex2D", "Maximum 2D texture size:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) textureUnits;
|
||||
AddStringView(rootView, "MaxTexUnits", "Maximum texture units:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) lights;
|
||||
AddStringView(rootView, "MaxLights", "Maximum lights:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) clippingPlanes;
|
||||
AddStringView(rootView, "MaxClippingPlanes", "Maximum clipping planes:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxPoly;
|
||||
AddStringView(rootView, "MaxPoly", "Maximum evaluators equation order:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) convolutionWidth << "x" << convolutionHeight;
|
||||
AddStringView(rootView, "MaxConvultion", "Maximum convolution:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxIndex;
|
||||
AddStringView(rootView, "MaxIndex", "Maximum recommended index elements:",
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxVertex;
|
||||
AddStringView(rootView, "MaxVertex", "Maximum recommended vertex elements:",
|
||||
tempString.String(), true);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(rootView)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
CapabilitiesView::~CapabilitiesView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef CAPABILITIES_VIEW_H
|
||||
#define CAPABILITIES_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
|
||||
class CapabilitiesView : public BView {
|
||||
public:
|
||||
CapabilitiesView();
|
||||
virtual ~CapabilitiesView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
};
|
||||
|
||||
#endif /* CAPABILITIES_VIEW_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "ExtensionsList.h"
|
||||
|
||||
#include <ColumnTypes.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
ExtensionRow::ExtensionRow(const char* extensionName)
|
||||
: BRow(),
|
||||
fExtensionName(extensionName)
|
||||
{
|
||||
SetField(new BStringField(extensionName), 0);
|
||||
}
|
||||
|
||||
|
||||
ExtensionRow::~ExtensionRow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
ExtensionsList::ExtensionsList()
|
||||
: BColumnListView("ExtensionsList", B_FOLLOW_ALL)
|
||||
{
|
||||
BStringColumn* column = new BStringColumn("Available", 280, 280, 280,
|
||||
B_TRUNCATE_MIDDLE);
|
||||
AddColumn(column, 0);
|
||||
SetSortingEnabled(true);
|
||||
SetSortColumn(column, true, true);
|
||||
}
|
||||
|
||||
|
||||
ExtensionsList::~ExtensionsList()
|
||||
{
|
||||
BRow *row;
|
||||
while ((row = RowAt((int32)0, NULL)) != NULL) {
|
||||
RemoveRow(row);
|
||||
delete row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef EXTENSIONS_LIST_H
|
||||
#define EXTENSIONS_LIST_H
|
||||
|
||||
|
||||
#include <ColumnListView.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class ExtensionRow : public BRow {
|
||||
public:
|
||||
ExtensionRow(const char* extensionName);
|
||||
virtual ~ExtensionRow();
|
||||
|
||||
private:
|
||||
BString fExtensionName;
|
||||
};
|
||||
|
||||
|
||||
class ExtensionsList : public BColumnListView {
|
||||
public:
|
||||
ExtensionsList();
|
||||
virtual ~ExtensionsList();
|
||||
};
|
||||
|
||||
#endif /* EXTENSIONS_LIST_H */
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "ExtensionsView.h"
|
||||
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Message.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <String.h>
|
||||
#include <GL/gl.h>
|
||||
#include "ExtensionsList.h"
|
||||
|
||||
|
||||
ExtensionsView::ExtensionsView()
|
||||
: BView("Extensions", 0, NULL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
const float kInset = 10;
|
||||
|
||||
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 !
|
||||
}
|
||||
}
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(extList)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ExtensionsView::~ExtensionsView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef EXTENSIONS_VIEW_H
|
||||
#define EXTENSIONS_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
|
||||
class ExtensionsView : public BView {
|
||||
public:
|
||||
ExtensionsView();
|
||||
virtual ~ExtensionsView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
};
|
||||
|
||||
|
||||
#endif /* EXTENSIONS_VIEW_H */
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "InfoView.h"
|
||||
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
InfoView::InfoView()
|
||||
: BView("Information", 0, NULL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
BRect dummyRect(0, 0, 0, 0);
|
||||
|
||||
BStringView *version = new BStringView(dummyRect, "Version",
|
||||
"OpenGL Version:", B_FOLLOW_NONE);
|
||||
BStringView *versionValue = new BStringView(dummyRect, "VersionVal",
|
||||
(const char*)glGetString(GL_VERSION), B_FOLLOW_NONE);
|
||||
BStringView *vendor = new BStringView(dummyRect, "Vendor",
|
||||
"Vendor Name:", B_FOLLOW_NONE);
|
||||
BStringView *vendorValue = new BStringView(dummyRect, "VendorVal",
|
||||
(const char*)glGetString(GL_VENDOR), B_FOLLOW_NONE);
|
||||
BStringView *renderer = new BStringView(dummyRect, "Renderer",
|
||||
"Renderer Name:", B_FOLLOW_NONE);
|
||||
BStringView *rendererValue = new BStringView(dummyRect, "RendererVal",
|
||||
(const char*)glGetString(GL_RENDERER), B_FOLLOW_NONE);
|
||||
BStringView *gluVersion = new BStringView(dummyRect, "GLUVersion",
|
||||
"GLU Version:", B_FOLLOW_NONE);
|
||||
BStringView *gluVersionValue = new BStringView(dummyRect, "GLUVersionVal",
|
||||
(const char*)gluGetString(GLU_VERSION), B_FOLLOW_NONE);
|
||||
BStringView *glutVersion = new BStringView(dummyRect, "GLUTVersion",
|
||||
"GLUT API Version:", B_FOLLOW_NONE);
|
||||
BString glutApiVer;
|
||||
glutApiVer << (int32)GLUT_API_VERSION;
|
||||
BStringView *glutVersionValue = new BStringView(dummyRect, "GLUTVersionVal",
|
||||
glutApiVer.String(), B_FOLLOW_NONE);
|
||||
|
||||
const float kInset = 10;
|
||||
const float kSpacer = 5;
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(version)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(versionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(vendor)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(vendorValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(renderer)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(rendererValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(gluVersion)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(gluVersionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(glutVersion)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(glutVersionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
InfoView::~InfoView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef INFO_VIEW_H
|
||||
#define INFO_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
|
||||
class InfoView : public BView {
|
||||
public:
|
||||
InfoView();
|
||||
virtual ~InfoView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
};
|
||||
|
||||
#endif /* INFO_VIEW_H */
|
||||
@@ -0,0 +1,17 @@
|
||||
SubDir HAIKU_TOP src preferences opengl ;
|
||||
|
||||
UsePrivateHeaders interface ;
|
||||
|
||||
Preference OpenGL :
|
||||
OpenGLApp.cpp
|
||||
OpenGLWindow.cpp
|
||||
OpenGLView.cpp
|
||||
CapabilitiesView.cpp
|
||||
ExtensionsList.cpp
|
||||
ExtensionsView.cpp
|
||||
InfoView.cpp
|
||||
LogoView.cpp
|
||||
: be GL translation libcolumnlistview.a $(TARGET_LIBSUPC++)
|
||||
: OpenGL.rdef
|
||||
;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#include "LogoView.h"
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <Message.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <TranslatorFormats.h>
|
||||
|
||||
|
||||
LogoView::LogoView(const BRect& frame)
|
||||
: BView(frame, "LogoView", B_FOLLOW_ALL, B_WILL_DRAW
|
||||
| B_FULL_UPDATE_ON_RESIZE),
|
||||
fLogo(NULL)
|
||||
{
|
||||
SetViewColor(255, 255, 255);
|
||||
fLogo = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "OpenGL_logo.png");
|
||||
if (fLogo) {
|
||||
SetExplicitMinSize(
|
||||
BSize(fLogo->Bounds().Width(), fLogo->Bounds().Height() + 6));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogoView::~LogoView()
|
||||
{
|
||||
delete fLogo;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LogoView::Draw(BRect update)
|
||||
{
|
||||
if (!fLogo)
|
||||
return;
|
||||
|
||||
BRect bounds(Bounds());
|
||||
BPoint placement;
|
||||
placement.x = (bounds.left + bounds.right - fLogo->Bounds().Width()) / 2;
|
||||
placement.y = (bounds.top + bounds.bottom - fLogo->Bounds().Height()) / 2;
|
||||
|
||||
DrawBitmap(fLogo, placement);
|
||||
rgb_color borderColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_3_TINT);
|
||||
SetHighColor(borderColor);
|
||||
StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LogoView::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
float width = 0.0;
|
||||
float height = 0.0;
|
||||
if (fLogo) {
|
||||
width = fLogo->Bounds().Width();
|
||||
height = fLogo->Bounds().Height();
|
||||
}
|
||||
if (_width)
|
||||
*_width = width;
|
||||
if (_height)
|
||||
*_height = height;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef LOGO_VIEW_H
|
||||
#define LOGO_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
|
||||
class LogoView : public BView {
|
||||
public:
|
||||
LogoView(const BRect& frame);
|
||||
virtual ~LogoView();
|
||||
|
||||
virtual void Draw(BRect update);
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
|
||||
private:
|
||||
BBitmap* fLogo;
|
||||
};
|
||||
|
||||
#endif /* LOGO_VIEW_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-OpenGL";
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_DEVELOPMENT,
|
||||
internal = 0,
|
||||
|
||||
short_info = "OpenGL",
|
||||
long_info = "OpenGL ©2009 Haiku"
|
||||
};
|
||||
|
||||
resource(1, "OpenGL_logo.png") #'PNG ' import "OpenGL_logo.png";
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660B0500020016023A3D24339506B715A93DDB134A79084A1A1100D7FF"
|
||||
$"B80594020016023A3D24339506B715A93DDB134A79084A1A1100D2FF8505C402"
|
||||
$"0016023A692E36692FBA2ECD3E2ECC4B89A4496318005CFF83020016023C8000"
|
||||
$"0000000000003C00004AC00049000000F4FFDB03A9FF00020106033C00000000"
|
||||
$"000000003C00004680004680000B9EEDFF2567CEFFFF0473B3020106033C0000"
|
||||
$"0000000000003C000046800046800000B9FF97BE05D65EFF04994304016E0F0A"
|
||||
$"044C60516060505C4E02043334BD6D34B7B434263926BBDC26BE0E333EB7B43E"
|
||||
$"BD6D3E403940BE0E40BBDC0A0651365A395A504C5E425842400A084C444C5EC3"
|
||||
$"AFCB27C3AFC72B4450C15AC9CB425842400A04C1EFC6634450C15AC9CBC1DECA"
|
||||
$"180A04C317C6E8C1EFC663C1DECA18C316CACE0A04C3AFCB27C3AFC72BC317C6"
|
||||
$"E8C316CACE0A0451365A394C4442400A044C445A395A504C5E0A04484648484A"
|
||||
$"C3234AC2570404BE404A3246324A323E4236423C4232373202042E22BB3722B5"
|
||||
$"F022222E22B5F022BB372E3AB5F03ABB373A3A2E3ABB373AB5F00608BFDBB506"
|
||||
$"B560B506B560B443B638222E22B75722BAB3B717BD1FB52DBC80B717BD1F2836"
|
||||
$"28322A34263024302E2828282A2826060CA2EBAF2E28B98632263428302E302C"
|
||||
$"303036323436BBB3BC32BBB3BC32BCB6BB513A2E3ABA053AB668B9EDB3FDBBE9"
|
||||
$"B493B9EDB3FD2E2430260614BFDDAFABE82E22B90C22B72A22B506B560B5E6B4"
|
||||
$"68B506B56028282826282A242E30283226302A3436B717BD1FB717BD1FB78EBD"
|
||||
$"452E3AB80E3AB9C53ABBB3BC32BADCBCEBBBB3BC3234363632302E3030302C34"
|
||||
$"283226B953282E30262E24B9EDB3FDB9EDB3FDB980B3DD0D0A0A020001000A0A"
|
||||
$"010A124000000000000000003FB6DB42000043249201178400040A00030A020B"
|
||||
$"1001178400040A010103000A020104000A030105000A040106000A060107000A"
|
||||
$"050108000A0301091001178100040A070109000A08010E000A09020C0D00"
|
||||
};
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#include "OpenGLApp.h"
|
||||
#include "OpenGLWindow.h"
|
||||
|
||||
|
||||
OpenGLApp::OpenGLApp()
|
||||
: BApplication("application/x-vnd.Haiku-OpenGL")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
OpenGLApp::~OpenGLApp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLApp::ReadyToRun()
|
||||
{
|
||||
fWindow = new OpenGLWindow();
|
||||
fWindow->Show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
OpenGLApp app;
|
||||
app.Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef OPENGL_APP_H
|
||||
#define OPENGL_APP_H
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include "OpenGLWindow.h"
|
||||
|
||||
|
||||
class OpenGLApp : public BApplication {
|
||||
public:
|
||||
OpenGLApp();
|
||||
virtual ~OpenGLApp();
|
||||
|
||||
virtual void ReadyToRun();
|
||||
|
||||
private:
|
||||
OpenGLWindow* fWindow;
|
||||
};
|
||||
|
||||
#endif /* OPENGL_APP_H_ */
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#include "OpenGLView.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <TabView.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include "CapabilitiesView.h"
|
||||
#include "ExtensionsView.h"
|
||||
#include "InfoView.h"
|
||||
#include "LogoView.h"
|
||||
|
||||
|
||||
OpenGLView::OpenGLView()
|
||||
: BView("OpenGLView", 0, NULL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
const float kInset = 10;
|
||||
BRect dummy(0, 0, 2, 2);
|
||||
|
||||
fGLView = new BGLView(dummy, "gl info", B_FOLLOW_NONE, 0,
|
||||
BGL_RGB | BGL_DOUBLE);
|
||||
fGLView->Hide();
|
||||
AddChild(fGLView);
|
||||
|
||||
fGLView->LockGL();
|
||||
|
||||
LogoView *logoView = new LogoView(dummy);
|
||||
|
||||
BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);
|
||||
|
||||
InfoView *infoView = new InfoView();
|
||||
tabView->AddTab(infoView);
|
||||
|
||||
CapabilitiesView *capabilitiesView = new CapabilitiesView();
|
||||
tabView->AddTab(capabilitiesView);
|
||||
|
||||
ExtensionsView *extensionsView = new ExtensionsView();
|
||||
tabView->AddTab(extensionsView);
|
||||
|
||||
fGLView->UnlockGL();
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(logoView)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(tabView)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
OpenGLView::~OpenGLView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef OPENGL_VIEW_H
|
||||
#define OPENGL_VIEW_H
|
||||
|
||||
|
||||
#include <GLView.h>
|
||||
#include <View.h>
|
||||
|
||||
class OpenGLView : public BView {
|
||||
public:
|
||||
OpenGLView();
|
||||
virtual ~OpenGLView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
private:
|
||||
BGLView* fGLView;
|
||||
};
|
||||
|
||||
#endif /* OPENGL_VIEW_H */
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#include "OpenGLWindow.h"
|
||||
|
||||
#include <GroupLayout.h>
|
||||
#include "OpenGLView.h"
|
||||
|
||||
|
||||
OpenGLWindow::OpenGLWindow()
|
||||
: BWindow(BRect(50, 50, 450, 400), "OpenGL", B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
fView = new OpenGLView();
|
||||
GetLayout()->AddView(fView);
|
||||
CenterOnScreen();
|
||||
}
|
||||
|
||||
|
||||
OpenGLWindow::~OpenGLWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
OpenGLWindow::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Artur Wyszynski <harakash@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef OPENGL_WINDOW_H
|
||||
#define OPENGL_WINDOW_H
|
||||
|
||||
|
||||
#include <Window.h>
|
||||
#include "OpenGLView.h"
|
||||
|
||||
|
||||
class OpenGLWindow : public BWindow {
|
||||
public:
|
||||
OpenGLWindow();
|
||||
virtual ~OpenGLWindow();
|
||||
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
OpenGLView* fView;
|
||||
};
|
||||
|
||||
#endif /* OPENGL_WINDOW_H */
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Reference in New Issue
Block a user