mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 20:50:43 +00:00
Frame Buffer Object testing
This commit is contained in:
parent
48796f14ba
commit
5407fda324
@ -8300,7 +8300,7 @@
|
||||
<map>
|
||||
"tinyxml/tinyxml.h"
|
||||
|
||||
1308302313 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
|
||||
1308311237 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
|
||||
"gl_pbuffer.h"
|
||||
<wx/glcanvas.h>
|
||||
<wx/geometry.h>
|
||||
@ -8309,7 +8309,7 @@
|
||||
|
||||
1308026543 D
|
||||
|
||||
1308306194 /home/mark/projects/git/sleepyhead/src/version.h
|
||||
1308326231 /home/mark/projects/git/sleepyhead/src/version.h
|
||||
|
||||
1308003040 ent of cb2ab33... Linux wx2.8 & wx2.9 builds fixed
|
||||
<wx/dcbuffer.h>
|
||||
@ -8341,7 +8341,7 @@
|
||||
"preferences.h"
|
||||
"tinyxml/tinyxml.h"
|
||||
|
||||
1308271319 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
|
||||
1308313128 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
|
||||
"wx_pch.h"
|
||||
"version.h"
|
||||
<wx/app.h>
|
||||
@ -8362,7 +8362,7 @@
|
||||
"sleeplib/profiles.h"
|
||||
"sleeplib/machine_loader.h"
|
||||
|
||||
1308304488 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
||||
1308313179 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
||||
"freetype-gl/font-manager.h"
|
||||
"freetype-gl/texture-font.h"
|
||||
"graph.h"
|
||||
@ -11062,7 +11062,7 @@
|
||||
<string.h>
|
||||
"freetype-gl/vector.h"
|
||||
|
||||
1308306186 /home/mark/projects/git/sleepyhead/src/graphs/gl_pbuffer.h
|
||||
1308311222 /home/mark/projects/git/sleepyhead/src/graphs/gl_pbuffer.h
|
||||
<wx/log.h>
|
||||
<GL/glew.h>
|
||||
<GL/wglew.h>
|
||||
@ -11072,10 +11072,13 @@
|
||||
<Cocoa/Cocoa.h>
|
||||
<GL/gl.h>
|
||||
<GL/glx.h>
|
||||
<wx/bitmap.h>
|
||||
|
||||
1308304655 source:/home/mark/projects/git/sleepyhead/src/graphs/gl_pbuffer.cpp
|
||||
1308314362 source:/home/mark/projects/git/sleepyhead/src/graphs/gl_pbuffer.cpp
|
||||
"gl_pbuffer.h"
|
||||
<GL/glu.h>
|
||||
<wx/utils.h>
|
||||
<wx/glcanvas.h>
|
||||
|
||||
1305166122 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.8/wx/treectrl.h
|
||||
"wx/defs.h"
|
||||
|
@ -16,13 +16,13 @@
|
||||
<File name="../../src/SleepyHeadMain.h" open="1" top="0" tabpos="2">
|
||||
<Cursor position="2035" topLine="47" />
|
||||
</File>
|
||||
<File name="../../src/graphs/gl_pbuffer.cpp" open="1" top="1" tabpos="5">
|
||||
<Cursor position="7612" topLine="222" />
|
||||
<File name="../../src/graphs/gl_pbuffer.cpp" open="1" top="0" tabpos="5">
|
||||
<Cursor position="3" topLine="0" />
|
||||
</File>
|
||||
<File name="../../src/graphs/gl_pbuffer.h" open="1" top="0" tabpos="6">
|
||||
<Cursor position="644" topLine="58" />
|
||||
<Cursor position="401" topLine="0" />
|
||||
</File>
|
||||
<File name="../../src/graphs/graph.cpp" open="1" top="0" tabpos="3">
|
||||
<File name="../../src/graphs/graph.cpp" open="1" top="1" tabpos="3">
|
||||
<Cursor position="2743" topLine="83" />
|
||||
</File>
|
||||
<File name="../../src/graphs/graph.h" open="1" top="0" tabpos="4">
|
||||
@ -58,7 +58,7 @@
|
||||
<File name="../../src/libs/freetype-gl/vector.h" open="0" top="0" tabpos="20">
|
||||
<Cursor position="0" topLine="0" />
|
||||
</File>
|
||||
<File name="../../src/libs/freetype-gl/vertex-buffer.cpp" open="1" top="0" tabpos="7">
|
||||
<File name="../../src/libs/freetype-gl/vertex-buffer.cpp" open="0" top="0" tabpos="7">
|
||||
<Cursor position="3098" topLine="91" />
|
||||
</File>
|
||||
<File name="../../src/libs/freetype-gl/vertex-buffer.h" open="0" top="0" tabpos="18">
|
||||
|
@ -1,19 +1,19 @@
|
||||
/***************************************************************
|
||||
* Name: SleepyHeadMain.cpp
|
||||
* Purpose: Code for Application Frame
|
||||
* Author: Mark Watkins (jedimark64@users.sourceforge.net)
|
||||
* Created: 2011-05-20
|
||||
* Copyright: Mark Watkins (http://sourceforge.net/projects/sleepyhead/)
|
||||
* License: GPL
|
||||
**************************************************************/
|
||||
|
||||
#ifdef WX_PRECOMP
|
||||
#include "wx_pch.h"
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
/***************************************************************
|
||||
* Name: SleepyHeadMain.cpp
|
||||
* Purpose: Code for Application Frame
|
||||
* Author: Mark Watkins (jedimark64@users.sourceforge.net)
|
||||
* Created: 2011-05-20
|
||||
* Copyright: Mark Watkins (http://sourceforge.net/projects/sleepyhead/)
|
||||
* License: GPL
|
||||
**************************************************************/
|
||||
|
||||
#ifdef WX_PRECOMP
|
||||
#include "wx_pch.h"
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#include "version.h"
|
||||
#include <wx/app.h>
|
||||
@ -26,7 +26,7 @@
|
||||
#include <wx/log.h>
|
||||
#include <wx/dcscreen.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/fs_mem.h>
|
||||
#include <wx/aui/aui.h>
|
||||
#include <wx/event.h>
|
||||
@ -44,38 +44,38 @@
|
||||
|
||||
|
||||
wxProgressDialog *loader_progress;
|
||||
//helper functions
|
||||
enum wxbuildinfoformat {
|
||||
//helper functions
|
||||
enum wxbuildinfoformat {
|
||||
short_f, long_f };
|
||||
|
||||
wxString wxbuildinfo(wxbuildinfoformat format)
|
||||
{
|
||||
wxString wxbuild(wxVERSION_STRING);
|
||||
|
||||
if (format == long_f )
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
wxbuild << _T("-Windows");
|
||||
#elif defined(__WXMAC__)
|
||||
wxbuild << _T("-Mac");
|
||||
#elif defined(__UNIX__)
|
||||
wxbuild << _T("-Linux");
|
||||
#endif
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxbuild << _T("-Unicode build");
|
||||
#else
|
||||
wxbuild << _T("-ANSI build");
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
return wxbuild;
|
||||
}
|
||||
wxString wxbuildinfo(wxbuildinfoformat format)
|
||||
{
|
||||
wxString wxbuild(wxVERSION_STRING);
|
||||
|
||||
if (format == long_f )
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
wxbuild << _T("-Windows");
|
||||
#elif defined(__WXMAC__)
|
||||
wxbuild << _T("-Mac");
|
||||
#elif defined(__UNIX__)
|
||||
wxbuild << _T("-Linux");
|
||||
#endif
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxbuild << _T("-Unicode build");
|
||||
#else
|
||||
wxbuild << _T("-ANSI build");
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
return wxbuild;
|
||||
}
|
||||
|
||||
const long profile_version=0;
|
||||
|
||||
SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
|
||||
: GUIFrame(frame)
|
||||
|
||||
SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
|
||||
: GUIFrame(frame)
|
||||
{
|
||||
//GraphInit(); // Don't do this here: The first gGraphWindow must do it.
|
||||
|
||||
@ -120,14 +120,14 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
|
||||
OnViewMenuDaily(dummy); // Daily Page
|
||||
|
||||
this->Connect(wxID_ANY, wxEVT_DO_SCREENSHOT, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
//statusBar->SetStatusText(_("Hello!"), 0);
|
||||
statusBar->SetStatusText(wxbuildinfo(long_f), 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
SleepyHeadFrame::~SleepyHeadFrame()
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
//statusBar->SetStatusText(_("Hello!"), 0);
|
||||
statusBar->SetStatusText(wxbuildinfo(long_f), 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
SleepyHeadFrame::~SleepyHeadFrame()
|
||||
{
|
||||
GraphDone();
|
||||
}
|
||||
@ -164,9 +164,9 @@ void SleepyHeadFrame::UpdateProfiles()
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnClose(wxCloseEvent &event)
|
||||
{
|
||||
|
||||
void SleepyHeadFrame::OnClose(wxCloseEvent &event)
|
||||
{
|
||||
int idx=main_auinotebook->GetPageIndex(daily);
|
||||
if (idx!=wxNOT_FOUND) {
|
||||
daily->Close();
|
||||
@ -187,12 +187,12 @@ void SleepyHeadFrame::OnClose(wxCloseEvent &event)
|
||||
}
|
||||
|
||||
this->Disconnect(wxID_ANY, wxEVT_DO_SCREENSHOT, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnQuit(wxCommandEvent &event)
|
||||
{
|
||||
Destroy();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnQuit(wxCommandEvent &event)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
void SleepyHeadFrame::OnFullscreen(wxCommandEvent& event)
|
||||
{
|
||||
@ -248,7 +248,7 @@ void SleepyHeadFrame::DoScreenshot( wxCommandEvent &event )
|
||||
r.height += j.height;
|
||||
#endif
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
#if defined(__WXMAC__)
|
||||
wxMessageBox(wxT("Sorry.. Screenshots don't work on your platform.\n\nPlease use your Mac's screenshot capability instead."),wxT("Naughty Apple!"),wxICON_EXCLAMATION,this);
|
||||
#else
|
||||
wxScreenDC sdc;
|
||||
@ -294,8 +294,8 @@ void SleepyHeadFrame::OnAntiAliasing( wxCommandEvent& event )
|
||||
Refresh();
|
||||
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnAbout(wxCommandEvent &event)
|
||||
|
||||
void SleepyHeadFrame::OnAbout(wxCommandEvent &event)
|
||||
{
|
||||
// wxAboutBox is fairly useless.
|
||||
wxString day=wxString(AutoVersion::_DATE,wxConvUTF8);
|
||||
@ -602,7 +602,7 @@ void Summary::OnEndDateChanged( wxDateEvent& event )
|
||||
|
||||
RefreshData();
|
||||
}
|
||||
void Summary::OnClose(wxCloseEvent &event)
|
||||
void Summary::OnClose(wxCloseEvent &event)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@ -825,7 +825,6 @@ Daily::Daily(wxWindow *win,Profile *p)
|
||||
gwSizer->Add(SPO2,1,wxEXPAND);
|
||||
|
||||
|
||||
gwSizer->Layout();
|
||||
//fgSizer->Add(G_AHI,1,wxEXPAND);
|
||||
//fgSizer->Add(TAP,1,wxEXPAND);
|
||||
//fgSizer->Add(TAP_IAP,1,wxEXPAND);
|
||||
@ -839,7 +838,10 @@ Daily::Daily(wxWindow *win,Profile *p)
|
||||
//EVT_SCROLLWIN_THUMBTRACK(Daily::OnWinScroll)
|
||||
//this->Connect(GraphWindow->GetId(),wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(Daily::OnWinScroll));
|
||||
|
||||
Refresh(); // Important. Don't change the order of the next two lines.
|
||||
Refresh(true); // Important. Don't change the order of the next two lines.
|
||||
Update();
|
||||
// gwSizer->Layout();
|
||||
|
||||
ResetDate();
|
||||
}
|
||||
|
||||
@ -874,7 +876,7 @@ void Daily::OnWinScroll(wxScrollWinEvent &event)
|
||||
wxLogMessage(wxT("OnWinScroll"));
|
||||
Update();
|
||||
}
|
||||
void Daily::OnClose(wxCloseEvent &event)
|
||||
void Daily::OnClose(wxCloseEvent &event)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@ -1270,7 +1272,7 @@ void Daily::OnSelectSession( wxCommandEvent& event )
|
||||
}
|
||||
}
|
||||
|
||||
///usr/local/bin/upx ./bin/Windows/SleepyHead
|
||||
///usr/local/bin/upx ./bin/Windows/SleepyHead
|
||||
|
||||
void Daily::OnCalendarDay( wxCalendarEvent& event )
|
||||
{
|
||||
|
@ -5,8 +5,20 @@ Author: Mark Watkins <jedimark64@users.sourceforge.net>
|
||||
License: GPL
|
||||
*/
|
||||
#include "gl_pbuffer.h"
|
||||
|
||||
#include <GL/glu.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
long roundup2(long v)
|
||||
{
|
||||
int j;
|
||||
for (int i=4;i<32;i++) { // min size 16x16.. probably a usless size.
|
||||
j=1 << i;
|
||||
if (j >= v) break;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
pBuffer::pBuffer()
|
||||
{
|
||||
@ -18,23 +30,129 @@ pBuffer::pBuffer(int width, int height)
|
||||
pBuffer::~pBuffer()
|
||||
{
|
||||
}
|
||||
wxBitmap *pBuffer::Snapshot(int width, int height)
|
||||
{
|
||||
glDrawBuffer(GL_BACK_LEFT);
|
||||
|
||||
void* pixels = malloc(3 * width * height); // must use malloc
|
||||
glReadBuffer(GL_BACK_LEFT);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Put the image into a wxImage
|
||||
wxImage image(width, height, true);
|
||||
image.SetData((unsigned char*) pixels);
|
||||
image = image.Mirror(false);
|
||||
wxBitmap *bmp=new wxBitmap(image);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
|
||||
FBO::FBO(int width, int height)
|
||||
:pBuffer()
|
||||
{
|
||||
//wxGLContext a((wxGLCanvas *)NULL,(wxGLContext *)NULL);
|
||||
int m=MAX(width,height);
|
||||
//int j=roundup2(m) << 2;
|
||||
m_width=width; //roundup2(width) << 2;
|
||||
m_height=height; //roundup2(height) << 2;
|
||||
|
||||
glGenFramebuffersEXT(1, &fbo);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
|
||||
// create texture to render to.
|
||||
glGenTextures(1, &img);
|
||||
glBindTexture(GL_TEXTURE_2D, img);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);
|
||||
|
||||
|
||||
m_depth_buffer=true;
|
||||
m_color_buffer=true; //false;
|
||||
|
||||
if (m_depth_buffer) {
|
||||
glGenRenderbuffersEXT(1, &depthbuffer);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthbuffer);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_width, m_height);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer);
|
||||
}
|
||||
|
||||
if (m_color_buffer) {
|
||||
glGenRenderbuffersEXT(1, &colorbuffer);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorbuffer);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, m_width, m_height);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, colorbuffer);
|
||||
}
|
||||
|
||||
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
//if (status!=GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
GLenum err = glGetError();
|
||||
if (err!=GL_NO_ERROR) {
|
||||
wxString a((char *)gluErrorString(status),wxConvUTF8);
|
||||
throw GLException(wxT("glCheckFramebufferStatusEXT failed")+a);
|
||||
}
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
FBO::~FBO()
|
||||
{
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glDeleteFramebuffersEXT(1, &fbo);
|
||||
if (m_depth_buffer)
|
||||
glDeleteRenderbuffersEXT(1, &depthbuffer);
|
||||
if (m_color_buffer)
|
||||
glDeleteRenderbuffersEXT(1, &colorbuffer);
|
||||
}
|
||||
void FBO::UseBuffer(bool b)
|
||||
{
|
||||
if (b) {
|
||||
// glBindTexture(GL_TEXTURE_2D, img);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
} else {
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
}
|
||||
wxBitmap *FBO::Snapshot(int width,int height)
|
||||
{
|
||||
//width=m_width;
|
||||
//height=m_height;
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
|
||||
void* pixels = malloc(3 * width * height); // must use malloc
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
|
||||
// Put the image into a wxImage
|
||||
wxImage image(width, height, true);
|
||||
image.SetData((unsigned char*) pixels);
|
||||
image = image.Mirror(false);
|
||||
wxBitmap *bmp=new wxBitmap(image);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
|
||||
#if !defined(wglGetExtensionsStringARB)
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
|
||||
|
||||
// WGL_ARB_pbuffer
|
||||
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB = NULL;
|
||||
PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB = NULL;
|
||||
PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB = NULL;
|
||||
PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB = NULL;
|
||||
PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB = NULL;
|
||||
|
||||
// WGL_ARB_pixel_format
|
||||
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB = NULL;
|
||||
PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB = NULL;
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
|
||||
|
||||
// WGL_ARB_pbuffer
|
||||
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB = NULL;
|
||||
PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB = NULL;
|
||||
PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB = NULL;
|
||||
PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB = NULL;
|
||||
PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB = NULL;
|
||||
|
||||
// WGL_ARB_pixel_format
|
||||
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB = NULL;
|
||||
PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB = NULL;
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = NULL;
|
||||
#endif
|
||||
|
||||
@ -182,50 +300,50 @@ bool pBufferWGL::InitGLStuff()
|
||||
{
|
||||
|
||||
// Technically don't need this wrangling with glewInit being actually called now....
|
||||
//wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
char *ext = NULL;
|
||||
|
||||
if (wglGetExtensionsStringARB)
|
||||
ext = (char*)wglGetExtensionsStringARB( wglGetCurrentDC() );
|
||||
//wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
char *ext = NULL;
|
||||
|
||||
if (wglGetExtensionsStringARB)
|
||||
ext = (char*)wglGetExtensionsStringARB( wglGetCurrentDC() );
|
||||
else {
|
||||
wxLogError(wxT("Unable to get address for wglGetExtensionsStringARB!"));
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strstr(ext, "WGL_ARB_pbuffer" ) == NULL) {
|
||||
if (strstr(ext, "WGL_ARB_pbuffer" ) == NULL) {
|
||||
wxLogError(wxT("WGL_ARB_pbuffer extension was not found"));
|
||||
return false;
|
||||
} else {
|
||||
//wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)wglGetProcAddress("wglCreatePbufferARB");
|
||||
//wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)wglGetProcAddress("wglGetPbufferDCARB");
|
||||
//wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)wglGetProcAddress("wglReleasePbufferDCARB");
|
||||
//wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)wglGetProcAddress("wglDestroyPbufferARB");
|
||||
//wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)wglGetProcAddress("wglQueryPbufferARB");
|
||||
|
||||
if (!wglCreatePbufferARB || !wglGetPbufferDCARB || !wglReleasePbufferDCARB ||
|
||||
return false;
|
||||
} else {
|
||||
//wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)wglGetProcAddress("wglCreatePbufferARB");
|
||||
//wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)wglGetProcAddress("wglGetPbufferDCARB");
|
||||
//wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)wglGetProcAddress("wglReleasePbufferDCARB");
|
||||
//wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)wglGetProcAddress("wglDestroyPbufferARB");
|
||||
//wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)wglGetProcAddress("wglQueryPbufferARB");
|
||||
|
||||
if (!wglCreatePbufferARB || !wglGetPbufferDCARB || !wglReleasePbufferDCARB ||
|
||||
!wglDestroyPbufferARB || !wglQueryPbufferARB) {
|
||||
wxLogError(wxT("One or more WGL_ARB_pbuffer functions were not found"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// WGL_ARB_pixel_format
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// WGL_ARB_pixel_format
|
||||
if (strstr( ext, "WGL_ARB_pixel_format" ) == NULL) {
|
||||
wxLogError(wxT("WGL_ARB_pixel_format extension was not found"));
|
||||
return false;
|
||||
} else {
|
||||
wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB");
|
||||
wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribfvARB");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
|
||||
if (!wglGetExtensionsStringARB || !wglCreatePbufferARB || !wglGetPbufferDCARB) {
|
||||
wxLogError(wxT("WGL_ARB_pixel_format extension was not found"));
|
||||
return false;
|
||||
} else {
|
||||
wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB");
|
||||
wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribfvARB");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
|
||||
if (!wglGetExtensionsStringARB || !wglCreatePbufferARB || !wglGetPbufferDCARB) {
|
||||
wxLogError(wxT("One or more WGL_ARB_pixel_format functions were not found"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,12 @@ License: GPL
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#define MIN(a,b) (a<b) ? a : b;
|
||||
#define MAX(a,b) (a<b) ? b : a;
|
||||
#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
||||
#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
|
||||
long roundup2(long v);
|
||||
|
||||
class GLException {
|
||||
public:
|
||||
@ -56,12 +59,30 @@ public:
|
||||
pBuffer(int width, int height);
|
||||
virtual ~pBuffer();
|
||||
virtual void UseBuffer(bool b) {};
|
||||
|
||||
int Width() { return m_width; };
|
||||
int Height() { return m_height; };
|
||||
virtual wxBitmap *Snapshot(int width, int height);
|
||||
protected:
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
|
||||
class FBO:public pBuffer
|
||||
{
|
||||
public:
|
||||
FBO(int width, int height);
|
||||
virtual ~FBO();
|
||||
virtual void UseBuffer(bool b);
|
||||
virtual wxBitmap *Snapshot(int width, int height);
|
||||
protected:
|
||||
GLuint depthbuffer,colorbuffer;
|
||||
GLuint img;
|
||||
GLuint fbo;
|
||||
bool m_depth_buffer;
|
||||
bool m_color_buffer;
|
||||
|
||||
};
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
class pBufferWGL:public pBuffer
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ License: GPL
|
||||
|
||||
#include "sleeplib/profiles.h"
|
||||
|
||||
#include "graphs/freesans.h"
|
||||
#include "graphs/freesans.h" // Remember to compress this..
|
||||
|
||||
//#include <wx/dcbuffer.h>
|
||||
|
||||
@ -1002,108 +1002,48 @@ pBuffer *pbuffer=NULL;
|
||||
|
||||
wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
|
||||
{
|
||||
// I can't get FBO buffers to work properly
|
||||
// Fonts screw up and the first read is corrupted.
|
||||
// pBuffers are faster anyway..
|
||||
|
||||
// shared_context->SetCurrent(*this);
|
||||
/*GLuint fbo;
|
||||
glGenFramebuffersEXT(1, &fbo);
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
|
||||
GLuint depthbuffer,colorbuffer;
|
||||
//glGenRenderbuffersEXT(1, &depthbuffer);
|
||||
glGenRenderbuffersEXT(1, &colorbuffer);
|
||||
|
||||
//glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthbuffer);
|
||||
//glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorbuffer);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, width, height);
|
||||
|
||||
|
||||
//glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, colorbuffer);
|
||||
|
||||
|
||||
GLuint img;
|
||||
glGenTextures(1, &img);
|
||||
glBindTexture(GL_TEXTURE_2D, img);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
|
||||
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);
|
||||
|
||||
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
|
||||
//glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); */
|
||||
|
||||
|
||||
|
||||
wxBitmap *bmp;
|
||||
|
||||
if (!pbuffer) {
|
||||
try {
|
||||
wxSize res=wxGetDisplaySize();
|
||||
pbuffer=new FBO(res.GetWidth(),res.GetHeight());
|
||||
/*
|
||||
#if defined(__WXMSW__)
|
||||
pbuffer=new pBufferWGL(width,height);
|
||||
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
|
||||
pbuffer=new pBufferAGL(width,height);
|
||||
throw GLException(wxT("Macintrash"));
|
||||
//pbuffer=new pBufferAGL(width,height);
|
||||
#elif defined(__UNIX__)
|
||||
pbuffer=new pBufferGLX(width,height);
|
||||
#endif
|
||||
*/
|
||||
} catch(GLException e) {
|
||||
// Should log already if failed..
|
||||
wxLogDebug(wxT("pBuffers not implemented or functional on this platform.. Trying FBO"));
|
||||
pbuffer=NULL;
|
||||
}
|
||||
}
|
||||
if (!pbuffer) {
|
||||
try {
|
||||
pbuffer=new FBO(width,height);
|
||||
} catch(GLException e) {
|
||||
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
|
||||
pbuffer=NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (pbuffer) {
|
||||
pbuffer->UseBuffer(true);
|
||||
}
|
||||
// Move this bitmap code to pBuffer
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Can't use font's in multiple contexts
|
||||
Render(width,height);
|
||||
|
||||
// glClearColor(1,1,0,1);
|
||||
//glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
//glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
// Can't use font's in multiple contexts
|
||||
Render(width,height);
|
||||
bmp=pbuffer->Snapshot(width,height);
|
||||
glFlush();
|
||||
pbuffer->UseBuffer(false);
|
||||
} else bmp=NULL;
|
||||
|
||||
//glDrawBuffer(GL_BACK_LEFT);
|
||||
|
||||
// GLubyte* src = (GLubyte*)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);
|
||||
|
||||
// glBindTexture(GL_TEXTURE_2D, img);
|
||||
void* pixels = malloc(3 * width * height); // must use malloc
|
||||
//glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
|
||||
//glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
//glReadBuffer(GL_FRONT);
|
||||
//glReadBuffer(GL_BACK_LEFT );
|
||||
//glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Put the image into a wxImage
|
||||
wxImage image(width, height, true);
|
||||
image.SetData((unsigned char*) pixels);
|
||||
image = image.Mirror(false);
|
||||
glFlush();
|
||||
|
||||
wxBitmap *bmp=new wxBitmap(image);
|
||||
|
||||
|
||||
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
// glDeleteFramebuffersEXT(1, &fbo);
|
||||
//glDeleteRenderbuffersEXT(1, &depthbuffer);
|
||||
if (pbuffer) {
|
||||
//delete pbuffer;
|
||||
}
|
||||
|
||||
return bmp;
|
||||
}
|
||||
@ -1180,7 +1120,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
|
||||
|
||||
SwapBuffers(); // Dump to screen.
|
||||
|
||||
//event.Skip();
|
||||
event.Skip();
|
||||
}
|
||||
void gGraphWindow::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
@ -1673,8 +1613,8 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
||||
glColor4ub(linecol1.Red(),linecol1.Green(),linecol1.Blue(),linecol1.Alpha());
|
||||
glLineWidth(1);
|
||||
|
||||
for (double i=miny+(min_ytick/2.0); i<maxy; i+=min_ytick) {
|
||||
ty=(i - miny) * ymult;
|
||||
for (double i=miny+(min_ytick/2.0); i<maxy; i+=min_ytick) {
|
||||
ty=(i - miny) * ymult;
|
||||
h=(start_py+height)-ty;
|
||||
vertarray[vertcnt++]=start_px-4;
|
||||
vertarray[vertcnt++]=h;
|
||||
@ -1688,13 +1628,13 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
||||
}
|
||||
}
|
||||
|
||||
for (double i=miny; i<=maxy; i+=min_ytick) {
|
||||
ty=(i - miny) * ymult;
|
||||
fd=Format(i); // Override this as a function.
|
||||
GetTextExtent(fd,x,y);
|
||||
if (x>labelW) labelW=x;
|
||||
for (double i=miny; i<=maxy; i+=min_ytick) {
|
||||
ty=(i - miny) * ymult;
|
||||
fd=Format(i); // Override this as a function.
|
||||
GetTextExtent(fd,x,y);
|
||||
if (x>labelW) labelW=x;
|
||||
h=start_py+ty;
|
||||
DrawText(fd,start_px-8-x,h - (y / 2));
|
||||
DrawText(fd,start_px-8-x,h - (y / 2));
|
||||
|
||||
vertarray[vertcnt++]=start_px-4;
|
||||
vertarray[vertcnt++]=h;
|
||||
@ -2816,7 +2756,7 @@ void TAPData::Reload(Day *day)
|
||||
int lastval=0,val;
|
||||
|
||||
int field=0;
|
||||
|
||||
|
||||
for (vector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
||||
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
||||
first=true;
|
||||
|
@ -30,8 +30,8 @@ extern wxColor *wxLIGHT_YELLOW;
|
||||
extern wxColor *wxDARK_GREEN;
|
||||
extern wxColor *wxDARK_GREY;
|
||||
|
||||
#define MIN(a,b) (a<b) ? a : b;
|
||||
#define MAX(a,b) (a<b) ? b : a;
|
||||
//#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
||||
//#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
||||
|
||||
class Point3D
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
namespace AutoVersion{
|
||||
|
||||
//Date Version Types
|
||||
static const char _DATE[] = "17";
|
||||
static const char _DATE[] = "18";
|
||||
static const char _MONTH[] = "06";
|
||||
static const char _YEAR[] = "2011";
|
||||
static const char _UBUNTU_VERSION_STYLE[] = "11.06";
|
||||
@ -16,14 +16,14 @@ namespace AutoVersion{
|
||||
//Standard Version Type
|
||||
static const long _MAJOR = 0;
|
||||
static const long _MINOR = 7;
|
||||
static const long _BUILD = 6516;
|
||||
static const long _REVISION = 18844;
|
||||
static const long _BUILD = 6592;
|
||||
static const long _REVISION = 19276;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
static const long _BUILDS_COUNT = 7759;
|
||||
#define _RC_FILEVERSION 0,7,6516,18844
|
||||
#define _RC_FILEVERSION_STRING "0, 7, 6516, 18844\0"
|
||||
static const char _FULLVERSION_STRING[] = "0.7.6516.18844";
|
||||
static const long _BUILDS_COUNT = 7932;
|
||||
#define _RC_FILEVERSION 0,7,6592,19276
|
||||
#define _RC_FILEVERSION_STRING "0, 7, 6592, 19276\0"
|
||||
static const char _FULLVERSION_STRING[] = "0.7.6592.19276";
|
||||
|
||||
//These values are to keep track of your versioning state, don't modify them.
|
||||
static const long _BUILD_HISTORY = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user