mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-21 21:20:45 +00:00
Linux pBuffer fixes
This commit is contained in:
parent
035f95b446
commit
ab65299928
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<CodeBlocks_layout_file>
|
<CodeBlocks_layout_file>
|
||||||
<ActiveTarget name="Debug" />
|
<ActiveTarget name="Windows" />
|
||||||
<File name="../../src/GUIFrame.cpp" open="0" top="0" tabpos="9">
|
<File name="../../src/GUIFrame.cpp" open="0" top="0" tabpos="9">
|
||||||
<Cursor position="6211" topLine="144" />
|
<Cursor position="6211" topLine="144" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/GUIFrame.h" open="0" top="0" tabpos="8">
|
<File name="../../src/GUIFrame.h" open="1" top="0" tabpos="8">
|
||||||
<Cursor position="3128" topLine="100" />
|
<Cursor position="3128" topLine="100" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/SleepyHeadApp.cpp" open="1" top="0" tabpos="1">
|
<File name="../../src/SleepyHeadApp.cpp" open="1" top="0" tabpos="1">
|
||||||
<Cursor position="1078" topLine="44" />
|
<Cursor position="1078" topLine="44" />
|
||||||
</File>
|
</File>
|
||||||
|
<File name="../../src/SleepyHeadApp.h" open="1" top="1" tabpos="0">
|
||||||
|
<Cursor position="0" topLine="0" />
|
||||||
|
</File>
|
||||||
<File name="../../src/SleepyHeadMain.cpp" open="1" top="0" tabpos="1">
|
<File name="../../src/SleepyHeadMain.cpp" open="1" top="0" tabpos="1">
|
||||||
<Cursor position="24248" topLine="650" />
|
<Cursor position="24248" topLine="650" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/SleepyHeadMain.h" open="1" top="0" tabpos="2">
|
<File name="../../src/SleepyHeadMain.h" open="1" top="0" tabpos="2">
|
||||||
<Cursor position="2035" topLine="47" />
|
<Cursor position="2035" topLine="47" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/graphs/gl_pbuffer.cpp" open="1" top="1" tabpos="5">
|
<File name="../../src/graphs/gl_pbuffer.cpp" open="1" top="0" tabpos="5">
|
||||||
<Cursor position="3" topLine="0" />
|
<Cursor position="3" topLine="0" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/graphs/gl_pbuffer.h" open="1" top="0" tabpos="6">
|
<File name="../../src/graphs/gl_pbuffer.h" open="1" top="0" tabpos="6">
|
||||||
@ -40,7 +43,7 @@
|
|||||||
<File name="../../src/libs/freetype-gl/texture-atlas.h" open="0" top="0" tabpos="13">
|
<File name="../../src/libs/freetype-gl/texture-atlas.h" open="0" top="0" tabpos="13">
|
||||||
<Cursor position="1661" topLine="21" />
|
<Cursor position="1661" topLine="21" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/libs/freetype-gl/texture-font.cpp" open="0" top="0" tabpos="11">
|
<File name="../../src/libs/freetype-gl/texture-font.cpp" open="1" top="0" tabpos="11">
|
||||||
<Cursor position="1196" topLine="0" />
|
<Cursor position="1196" topLine="0" />
|
||||||
</File>
|
</File>
|
||||||
<File name="../../src/libs/freetype-gl/texture-font.h" open="0" top="0" tabpos="12">
|
<File name="../../src/libs/freetype-gl/texture-font.h" open="0" top="0" tabpos="12">
|
||||||
|
@ -10,9 +10,22 @@
|
|||||||
#ifndef SLEEPYHEADAPP_H
|
#ifndef SLEEPYHEADAPP_H
|
||||||
#define SLEEPYHEADAPP_H
|
#define SLEEPYHEADAPP_H
|
||||||
|
|
||||||
#include <wx/app.h>
|
/*#if defined(__WXMSW__) // windows gl extensions
|
||||||
|
|
||||||
class SleepyHeadApp : public wxApp
|
#define GLEW_STATIC
|
||||||
|
#define WGL_WGLEXT_PROTOTYPES
|
||||||
|
|
||||||
|
#include <GL/glew.h>
|
||||||
|
#include <GL/wglew.h>
|
||||||
|
//#include <GL/gl.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#undef Yield */
|
||||||
|
|
||||||
|
#include <wx/app.h>
|
||||||
|
//#include <wx/glcanvas.h>
|
||||||
|
|
||||||
|
class SleepyHeadApp : public wxApp //wxGLApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
|
@ -48,6 +48,9 @@ wxProgressDialog *loader_progress;
|
|||||||
enum wxbuildinfoformat {
|
enum wxbuildinfoformat {
|
||||||
short_f, long_f };
|
short_f, long_f };
|
||||||
|
|
||||||
|
const wxEventType wxEVT_REFRESH_DAILY = wxNewEventType();
|
||||||
|
|
||||||
|
|
||||||
wxString wxbuildinfo(wxbuildinfoformat format)
|
wxString wxbuildinfo(wxbuildinfoformat format)
|
||||||
{
|
{
|
||||||
wxString wxbuild(wxVERSION_STRING);
|
wxString wxbuild(wxVERSION_STRING);
|
||||||
@ -856,6 +859,7 @@ Daily::Daily(wxWindow *win,Profile *p)
|
|||||||
//EVT_SCROLLWIN_THUMBTRACK(Daily::OnWinScroll)
|
//EVT_SCROLLWIN_THUMBTRACK(Daily::OnWinScroll)
|
||||||
//this->Connect(GraphWindow->GetId(),wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(Daily::OnWinScroll));
|
//this->Connect(GraphWindow->GetId(),wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(Daily::OnWinScroll));
|
||||||
|
|
||||||
|
|
||||||
Refresh(true); // 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();
|
Update();
|
||||||
// gwSizer->Layout();
|
// gwSizer->Layout();
|
||||||
@ -939,8 +943,13 @@ void Daily::RefreshData()
|
|||||||
wxCommandEvent MyEvent( wxEVT_REFRESH_DAILY);
|
wxCommandEvent MyEvent( wxEVT_REFRESH_DAILY);
|
||||||
wxPostEvent(this, MyEvent);
|
wxPostEvent(this, MyEvent);
|
||||||
}
|
}
|
||||||
|
extern bool do_refresh_daily;
|
||||||
void Daily::DoRefreshData(wxCommandEvent& event)
|
void Daily::DoRefreshData(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
if (!graph_init) {
|
||||||
|
do_refresh_daily=true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
wxDateTime date=Calendar->GetDate();
|
wxDateTime date=Calendar->GetDate();
|
||||||
date.ResetTime();
|
date.ResetTime();
|
||||||
date.SetHour(0);
|
date.SetHour(0);
|
||||||
|
@ -50,8 +50,7 @@ protected:
|
|||||||
Day *dummyday;
|
Day *dummyday;
|
||||||
};
|
};
|
||||||
|
|
||||||
const wxEventType wxEVT_REFRESH_DAILY = wxNewEventType();
|
extern const wxEventType wxEVT_REFRESH_DAILY;
|
||||||
|
|
||||||
class Daily:public DailyPanel
|
class Daily:public DailyPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -27,11 +27,12 @@ long roundup2(long v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pBuffer::pBuffer()
|
pBuffer::pBuffer(wxGLContext * gc)
|
||||||
{
|
{
|
||||||
|
m_gc=gc;
|
||||||
}
|
}
|
||||||
pBuffer::pBuffer(int width, int height,wxGLCanvas * gc)
|
pBuffer::pBuffer(int width, int height,wxGLContext * gc)
|
||||||
:m_width(width),m_height(height)
|
:m_gc(gc),m_width(width),m_height(height)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
pBuffer::~pBuffer()
|
pBuffer::~pBuffer()
|
||||||
@ -54,10 +55,17 @@ wxBitmap *pBuffer::Snapshot(int width, int height)
|
|||||||
wxBitmap *bmp=new wxBitmap(image);
|
wxBitmap *bmp=new wxBitmap(image);
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
void pBuffer::SelectContext(wxGLCanvas * glc)
|
||||||
|
{
|
||||||
|
assert(glc!=NULL);
|
||||||
|
|
||||||
|
if (glc->IsShownOnScreen()) glc->SetCurrent(*m_gc);
|
||||||
|
// else wx sucks..
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FBO::FBO(int width, int height,wxGLCanvas * gc)
|
FBO::FBO(int width, int height,wxGLContext * gc)
|
||||||
:pBuffer()
|
:pBuffer(gc)
|
||||||
{
|
{
|
||||||
//wxGLContext a((wxGLCanvas *)NULL,(wxGLContext *)NULL);
|
//wxGLContext a((wxGLCanvas *)NULL,(wxGLContext *)NULL);
|
||||||
int m=MAX(width,height);
|
int m=MAX(width,height);
|
||||||
@ -122,14 +130,14 @@ FBO::~FBO()
|
|||||||
if (m_color_buffer)
|
if (m_color_buffer)
|
||||||
glDeleteRenderbuffersEXT(1, &colorbuffer);
|
glDeleteRenderbuffersEXT(1, &colorbuffer);
|
||||||
}
|
}
|
||||||
void FBO::UseBuffer(bool b)
|
void FBO::SelectBuffer()
|
||||||
{
|
{
|
||||||
if (b) {
|
|
||||||
// glBindTexture(GL_TEXTURE_2D, img);
|
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||||
} else {
|
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
|
||||||
}
|
}
|
||||||
|
void FBO::SelectContext(wxGLCanvas * glc)
|
||||||
|
{
|
||||||
|
// Don't need the context in this case..
|
||||||
|
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||||
}
|
}
|
||||||
wxBitmap *FBO::Snapshot(int width,int height)
|
wxBitmap *FBO::Snapshot(int width,int height)
|
||||||
{
|
{
|
||||||
@ -173,8 +181,8 @@ wxBitmap *FBO::Snapshot(int width,int height)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
pBufferWGL::pBufferWGL(int width, int height,wxGLCanvas * gc)
|
pBufferWGL::pBufferWGL(int width, int height,wxGLContext * gc)
|
||||||
:m_texture(0)
|
:pBuffer(width,height,gc),m_texture(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
hGlRc=0;
|
hGlRc=0;
|
||||||
@ -194,10 +202,10 @@ pBufferWGL::pBufferWGL(int width, int height,wxGLCanvas * gc)
|
|||||||
j=1 << i;
|
j=1 << i;
|
||||||
if (j >= ms) break;
|
if (j >= ms) break;
|
||||||
}
|
}
|
||||||
j <<= 2;
|
//j <<= 2;
|
||||||
//assert (j>=ms); // I seriously doubt this will ever happen ;)
|
//assert (j>=ms); // I seriously doubt this will ever happen ;)
|
||||||
|
|
||||||
// WGL only supports square pBuffers
|
// WGL only supports square pBuffers (apparently..)
|
||||||
m_width=j;
|
m_width=j;
|
||||||
m_height=j;
|
m_height=j;
|
||||||
|
|
||||||
@ -303,13 +311,13 @@ pBufferWGL::~pBufferWGL()
|
|||||||
if (hBuffer) wglReleasePbufferDCARB(hBuffer, hdc);
|
if (hBuffer) wglReleasePbufferDCARB(hBuffer, hdc);
|
||||||
if (hBuffer) wglDestroyPbufferARB(hBuffer);
|
if (hBuffer) wglDestroyPbufferARB(hBuffer);
|
||||||
}
|
}
|
||||||
void pBufferWGL::UseBuffer(bool b)
|
void pBufferWGL::SelectBuffer()
|
||||||
{
|
{
|
||||||
if (b) {
|
|
||||||
wglMakeCurrent(hdc, hGlRc);
|
wglMakeCurrent(hdc, hGlRc);
|
||||||
} else {
|
|
||||||
wglMakeCurrent(saveHdc, saveHglrc);
|
|
||||||
}
|
}
|
||||||
|
void pBufferWGL::SelectContext(wxGLCanvas * glc)
|
||||||
|
{
|
||||||
|
wglMakeCurrent(saveHdc, saveHglrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pBufferWGL::InitGLStuff()
|
bool pBufferWGL::InitGLStuff()
|
||||||
@ -367,12 +375,11 @@ bool pBufferWGL::InitGLStuff()
|
|||||||
|
|
||||||
GLXContext real_shared_context=NULL;
|
GLXContext real_shared_context=NULL;
|
||||||
|
|
||||||
|
pBufferGLX::pBufferGLX(int width, int height,wxGLContext * gc)
|
||||||
pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
:pBuffer(width,height,gc)
|
||||||
:pBuffer()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int ms=MAX(width,height);
|
/*int ms=MAX(width,height);
|
||||||
int j;
|
int j;
|
||||||
for (int i=4;i<32;i++) { // min size 16x16.. probably a usless size.
|
for (int i=4;i<32;i++) { // min size 16x16.. probably a usless size.
|
||||||
j=1 << i;
|
j=1 << i;
|
||||||
@ -381,7 +388,13 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
|||||||
j <<= 2;
|
j <<= 2;
|
||||||
|
|
||||||
m_width=j;
|
m_width=j;
|
||||||
m_height=j;
|
m_height=j; */
|
||||||
|
|
||||||
|
hBuffer=0;
|
||||||
|
m_context=0,m_shared=0;
|
||||||
|
int ret;
|
||||||
|
display=NULL;
|
||||||
|
GLXFBConfig *fbc=NULL;
|
||||||
|
|
||||||
int attrib[]={
|
int attrib[]={
|
||||||
GLX_PBUFFER_WIDTH,m_width,
|
GLX_PBUFFER_WIDTH,m_width,
|
||||||
@ -389,12 +402,8 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
|||||||
GLX_PRESERVED_CONTENTS, True
|
GLX_PRESERVED_CONTENTS, True
|
||||||
};
|
};
|
||||||
|
|
||||||
pBuffer=0;
|
|
||||||
m_context=0,m_shared=0;
|
|
||||||
int ret;
|
|
||||||
display=NULL;
|
|
||||||
GLXFBConfig *fbc=NULL;
|
|
||||||
|
|
||||||
|
//bool fbc_dontfree=false;
|
||||||
/*#if wxCHECK_VERSION(2,9,0)
|
/*#if wxCHECK_VERSION(2,9,0)
|
||||||
display=wxGetX11Display();
|
display=wxGetX11Display();
|
||||||
fbc = GetGLXFBConfig(); // wxGLCanvas call
|
fbc = GetGLXFBConfig(); // wxGLCanvas call
|
||||||
@ -403,7 +412,7 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
|||||||
|
|
||||||
#else */
|
#else */
|
||||||
display=(Display *)wxGetDisplay();
|
display=(Display *)wxGetDisplay();
|
||||||
int doubleBufferAttributess[] = {
|
int fb_attrib[] = {
|
||||||
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
|
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
|
||||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||||
GLX_DOUBLEBUFFER, True,
|
GLX_DOUBLEBUFFER, True,
|
||||||
@ -412,11 +421,19 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
|||||||
GLX_BLUE_SIZE, 8,
|
GLX_BLUE_SIZE, 8,
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
fbc=glXChooseFBConfig(display, DefaultScreen(display), doubleBufferAttributess, &ret);
|
//#if wxCHECK_VERSION(2,9,0)
|
||||||
pBuffer=glXCreatePbuffer(display, *fbc, attrib );
|
//fbc = gc->GetGLXFBConfig(); // wxGLCanvas call
|
||||||
|
//fbc = &fbc[0];
|
||||||
|
//fbc_donefree=true;
|
||||||
|
//#else
|
||||||
|
//fbc=(GLXFBConfig*)gc->ChooseGLFBC(fb_attrib); // This adds glcanvas's attribs
|
||||||
|
fbc=glXChooseFBConfig(display, DefaultScreen(display), fb_attrib, &ret);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
if (pBuffer == 0) {
|
hBuffer=glXCreatePbuffer(display, *fbc, attrib );
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
if (hBuffer == 0) {
|
||||||
wxLogError(wxT("pBuffer not availble"));
|
wxLogError(wxT("pBuffer not availble"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,34 +452,29 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
|||||||
wxLogError(wxT("Context not availble"));
|
wxLogError(wxT("Context not availble"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if !wxCHECK_VERSION(2,9,0)
|
#if !wxCHECK_VERSION(2,9,0)
|
||||||
XFree(fbc);
|
XFree(fbc);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
glXMakeCurrent(display,pBuffer,m_shared);
|
glXMakeCurrent(display,hBuffer,m_shared);
|
||||||
|
|
||||||
//UseBuffer(true);
|
//UseBuffer(true);
|
||||||
}
|
}
|
||||||
pBufferGLX::~pBufferGLX()
|
pBufferGLX::~pBufferGLX()
|
||||||
{
|
{
|
||||||
if (m_context) glXDestroyContext(display,m_context); // Destroy the context only if we created it..
|
if (m_context) glXDestroyContext(display,m_context); // Destroy the context only if we created it..
|
||||||
if (pBuffer) glXDestroyPbuffer(display, pBuffer);
|
if (hBuffer) glXDestroyPbuffer(display, hBuffer);
|
||||||
}
|
}
|
||||||
void pBufferGLX::UseBuffer(bool b)
|
void pBufferGLX::SelectBuffer()
|
||||||
{
|
{
|
||||||
if (b) {
|
if (glXMakeCurrent(display,hBuffer,m_shared)!=True) {
|
||||||
if (glXMakeCurrent(display,pBuffer,m_shared)!=True) {
|
|
||||||
wxLogError(wxT("Couldn't make pBuffer current"));
|
wxLogError(wxT("Couldn't make pBuffer current"));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
// to be honest.. i'm not sure yet.. wx stupidly keeps the needed variables private
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined(__DARWIN__) || defined(__WXMAC__)
|
#elif defined(__DARWIN__) || defined(__WXMAC__)
|
||||||
|
|
||||||
pBufferAGL::pBufferAGL(int width, int height,wxGLCanvas * gc)
|
pBufferAGL::pBufferAGL(int width, int height,wxGLContext * gc)
|
||||||
:pBuffer()
|
:pBuffer(gc)
|
||||||
{
|
{
|
||||||
m_width=width;
|
m_width=width;
|
||||||
m_height=height;
|
m_height=height;
|
||||||
|
@ -31,6 +31,7 @@ License: GPL
|
|||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#elif defined(__WXCOCOA__)
|
#elif defined(__WXCOCOA__)
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -52,28 +53,33 @@ public:
|
|||||||
GLException(wxString s=wxT("Lazy Programmer forgot to specify error")) { wxLogError(wxT("GLException: ")+s); };
|
GLException(wxString s=wxT("Lazy Programmer forgot to specify error")) { wxLogError(wxT("GLException: ")+s); };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class pBuffer {
|
class pBuffer {
|
||||||
public:
|
public:
|
||||||
pBuffer();
|
pBuffer(wxGLContext * gc);
|
||||||
pBuffer(int width, int height,wxGLCanvas * gc);
|
pBuffer(int width, int height,wxGLContext * gc);
|
||||||
virtual ~pBuffer();
|
virtual ~pBuffer();
|
||||||
virtual void UseBuffer(bool b) {};
|
|
||||||
int Width() { return m_width; };
|
int Width() { return m_width; };
|
||||||
int Height() { return m_height; };
|
int Height() { return m_height; };
|
||||||
|
|
||||||
|
virtual void SelectContext(wxGLCanvas * gc);
|
||||||
|
virtual void SelectBuffer()=0;
|
||||||
|
|
||||||
virtual wxBitmap *Snapshot(int width, int height);
|
virtual wxBitmap *Snapshot(int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
|
wxGLContext * m_gc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FBO:public pBuffer
|
class FBO:public pBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FBO(int width, int height,wxGLCanvas * gc);
|
FBO(int width, int height,wxGLContext * gc);
|
||||||
virtual ~FBO();
|
virtual ~FBO();
|
||||||
virtual void UseBuffer(bool b);
|
virtual void SelectBuffer();
|
||||||
|
virtual void SelectContext(wxGLCanvas * gc);
|
||||||
virtual wxBitmap *Snapshot(int width, int height);
|
virtual wxBitmap *Snapshot(int width, int height);
|
||||||
protected:
|
protected:
|
||||||
GLuint depthbuffer,colorbuffer;
|
GLuint depthbuffer,colorbuffer;
|
||||||
@ -88,9 +94,10 @@ protected:
|
|||||||
class pBufferWGL:public pBuffer
|
class pBufferWGL:public pBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pBufferWGL(int width, int height,wxGLCanvas * gc);
|
pBufferWGL(int width, int height,wxGLContext * gc);
|
||||||
virtual ~pBufferWGL();
|
virtual ~pBufferWGL();
|
||||||
virtual void UseBuffer(bool b);
|
virtual void SelectBuffer();
|
||||||
|
virtual void SelectContext(wxGLCanvas * gc);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool InitGLStuff();
|
bool InitGLStuff();
|
||||||
@ -113,13 +120,13 @@ extern GLXContext real_shared_context;
|
|||||||
class pBufferGLX:public pBuffer
|
class pBufferGLX:public pBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pBufferGLX(int width, int height,wxGLCanvas * gc);
|
pBufferGLX(int width, int height,wxGLContext * gc);
|
||||||
virtual ~pBufferGLX();
|
virtual ~pBufferGLX();
|
||||||
virtual void UseBuffer(bool b);
|
virtual void SelectBuffer();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Display *display;
|
Display *display;
|
||||||
GLXPbuffer pBuffer;
|
GLXPbuffer hBuffer;
|
||||||
GLXContext m_context;
|
GLXContext m_context;
|
||||||
GLXContext m_shared;
|
GLXContext m_shared;
|
||||||
};
|
};
|
||||||
@ -128,9 +135,10 @@ protected:
|
|||||||
class pBufferAGL:public pBuffer
|
class pBufferAGL:public pBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pBufferAGL(int width, int height,wxGLCanvas * gc);
|
pBufferAGL(int width, int height,wxGLContext * gc);
|
||||||
virtual ~pBufferAGL();
|
virtual ~pBufferAGL();
|
||||||
virtual void UseBuffer(bool b);
|
virtual void SelectBuffer();
|
||||||
|
virtual void SelectContext(wxGLCanvas * gc);
|
||||||
protected:
|
protected:
|
||||||
/* AGLPixelFormat pixelFormat;
|
/* AGLPixelFormat pixelFormat;
|
||||||
AGLPbuffer pbuffer;
|
AGLPbuffer pbuffer;
|
||||||
|
@ -62,11 +62,15 @@ TextureFont *bigfont=NULL,*zfont=NULL;
|
|||||||
VertexBuffer *vbuffer=NULL;
|
VertexBuffer *vbuffer=NULL;
|
||||||
TextMarkup *markup=NULL;
|
TextMarkup *markup=NULL;
|
||||||
|
|
||||||
static bool gfont_init=false;
|
//extern const wxEventType wxEVT_REFRESH_DAILY;
|
||||||
|
|
||||||
|
|
||||||
|
bool graph_init=false;
|
||||||
|
|
||||||
// Must be called from a thread inside the application.
|
// Must be called from a thread inside the application.
|
||||||
void GraphInit()
|
void GraphInit()
|
||||||
{
|
{
|
||||||
|
if (!graph_init) {
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
static bool glewinit_called=false;
|
static bool glewinit_called=false;
|
||||||
if (!glewinit_called) {
|
if (!glewinit_called) {
|
||||||
@ -74,8 +78,6 @@ void GraphInit()
|
|||||||
glewinit_called=true;
|
glewinit_called=true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!gfont_init) {
|
|
||||||
wxString glvendor=wxString((char *)glGetString(GL_VENDOR),wxConvUTF8);
|
wxString glvendor=wxString((char *)glGetString(GL_VENDOR),wxConvUTF8);
|
||||||
wxString glrenderer=wxString((char *)glGetString(GL_RENDERER),wxConvUTF8);
|
wxString glrenderer=wxString((char *)glGetString(GL_RENDERER),wxConvUTF8);
|
||||||
wxString glversion=wxString((char *)glGetString(GL_VERSION),wxConvUTF8);
|
wxString glversion=wxString((char *)glGetString(GL_VERSION),wxConvUTF8);
|
||||||
@ -105,16 +107,16 @@ void GraphInit()
|
|||||||
}
|
}
|
||||||
f.Close();
|
f.Close();
|
||||||
}
|
}
|
||||||
gfont_init=true;
|
graph_init=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void GraphDone()
|
void GraphDone()
|
||||||
{
|
{
|
||||||
if (gfont_init) {
|
if (graph_init) {
|
||||||
delete font_manager;
|
delete font_manager;
|
||||||
// delete vbuffer;
|
// delete vbuffer;
|
||||||
delete markup;
|
delete markup;
|
||||||
gfont_init=false;
|
graph_init=false;
|
||||||
}
|
}
|
||||||
if (shared_context) {
|
if (shared_context) {
|
||||||
delete shared_context;
|
delete shared_context;
|
||||||
@ -188,8 +190,6 @@ void DrawText(wxString text, float x, float y, float angle=0, const wxColor & co
|
|||||||
float w,h;
|
float w,h;
|
||||||
GetTextExtent(text, w, h, font);
|
GetTextExtent(text, w, h, font);
|
||||||
|
|
||||||
//glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha());
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(floor(x),floor(y),0);
|
glTranslatef(floor(x),floor(y),0);
|
||||||
glRotatef(angle, 0.0f, 0.0f, 1.0f);
|
glRotatef(angle, 0.0f, 0.0f, 1.0f);
|
||||||
@ -225,7 +225,6 @@ void RoundedRectangle(int x,int y,int w,int h,int radius,const wxColor & color)
|
|||||||
glVertex2f(x+radius+cos(i)*radius,y+radius+sin(i)*radius);
|
glVertex2f(x+radius+cos(i)*radius,y+radius+sin(i)*radius);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
// glEnable(GL_TEXTURE_2D);
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,9 +365,10 @@ gGraphWindow::gGraphWindow()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//wxGLContext frackyouwx((wxGLCanvas *)NULL,(wxGLContext *)NULL);
|
||||||
|
|
||||||
gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & title,const wxPoint &pos,const wxSize &size,long flags)
|
gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & title,const wxPoint &pos,const wxSize &size,long flags)
|
||||||
: wxGLCanvas( parent, shared_context, id, pos, size, flags, title, (int *)wx_gl_attribs, wxNullPalette )
|
: wxGLCanvas( parent, (wxGLContext *)shared_context, id, pos, size, flags, title, (int *)wx_gl_attribs, wxNullPalette )
|
||||||
{
|
{
|
||||||
m_scrX = m_scrY = 64;
|
m_scrX = m_scrY = 64;
|
||||||
m_title=title;
|
m_title=title;
|
||||||
@ -386,8 +386,10 @@ gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & titl
|
|||||||
ti=wxDateTime::Now();
|
ti=wxDateTime::Now();
|
||||||
gtitle=foobar=xaxis=yaxis=NULL;
|
gtitle=foobar=xaxis=yaxis=NULL;
|
||||||
|
|
||||||
|
|
||||||
if (!shared_context) {
|
if (!shared_context) {
|
||||||
|
|
||||||
|
int q=0;
|
||||||
#if defined(__DARWIN__) && !wxCHECK_VERSION(2,9,0)
|
#if defined(__DARWIN__) && !wxCHECK_VERSION(2,9,0)
|
||||||
// Screw you apple..
|
// Screw you apple..
|
||||||
int *attribList = (int*) NULL;
|
int *attribList = (int*) NULL;
|
||||||
@ -395,22 +397,13 @@ gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & titl
|
|||||||
shared_context=new wxGLContext(aglpf,this,wxNullPalette,NULL);
|
shared_context=new wxGLContext(aglpf,this,wxNullPalette,NULL);
|
||||||
|
|
||||||
// Mmmmm.. Platform incosistency with wx..
|
// Mmmmm.. Platform incosistency with wx..
|
||||||
#else
|
|
||||||
// Darwin joins the rest of the platforms as of wx2.9
|
#else // (Darwin joins the rest of the platforms as of wx2.9)
|
||||||
shared_context=new wxGLContext(this,NULL);
|
shared_context=new wxGLContext(this,NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
|
||||||
shared_context->SetCurrent(*this); // Windows needs this done now or it borks..
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__WXMAC__) && defined (__UNIX__)
|
|
||||||
real_shared_context = glXGetCurrentContext(); // Unix likes this, but can't really have it..
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GraphInit(); // Font
|
|
||||||
//texfont=::texfont;
|
//texfont=::texfont;
|
||||||
if (!title.IsEmpty()) {
|
if (!title.IsEmpty()) {
|
||||||
AddLayer(new gGraphTitle(title,wxVERTICAL));
|
AddLayer(new gGraphTitle(title,wxVERTICAL));
|
||||||
@ -422,7 +415,10 @@ gGraphWindow::~gGraphWindow()
|
|||||||
{
|
{
|
||||||
for (list<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) delete (*l);
|
for (list<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) delete (*l);
|
||||||
layers.clear();
|
layers.clear();
|
||||||
|
/* if (shared_context) {
|
||||||
|
delete shared_context;
|
||||||
|
shared_context=NULL;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1011,19 +1007,24 @@ pBuffer *pbuffer=NULL;
|
|||||||
|
|
||||||
wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
|
wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
|
||||||
{
|
{
|
||||||
|
if (!graph_init) {
|
||||||
|
// Damn you WX Update the
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
wxBitmap *bmp;
|
wxBitmap *bmp;
|
||||||
Update();
|
//Update();
|
||||||
|
|
||||||
if (!pbuffer) {
|
if (!pbuffer) {
|
||||||
|
wxSize res=wxGetDisplaySize(); // Not entirely sure if this is the limit..
|
||||||
try {
|
try {
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
pbuffer=new pBufferWGL(width,height,this);
|
pbuffer=new pBufferWGL(res.GetWidth(),res.GetHeight(),shared_context);
|
||||||
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
|
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
|
||||||
// Do nothing and load the FBO
|
// Do nothing and load the FBO
|
||||||
throw GLException(wxT("Macintrash"));
|
throw GLException(wxT("Macintrash"));
|
||||||
//pbuffer=new pBufferAGL(width,height);
|
//pbuffer=new pBufferAGL(width,height);
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
pbuffer=new pBufferGLX(width,height,this);
|
pbuffer=new pBufferGLX(res.GetWidth(),res.GetHeight(),shared_context);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} catch(GLException e) {
|
} catch(GLException e) {
|
||||||
@ -1031,30 +1032,29 @@ wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
|
|||||||
wxLogDebug(wxT("pBuffers not implemented or functional on this platform.. Trying FBO"));
|
wxLogDebug(wxT("pBuffers not implemented or functional on this platform.. Trying FBO"));
|
||||||
pbuffer=NULL;
|
pbuffer=NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!pbuffer) {
|
if (!pbuffer) {
|
||||||
try {
|
try {
|
||||||
// This will fail the first run on GTK
|
// This will fail the first run on GTK
|
||||||
// The solution is to get a damn screen refresh event to occur BEFORE the RefreshData() event callback.
|
// The solution is to get a damn screen refresh event to occur BEFORE the RefreshData() event callback.
|
||||||
// Trickier than it sounds, and I didn't want to kludge
|
// Trickier than it sounds, and I didn't want to kludge
|
||||||
|
pbuffer=new FBO(res.GetWidth(),res.GetHeight(),shared_context);
|
||||||
wxSize res=wxGetDisplaySize(); // Not entirely sure if this is the limit..
|
|
||||||
pbuffer=new FBO(res.GetWidth(),res.GetHeight(),this);
|
|
||||||
} catch(GLException e) {
|
} catch(GLException e) {
|
||||||
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
|
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
|
||||||
pbuffer=NULL;
|
pbuffer=NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (pbuffer) {
|
if (pbuffer) {
|
||||||
pbuffer->UseBuffer(true);
|
pbuffer->SelectBuffer();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
// Can't use font's in multiple contexts
|
// Can't use font's in multiple contexts
|
||||||
Render(width,height);
|
Render(width,height);
|
||||||
|
|
||||||
bmp=pbuffer->Snapshot(width,height);
|
bmp=pbuffer->Snapshot(width,height);
|
||||||
glFlush();
|
glFlush();
|
||||||
pbuffer->UseBuffer(false);
|
pbuffer->SelectContext(this);
|
||||||
} else bmp=NULL;
|
} else bmp=NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -1093,10 +1093,25 @@ void gGraphWindow::Render(float scrX, float scrY)
|
|||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool do_refresh_daily=false;
|
||||||
|
extern const wxEventType wxEVT_REFRESH_DAILY;
|
||||||
void gGraphWindow::OnPaint(wxPaintEvent& event)
|
void gGraphWindow::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
// Shouldn't need this anymore as opengl double buffers anyway.
|
// Shouldn't need this anymore as opengl double buffers anyway.
|
||||||
|
|
||||||
|
if (!shared_context) {
|
||||||
|
int frog=0;
|
||||||
|
event.Skip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (do_refresh_daily) { // wx is absolutely retarded if you can't force a screen update..
|
||||||
|
|
||||||
|
wxCommandEvent MyEvent(wxEVT_REFRESH_DAILY);
|
||||||
|
wxPostEvent(this, MyEvent);
|
||||||
|
do_refresh_daily=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//#if defined(__WXMSW__)
|
//#if defined(__WXMSW__)
|
||||||
// wxAutoBufferedPaintDC dc(this);
|
// wxAutoBufferedPaintDC dc(this);
|
||||||
//#else
|
//#else
|
||||||
@ -1113,6 +1128,9 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
|
|||||||
shared_context->SetCurrent(*this);
|
shared_context->SetCurrent(*this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GraphInit(); // Glew & Font init
|
||||||
|
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#if !defined(__WXMAC__) && defined (__UNIX__)
|
#if !defined(__WXMAC__) && defined (__UNIX__)
|
||||||
@ -1133,7 +1151,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
|
|||||||
|
|
||||||
SwapBuffers(); // Dump to screen.
|
SwapBuffers(); // Dump to screen.
|
||||||
|
|
||||||
event.Skip();
|
//event.Skip();
|
||||||
}
|
}
|
||||||
void gGraphWindow::OnSize(wxSizeEvent& event)
|
void gGraphWindow::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
@ -1733,6 +1751,8 @@ void gFooBar::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
glVertex2f(start_px+py,h);
|
glVertex2f(start_px+py,h);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
glLineWidth(1);
|
||||||
|
|
||||||
if ((m_funkbar)) { // && ((w.min_x>w.rmin_x) || (w.max_x<w.rmax_x))) {
|
if ((m_funkbar)) { // && ((w.min_x>w.rmin_x) || (w.max_x<w.rmax_x))) {
|
||||||
glColor4f(.8,.8,.8,.6);
|
glColor4f(.8,.8,.8,.6);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@ -1795,6 +1815,9 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
wxRect rect;
|
wxRect rect;
|
||||||
wxDirection dir;
|
wxDirection dir;
|
||||||
|
|
||||||
|
glLineWidth(1);
|
||||||
|
|
||||||
|
// glDisable(GL_LINE_SMOOTH);
|
||||||
for (int i=0;i<data->np[0];i++) {
|
for (int i=0;i<data->np[0];i++) {
|
||||||
t1=floor(px);
|
t1=floor(px);
|
||||||
t2=data->point[0][i].m_y*pxr;
|
t2=data->point[0][i].m_y*pxr;
|
||||||
@ -1909,7 +1932,6 @@ void gBarChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //_MINUS_SRC_ALPHA);
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
|
||||||
}
|
}
|
||||||
zpx=px;
|
zpx=px;
|
||||||
int i,idx=-1;
|
int i,idx=-1;
|
||||||
@ -1974,8 +1996,8 @@ void gBarChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (antialias) {
|
if (antialias) {
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draw_xticks_instead) {
|
if (draw_xticks_instead) {
|
||||||
|
@ -30,6 +30,8 @@ extern wxColor *wxLIGHT_YELLOW;
|
|||||||
extern wxColor *wxDARK_GREEN;
|
extern wxColor *wxDARK_GREEN;
|
||||||
extern wxColor *wxDARK_GREY;
|
extern wxColor *wxDARK_GREY;
|
||||||
|
|
||||||
|
extern bool graph_init;
|
||||||
|
|
||||||
//#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
//#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
||||||
//#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
//#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@ namespace AutoVersion{
|
|||||||
//Standard Version Type
|
//Standard Version Type
|
||||||
static const long _MAJOR = 0;
|
static const long _MAJOR = 0;
|
||||||
static const long _MINOR = 7;
|
static const long _MINOR = 7;
|
||||||
static const long _BUILD = 6650;
|
static const long _BUILD = 6746;
|
||||||
static const long _REVISION = 19612;
|
static const long _REVISION = 20082;
|
||||||
|
|
||||||
//Miscellaneous Version Types
|
//Miscellaneous Version Types
|
||||||
static const long _BUILDS_COUNT = 8104;
|
static const long _BUILDS_COUNT = 8334;
|
||||||
#define _RC_FILEVERSION 0,7,6650,19612
|
#define _RC_FILEVERSION 0,7,6746,20082
|
||||||
#define _RC_FILEVERSION_STRING "0, 7, 6650, 19612\0"
|
#define _RC_FILEVERSION_STRING "0, 7, 6746, 20082\0"
|
||||||
static const char _FULLVERSION_STRING[] = "0.7.6650.19612";
|
static const char _FULLVERSION_STRING[] = "0.7.6746.20082";
|
||||||
|
|
||||||
//These values are to keep track of your versioning state, don't modify them.
|
//These values are to keep track of your versioning state, don't modify them.
|
||||||
static const long _BUILD_HISTORY = 0;
|
static const long _BUILD_HISTORY = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user