mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 12:40:43 +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" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<ActiveTarget name="Debug" />
|
||||
<ActiveTarget name="Windows" />
|
||||
<File name="../../src/GUIFrame.cpp" open="0" top="0" tabpos="9">
|
||||
<Cursor position="6211" topLine="144" />
|
||||
</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" />
|
||||
</File>
|
||||
<File name="../../src/SleepyHeadApp.cpp" open="1" top="0" tabpos="1">
|
||||
<Cursor position="1078" topLine="44" />
|
||||
</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">
|
||||
<Cursor position="24248" topLine="650" />
|
||||
</File>
|
||||
<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">
|
||||
<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">
|
||||
@ -40,7 +43,7 @@
|
||||
<File name="../../src/libs/freetype-gl/texture-atlas.h" open="0" top="0" tabpos="13">
|
||||
<Cursor position="1661" topLine="21" />
|
||||
</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" />
|
||||
</File>
|
||||
<File name="../../src/libs/freetype-gl/texture-font.h" open="0" top="0" tabpos="12">
|
||||
|
@ -9,10 +9,23 @@
|
||||
|
||||
#ifndef SLEEPYHEADAPP_H
|
||||
#define SLEEPYHEADAPP_H
|
||||
|
||||
/*#if defined(__WXMSW__) // windows gl extensions
|
||||
|
||||
#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/app.h>
|
||||
//#include <wx/glcanvas.h>
|
||||
|
||||
class SleepyHeadApp : public wxApp
|
||||
class SleepyHeadApp : public wxApp //wxGLApp
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
|
@ -48,6 +48,9 @@ wxProgressDialog *loader_progress;
|
||||
enum wxbuildinfoformat {
|
||||
short_f, long_f };
|
||||
|
||||
const wxEventType wxEVT_REFRESH_DAILY = wxNewEventType();
|
||||
|
||||
|
||||
wxString wxbuildinfo(wxbuildinfoformat format)
|
||||
{
|
||||
wxString wxbuild(wxVERSION_STRING);
|
||||
@ -856,6 +859,7 @@ Daily::Daily(wxWindow *win,Profile *p)
|
||||
//EVT_SCROLLWIN_THUMBTRACK(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.
|
||||
Update();
|
||||
// gwSizer->Layout();
|
||||
@ -939,8 +943,13 @@ void Daily::RefreshData()
|
||||
wxCommandEvent MyEvent( wxEVT_REFRESH_DAILY);
|
||||
wxPostEvent(this, MyEvent);
|
||||
}
|
||||
extern bool do_refresh_daily;
|
||||
void Daily::DoRefreshData(wxCommandEvent& event)
|
||||
{
|
||||
if (!graph_init) {
|
||||
do_refresh_daily=true;
|
||||
return;
|
||||
}
|
||||
wxDateTime date=Calendar->GetDate();
|
||||
date.ResetTime();
|
||||
date.SetHour(0);
|
||||
|
@ -50,8 +50,7 @@ protected:
|
||||
Day *dummyday;
|
||||
};
|
||||
|
||||
const wxEventType wxEVT_REFRESH_DAILY = wxNewEventType();
|
||||
|
||||
extern const wxEventType wxEVT_REFRESH_DAILY;
|
||||
class Daily:public DailyPanel
|
||||
{
|
||||
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)
|
||||
:m_width(width),m_height(height)
|
||||
pBuffer::pBuffer(int width, int height,wxGLContext * gc)
|
||||
:m_gc(gc),m_width(width),m_height(height)
|
||||
{
|
||||
}
|
||||
pBuffer::~pBuffer()
|
||||
@ -54,10 +55,17 @@ wxBitmap *pBuffer::Snapshot(int width, int height)
|
||||
wxBitmap *bmp=new wxBitmap(image);
|
||||
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)
|
||||
:pBuffer()
|
||||
FBO::FBO(int width, int height,wxGLContext * gc)
|
||||
:pBuffer(gc)
|
||||
{
|
||||
//wxGLContext a((wxGLCanvas *)NULL,(wxGLContext *)NULL);
|
||||
int m=MAX(width,height);
|
||||
@ -122,14 +130,14 @@ FBO::~FBO()
|
||||
if (m_color_buffer)
|
||||
glDeleteRenderbuffersEXT(1, &colorbuffer);
|
||||
}
|
||||
void FBO::UseBuffer(bool b)
|
||||
void FBO::SelectBuffer()
|
||||
{
|
||||
if (b) {
|
||||
// glBindTexture(GL_TEXTURE_2D, img);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
} else {
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -173,8 +181,8 @@ wxBitmap *FBO::Snapshot(int width,int height)
|
||||
#endif
|
||||
|
||||
|
||||
pBufferWGL::pBufferWGL(int width, int height,wxGLCanvas * gc)
|
||||
:m_texture(0)
|
||||
pBufferWGL::pBufferWGL(int width, int height,wxGLContext * gc)
|
||||
:pBuffer(width,height,gc),m_texture(0)
|
||||
{
|
||||
|
||||
hGlRc=0;
|
||||
@ -194,10 +202,10 @@ pBufferWGL::pBufferWGL(int width, int height,wxGLCanvas * gc)
|
||||
j=1 << i;
|
||||
if (j >= ms) break;
|
||||
}
|
||||
j <<= 2;
|
||||
//j <<= 2;
|
||||
//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_height=j;
|
||||
|
||||
@ -303,13 +311,13 @@ pBufferWGL::~pBufferWGL()
|
||||
if (hBuffer) wglReleasePbufferDCARB(hBuffer, hdc);
|
||||
if (hBuffer) wglDestroyPbufferARB(hBuffer);
|
||||
}
|
||||
void pBufferWGL::UseBuffer(bool b)
|
||||
void pBufferWGL::SelectBuffer()
|
||||
{
|
||||
if (b) {
|
||||
wglMakeCurrent(hdc, hGlRc);
|
||||
} else {
|
||||
wglMakeCurrent(saveHdc, saveHglrc);
|
||||
}
|
||||
wglMakeCurrent(hdc, hGlRc);
|
||||
}
|
||||
void pBufferWGL::SelectContext(wxGLCanvas * glc)
|
||||
{
|
||||
wglMakeCurrent(saveHdc, saveHglrc);
|
||||
}
|
||||
|
||||
bool pBufferWGL::InitGLStuff()
|
||||
@ -367,12 +375,11 @@ bool pBufferWGL::InitGLStuff()
|
||||
|
||||
GLXContext real_shared_context=NULL;
|
||||
|
||||
|
||||
pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
:pBuffer()
|
||||
pBufferGLX::pBufferGLX(int width, int height,wxGLContext * gc)
|
||||
:pBuffer(width,height,gc)
|
||||
{
|
||||
|
||||
int ms=MAX(width,height);
|
||||
/*int ms=MAX(width,height);
|
||||
int j;
|
||||
for (int i=4;i<32;i++) { // min size 16x16.. probably a usless size.
|
||||
j=1 << i;
|
||||
@ -381,7 +388,13 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
j <<= 2;
|
||||
|
||||
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[]={
|
||||
GLX_PBUFFER_WIDTH,m_width,
|
||||
@ -389,12 +402,8 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
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)
|
||||
display=wxGetX11Display();
|
||||
fbc = GetGLXFBConfig(); // wxGLCanvas call
|
||||
@ -403,7 +412,7 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
|
||||
#else */
|
||||
display=(Display *)wxGetDisplay();
|
||||
int doubleBufferAttributess[] = {
|
||||
int fb_attrib[] = {
|
||||
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
@ -412,11 +421,19 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
GLX_BLUE_SIZE, 8,
|
||||
None
|
||||
};
|
||||
fbc=glXChooseFBConfig(display, DefaultScreen(display), doubleBufferAttributess, &ret);
|
||||
pBuffer=glXCreatePbuffer(display, *fbc, attrib );
|
||||
//#if wxCHECK_VERSION(2,9,0)
|
||||
//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
|
||||
|
||||
if (pBuffer == 0) {
|
||||
hBuffer=glXCreatePbuffer(display, *fbc, attrib );
|
||||
//#endif
|
||||
|
||||
if (hBuffer == 0) {
|
||||
wxLogError(wxT("pBuffer not availble"));
|
||||
}
|
||||
|
||||
@ -435,34 +452,29 @@ pBufferGLX::pBufferGLX(int width, int height,wxGLCanvas * gc)
|
||||
wxLogError(wxT("Context not availble"));
|
||||
}
|
||||
|
||||
//#if !wxCHECK_VERSION(2,9,0)
|
||||
#if !wxCHECK_VERSION(2,9,0)
|
||||
XFree(fbc);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
glXMakeCurrent(display,pBuffer,m_shared);
|
||||
glXMakeCurrent(display,hBuffer,m_shared);
|
||||
|
||||
//UseBuffer(true);
|
||||
}
|
||||
pBufferGLX::~pBufferGLX()
|
||||
{
|
||||
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,pBuffer,m_shared)!=True) {
|
||||
wxLogError(wxT("Couldn't make pBuffer current"));
|
||||
}
|
||||
} else {
|
||||
|
||||
// to be honest.. i'm not sure yet.. wx stupidly keeps the needed variables private
|
||||
if (glXMakeCurrent(display,hBuffer,m_shared)!=True) {
|
||||
wxLogError(wxT("Couldn't make pBuffer current"));
|
||||
}
|
||||
}
|
||||
#elif defined(__DARWIN__) || defined(__WXMAC__)
|
||||
|
||||
pBufferAGL::pBufferAGL(int width, int height,wxGLCanvas * gc)
|
||||
:pBuffer()
|
||||
pBufferAGL::pBufferAGL(int width, int height,wxGLContext * gc)
|
||||
:pBuffer(gc)
|
||||
{
|
||||
m_width=width;
|
||||
m_height=height;
|
||||
|
@ -31,6 +31,7 @@ License: GPL
|
||||
#include <Carbon/Carbon.h>
|
||||
#elif defined(__WXCOCOA__)
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -52,28 +53,33 @@ public:
|
||||
GLException(wxString s=wxT("Lazy Programmer forgot to specify error")) { wxLogError(wxT("GLException: ")+s); };
|
||||
};
|
||||
|
||||
|
||||
|
||||
class pBuffer {
|
||||
public:
|
||||
pBuffer();
|
||||
pBuffer(int width, int height,wxGLCanvas * gc);
|
||||
pBuffer(wxGLContext * gc);
|
||||
pBuffer(int width, int height,wxGLContext * gc);
|
||||
virtual ~pBuffer();
|
||||
virtual void UseBuffer(bool b) {};
|
||||
|
||||
int Width() { return m_width; };
|
||||
int Height() { return m_height; };
|
||||
|
||||
virtual void SelectContext(wxGLCanvas * gc);
|
||||
virtual void SelectBuffer()=0;
|
||||
|
||||
virtual wxBitmap *Snapshot(int width, int height);
|
||||
|
||||
protected:
|
||||
int m_width;
|
||||
int m_height;
|
||||
wxGLContext * m_gc;
|
||||
};
|
||||
|
||||
class FBO:public pBuffer
|
||||
{
|
||||
public:
|
||||
FBO(int width, int height,wxGLCanvas * gc);
|
||||
FBO(int width, int height,wxGLContext * gc);
|
||||
virtual ~FBO();
|
||||
virtual void UseBuffer(bool b);
|
||||
virtual void SelectBuffer();
|
||||
virtual void SelectContext(wxGLCanvas * gc);
|
||||
virtual wxBitmap *Snapshot(int width, int height);
|
||||
protected:
|
||||
GLuint depthbuffer,colorbuffer;
|
||||
@ -88,9 +94,10 @@ protected:
|
||||
class pBufferWGL:public pBuffer
|
||||
{
|
||||
public:
|
||||
pBufferWGL(int width, int height,wxGLCanvas * gc);
|
||||
pBufferWGL(int width, int height,wxGLContext * gc);
|
||||
virtual ~pBufferWGL();
|
||||
virtual void UseBuffer(bool b);
|
||||
virtual void SelectBuffer();
|
||||
virtual void SelectContext(wxGLCanvas * gc);
|
||||
protected:
|
||||
|
||||
bool InitGLStuff();
|
||||
@ -113,13 +120,13 @@ extern GLXContext real_shared_context;
|
||||
class pBufferGLX:public pBuffer
|
||||
{
|
||||
public:
|
||||
pBufferGLX(int width, int height,wxGLCanvas * gc);
|
||||
pBufferGLX(int width, int height,wxGLContext * gc);
|
||||
virtual ~pBufferGLX();
|
||||
virtual void UseBuffer(bool b);
|
||||
virtual void SelectBuffer();
|
||||
protected:
|
||||
|
||||
Display *display;
|
||||
GLXPbuffer pBuffer;
|
||||
GLXPbuffer hBuffer;
|
||||
GLXContext m_context;
|
||||
GLXContext m_shared;
|
||||
};
|
||||
@ -128,9 +135,10 @@ protected:
|
||||
class pBufferAGL:public pBuffer
|
||||
{
|
||||
public:
|
||||
pBufferAGL(int width, int height,wxGLCanvas * gc);
|
||||
pBufferAGL(int width, int height,wxGLContext * gc);
|
||||
virtual ~pBufferAGL();
|
||||
virtual void UseBuffer(bool b);
|
||||
virtual void SelectBuffer();
|
||||
virtual void SelectContext(wxGLCanvas * gc);
|
||||
protected:
|
||||
/* AGLPixelFormat pixelFormat;
|
||||
AGLPbuffer pbuffer;
|
||||
|
@ -62,20 +62,22 @@ TextureFont *bigfont=NULL,*zfont=NULL;
|
||||
VertexBuffer *vbuffer=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.
|
||||
void GraphInit()
|
||||
{
|
||||
if (!graph_init) {
|
||||
#if defined(__WXMSW__)
|
||||
static bool glewinit_called=false;
|
||||
if (!glewinit_called) {
|
||||
glewInit(); // Dont forget this nasty little sucker.. :)
|
||||
glewinit_called=true;
|
||||
}
|
||||
static bool glewinit_called=false;
|
||||
if (!glewinit_called) {
|
||||
glewInit(); // Dont forget this nasty little sucker.. :)
|
||||
glewinit_called=true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gfont_init) {
|
||||
wxString glvendor=wxString((char *)glGetString(GL_VENDOR),wxConvUTF8);
|
||||
wxString glrenderer=wxString((char *)glGetString(GL_RENDERER),wxConvUTF8);
|
||||
wxString glversion=wxString((char *)glGetString(GL_VERSION),wxConvUTF8);
|
||||
@ -105,16 +107,16 @@ void GraphInit()
|
||||
}
|
||||
f.Close();
|
||||
}
|
||||
gfont_init=true;
|
||||
graph_init=true;
|
||||
}
|
||||
}
|
||||
void GraphDone()
|
||||
{
|
||||
if (gfont_init) {
|
||||
if (graph_init) {
|
||||
delete font_manager;
|
||||
// delete vbuffer;
|
||||
delete markup;
|
||||
gfont_init=false;
|
||||
graph_init=false;
|
||||
}
|
||||
if (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;
|
||||
GetTextExtent(text, w, h, font);
|
||||
|
||||
//glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha());
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(floor(x),floor(y),0);
|
||||
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);
|
||||
glEnd();
|
||||
|
||||
// glEnable(GL_TEXTURE_2D);
|
||||
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)
|
||||
: 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_title=title;
|
||||
@ -386,8 +386,10 @@ gGraphWindow::gGraphWindow(wxWindow *parent, wxWindowID id,const wxString & titl
|
||||
ti=wxDateTime::Now();
|
||||
gtitle=foobar=xaxis=yaxis=NULL;
|
||||
|
||||
|
||||
if (!shared_context) {
|
||||
|
||||
int q=0;
|
||||
#if defined(__DARWIN__) && !wxCHECK_VERSION(2,9,0)
|
||||
// Screw you apple..
|
||||
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);
|
||||
|
||||
// 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);
|
||||
#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;
|
||||
if (!title.IsEmpty()) {
|
||||
AddLayer(new gGraphTitle(title,wxVERTICAL));
|
||||
@ -422,7 +415,10 @@ gGraphWindow::~gGraphWindow()
|
||||
{
|
||||
for (list<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) delete (*l);
|
||||
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)
|
||||
{
|
||||
if (!graph_init) {
|
||||
// Damn you WX Update the
|
||||
return NULL;
|
||||
}
|
||||
wxBitmap *bmp;
|
||||
Update();
|
||||
//Update();
|
||||
|
||||
if (!pbuffer) {
|
||||
wxSize res=wxGetDisplaySize(); // Not entirely sure if this is the limit..
|
||||
try {
|
||||
#if defined(__WXMSW__)
|
||||
pbuffer=new pBufferWGL(width,height,this);
|
||||
pbuffer=new pBufferWGL(res.GetWidth(),res.GetHeight(),shared_context);
|
||||
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
|
||||
// Do nothing and load the FBO
|
||||
throw GLException(wxT("Macintrash"));
|
||||
//pbuffer=new pBufferAGL(width,height);
|
||||
#elif defined(__UNIX__)
|
||||
pbuffer=new pBufferGLX(width,height,this);
|
||||
pbuffer=new pBufferGLX(res.GetWidth(),res.GetHeight(),shared_context);
|
||||
#endif
|
||||
|
||||
} 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"));
|
||||
pbuffer=NULL;
|
||||
}
|
||||
}
|
||||
if (!pbuffer) {
|
||||
try {
|
||||
// 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.
|
||||
// Trickier than it sounds, and I didn't want to kludge
|
||||
|
||||
wxSize res=wxGetDisplaySize(); // Not entirely sure if this is the limit..
|
||||
pbuffer=new FBO(res.GetWidth(),res.GetHeight(),this);
|
||||
} catch(GLException e) {
|
||||
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
|
||||
pbuffer=NULL;
|
||||
return NULL;
|
||||
if (!pbuffer) {
|
||||
try {
|
||||
// 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.
|
||||
// Trickier than it sounds, and I didn't want to kludge
|
||||
pbuffer=new FBO(res.GetWidth(),res.GetHeight(),shared_context);
|
||||
} catch(GLException e) {
|
||||
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
|
||||
pbuffer=NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pbuffer) {
|
||||
pbuffer->UseBuffer(true);
|
||||
pbuffer->SelectBuffer();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Can't use font's in multiple contexts
|
||||
Render(width,height);
|
||||
|
||||
bmp=pbuffer->Snapshot(width,height);
|
||||
glFlush();
|
||||
pbuffer->UseBuffer(false);
|
||||
pbuffer->SelectContext(this);
|
||||
} else bmp=NULL;
|
||||
|
||||
|
||||
@ -1093,10 +1093,25 @@ void gGraphWindow::Render(float scrX, float scrY)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
bool do_refresh_daily=false;
|
||||
extern const wxEventType wxEVT_REFRESH_DAILY;
|
||||
void gGraphWindow::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
// 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__)
|
||||
// wxAutoBufferedPaintDC dc(this);
|
||||
//#else
|
||||
@ -1113,6 +1128,9 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
|
||||
shared_context->SetCurrent(*this);
|
||||
#endif
|
||||
|
||||
GraphInit(); // Glew & Font init
|
||||
|
||||
|
||||
//#endif
|
||||
|
||||
#if !defined(__WXMAC__) && defined (__UNIX__)
|
||||
@ -1133,7 +1151,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
|
||||
|
||||
SwapBuffers(); // Dump to screen.
|
||||
|
||||
event.Skip();
|
||||
//event.Skip();
|
||||
}
|
||||
void gGraphWindow::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
@ -1733,6 +1751,8 @@ void gFooBar::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
glVertex2f(start_px+py,h);
|
||||
glEnd();
|
||||
|
||||
glLineWidth(1);
|
||||
|
||||
if ((m_funkbar)) { // && ((w.min_x>w.rmin_x) || (w.max_x<w.rmax_x))) {
|
||||
glColor4f(.8,.8,.8,.6);
|
||||
glEnable(GL_BLEND);
|
||||
@ -1795,6 +1815,9 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
wxRect rect;
|
||||
wxDirection dir;
|
||||
|
||||
glLineWidth(1);
|
||||
|
||||
// glDisable(GL_LINE_SMOOTH);
|
||||
for (int i=0;i<data->np[0];i++) {
|
||||
t1=floor(px);
|
||||
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);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
|
||||
}
|
||||
zpx=px;
|
||||
int i,idx=-1;
|
||||
@ -1974,8 +1996,8 @@ void gBarChart::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
}
|
||||
}
|
||||
if (antialias) {
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
if (draw_xticks_instead) {
|
||||
|
@ -30,6 +30,8 @@ extern wxColor *wxLIGHT_YELLOW;
|
||||
extern wxColor *wxDARK_GREEN;
|
||||
extern wxColor *wxDARK_GREY;
|
||||
|
||||
extern bool graph_init;
|
||||
|
||||
//#define MIN(a,b) (((a)<(b)) ? (a) : (b));
|
||||
//#define MAX(a,b) (((a)<(b)) ? (b) : (a));
|
||||
|
||||
|
@ -16,14 +16,14 @@ namespace AutoVersion{
|
||||
//Standard Version Type
|
||||
static const long _MAJOR = 0;
|
||||
static const long _MINOR = 7;
|
||||
static const long _BUILD = 6650;
|
||||
static const long _REVISION = 19612;
|
||||
static const long _BUILD = 6746;
|
||||
static const long _REVISION = 20082;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
static const long _BUILDS_COUNT = 8104;
|
||||
#define _RC_FILEVERSION 0,7,6650,19612
|
||||
#define _RC_FILEVERSION_STRING "0, 7, 6650, 19612\0"
|
||||
static const char _FULLVERSION_STRING[] = "0.7.6650.19612";
|
||||
static const long _BUILDS_COUNT = 8334;
|
||||
#define _RC_FILEVERSION 0,7,6746,20082
|
||||
#define _RC_FILEVERSION_STRING "0, 7, 6746, 20082\0"
|
||||
static const char _FULLVERSION_STRING[] = "0.7.6746.20082";
|
||||
|
||||
//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