diff --git a/Projects/CodeBlocks/SleepyHead.cbp b/Projects/CodeBlocks/SleepyHead.cbp
index a0c7a8e7..5d838a35 100644
--- a/Projects/CodeBlocks/SleepyHead.cbp
+++ b/Projects/CodeBlocks/SleepyHead.cbp
@@ -14,9 +14,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -27,11 +47,14 @@
+
+
+
@@ -47,7 +70,6 @@
-
@@ -60,62 +82,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
-
-
+
+
-
-
-
-
-
diff --git a/Projects/CodeBlocks/SleepyHead.depend b/Projects/CodeBlocks/SleepyHead.depend
index 4294f0e0..568e3c4c 100644
--- a/Projects/CodeBlocks/SleepyHead.depend
+++ b/Projects/CodeBlocks/SleepyHead.depend
@@ -8240,7 +8240,7 @@
-1308031885 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadApp.cpp
+1308079880 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadApp.cpp
"wx_pch.h"
@@ -8312,7 +8312,7 @@
1308026543 D
-1308044876 /home/mark/projects/git/sleepyhead/src/version.h
+1308080044 /home/mark/projects/git/sleepyhead/src/version.h
1308003040 ent of cb2ab33... Linux wx2.8 & wx2.9 builds fixed
@@ -8364,7 +8364,7 @@
"sleeplib/profiles.h"
"sleeplib/machine_loader.h"
-1308044596 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
+1308073105 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
@@ -10870,7 +10870,7 @@
"wx/msw/wrapwin.h"
-1308041947 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.9/wx/stdpaths.h
+1308044093 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.9/wx/stdpaths.h
"wx/defs.h"
"wx/string.h"
"wx/filefn.h"
@@ -10880,7 +10880,7 @@
"wx/unix/stdpaths.h"
"wx/palmos/stdpaths.h"
-1308041948 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.9/wx/msw/stdpaths.h
+1308044094 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.9/wx/msw/stdpaths.h
1308044096 /opt/mingw/usr/i686-pc-mingw32/include/wx-2.9/wx/aboutdlg.h
"wx/defs.h"
@@ -11043,10 +11043,9 @@
"texture-font.h"
-1308009682 source:/home/mark/projects/git/sleepyhead/src/libs/freetype-gl/texture-glyph.cpp
+1308044876 source:/home/mark/projects/git/sleepyhead/src/libs/freetype-gl/texture-glyph.cpp
-
"texture-glyph.h"
1308032101 source:/home/mark/projects/git/sleepyhead/src/libs/freetype-gl/vertex-buffer.cpp
diff --git a/Projects/CodeBlocks/SleepyHead.layout b/Projects/CodeBlocks/SleepyHead.layout
index a2cb64f7..bb3ad24a 100644
--- a/Projects/CodeBlocks/SleepyHead.layout
+++ b/Projects/CodeBlocks/SleepyHead.layout
@@ -1,14 +1,14 @@
-
-
-
+
+
+
-
+
@@ -20,10 +20,10 @@
-
+
-
+
@@ -35,31 +35,31 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
diff --git a/src/SleepyHeadApp.cpp b/src/SleepyHeadApp.cpp
index 7344828d..8d103d3f 100644
--- a/src/SleepyHeadApp.cpp
+++ b/src/SleepyHeadApp.cpp
@@ -6,7 +6,7 @@
* Copyright: Mark Watkins (http://sourceforge.net/projects/sleepyhead/)
* License: GPL
**************************************************************/
-
+
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
diff --git a/src/graphs/graph.cpp b/src/graphs/graph.cpp
index 87ccc9af..480079ee 100644
--- a/src/graphs/graph.cpp
+++ b/src/graphs/graph.cpp
@@ -133,7 +133,7 @@ void DrawText2(wxString text, float x, float y,TextureFont *font)
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_TEXTURE_2D );
glColor4f(1,1,1,1);
- vbuffer->Render(GL_TRIANGLES, (char *)"vtc" );
+// vbuffer->Render(GL_TRIANGLES, (char *)"vtc" );
glDisable(GL_BLEND);
}
@@ -806,80 +806,121 @@ void gGraphWindow::SetMargins(float top, float right, float bottom, float left)
#if !defined(__WXMAC__) && defined (__UNIX__)
GLXContext real_shared_context=0;
+
#endif
+
+
+
wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
{
//pBuffers are evil.. but I need to use them here.
#if defined(__WXMSW__)
- /*#define MAX_ATTRIBS 8
- HDC hDC = wglGetCurrentDC();
- // Get ready to query for a suitable pixel format that meets our minimum requirements.
+ int mv=MAX(width,height);
+ // convert to nearest binary power of two.
- int iAttributes[2*MAX_ATTRIBS];
- float fAttributes[2*MAX_ATTRIBS];
- int nfAttribs = 0;
- int niAttribs = 0;
- // Attribute arrays must be "0" terminated - for simplicity, first
+ int pbwidth=1024;
+ int pbheight=pbwidth; // Windows sucks ass.
- // just zero-out the array then fill from left to right.
+ unsigned int texture=0;
- for (i=0; i<2*MAX_ATTRIBS; i++ ){
- iAttributes[i] = 0;
- fAttributes[i] = 0;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, 4, pbwidth, pbheight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+ HDC saveHdc = wglGetCurrentDC();
+ HGLRC saveHglrc = wglGetCurrentContext();
+
+ wxLogError(wxT("Foo1"));
+
+ int pixelFormats;
+ int intAttrs[32] ={
+ WGL_RED_BITS_ARB,8,
+ WGL_GREEN_BITS_ARB,8,
+ WGL_BLUE_BITS_ARB,8,
+ WGL_ALPHA_BITS_ARB,8,
+ WGL_DRAW_TO_PBUFFER_ARB, GL_TRUE,
+ WGL_BIND_TO_TEXTURE_RGBA_ARB, GL_TRUE,
+ WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
+ WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
+ WGL_DOUBLE_BUFFER_ARB,GL_FALSE,
+ 0
+ }; // 0 terminate the list
+
+ unsigned int numFormats = 0;
+
+ wxLogError(wxT("Foo2"));
+ if (!wglChoosePixelFormatARB( saveHdc, intAttrs, NULL, 1, &pixelFormats, &numFormats)) {
+
+ wxLogError(wxT("WGL: pbuffer creation error: Couldn't find a suitable pixel format.\n"));
+ return &wxNullBitmap;
}
- // Since we are trying to create a pbuffer, the pixel format we
+ wxLogError(wxT("Foo3"));
+ if (numFormats==0) {
+ return &wxNullBitmap;
+ }
+ wxLogError(wxT("Foo3"));
- //request (and subsequently use) must be "p-buffer capable".
+ const int attributes[]= {
+ WGL_TEXTURE_FORMAT_ARB,
+ WGL_TEXTURE_RGBA_ARB, // p-buffer will have RBA texture format
+ WGL_TEXTURE_TARGET_ARB,
+ WGL_TEXTURE_2D_ARB,
+ 0
+ }; // Of texture target will be GL_TEXTURE_2D
- iAttributes[2*niAttribs]=WGL_DRAW_TO_PBUFFER_ARB;
- iAttributes[2*niAttribs+1]=true;
- niAttribs++;
- // We require a minimum of 24-bit depth.
+ //wglCreatePbufferARB(hDC, pixelFormats, pbwidth, pbheight, attributes);
+ HPBUFFERARB hBuffer=wglCreatePbufferARB(saveHdc, pixelFormats, pbwidth, pbheight, attributes );
+ wxLogError(wxT("Foo4"));
- iAttributes[2*niAttribs ]=WGL_DEPTH_BITS_ARB;
- iAttributes[2*niAttribs+1]=24;
- niAttribs++;
- // We require a minimum of 8-bits for each R, G, B, and A.
+ HDC hdc=wglGetPbufferDCARB( hBuffer );
+ wxLogError(wxT("Foo5"));
- iAttributes[2*niAttribs]=WGL_RED_BITS_ARB;
- iAttributes[2*niAttribs+1]=8;
- niAttribs++;
- iAttributes[2*niAttribs]=WGL_GREEN_BITS_ARB;
- iAttributes[2*niAttribs+1]=8;
- niAttribs++;
- iAttributes[2*niAttribs]=WGL_BLUE_BITS_ARB;
- iAttributes[2*niAttribs+1]=8;
- niAttribs++;
- iAttributes[2*niAttribs]=WGL_ALPHA_BITS_ARB;
- iAttributes[2*niAttribs+1]=8;
- niAttribs++;
- // Now obtain a list of pixel formats that meet these minimum requirements.
+ HGLRC hGlRc=wglCreateContext(hdc);
+ wxLogError(wxT("Foo6"));
- int pformat;
- unsigned int nformats;
- if(!wglChoosePixelFormatARB( hDC, iAttributes, fAttributes, 1, &pformat, &nformats)){
- printf("pbuffer creation error: Couldn't find a suitable pixel format.\n" );
- return false;
- }
- for (i=0; i<2*MAX_ATTRIBS; i++ )iAttributes[i] = 0;
+ //printf("PBuffer size: %d x %d\n",w,h);
+ int w,h;
+ wglQueryPbufferARB(hBuffer, WGL_PBUFFER_WIDTH_ARB, &w);
+ wglQueryPbufferARB(hBuffer, WGL_PBUFFER_HEIGHT_ARB, &h);
+ wxLogError(wxT("Foo7"));
- HPBUFFERARB g_hPBuffer=wglCreatePbufferARB( hDC, pformat, PBUFFERSIZE, PBUFFERSIZE, iAttributes );
- g_hPBufDC=wglGetPbufferDCARB( g_hPBuffer );
+ wglMakeCurrent(hdc,hGlRc);
- int w,h;
- wglQueryPbufferARB( g_hPBuffer, WGL_PBUFFER_WIDTH_ARB, &w );
- wglQueryPbufferARB( g_hPBuffer, WGL_PBUFFER_HEIGHT_ARB, &h );
- printf("PBuffer size: %d x %d\n",w,h);
+ glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // enable transparency
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, width, height, 0, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ glClearColor(0,0,0,1);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+
+ // switch back to the screen context
+ wglMakeCurrent(saveHdc, saveHglrc);
+
+ // So we can share the main context
+ wglShareLists(saveHglrc, hGlRc);
+
+ // Jump back to pBuffer for rendering
+ wglMakeCurrent(hdc, hGlRc);
- g_hPBufRC=wglCreateContext(g_hPBufDC);
-*/
// WGL pBuffer Implementation
- return &wxNullBitmap;
+ //return &wxNullBitmap;
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
return &wxNullBitmap;
@@ -970,7 +1011,12 @@ wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
wxBitmap *bmp=new wxBitmap(image);
glFlush();
-#if !defined(__WXMAC__) && defined (__UNIX__)
+
+#if defined(__WXMSW__)
+ wglDeleteContext(hGlRc);
+ wglReleasePbufferDCARB(hBuffer, hdc);
+ wglDestroyPbufferARB(hBuffer);
+#elif !defined(__WXMAC__) && defined (__UNIX__)
if (gx) glXDestroyContext(display,gx);
glXDestroyPbuffer(display, pBuffer);
#endif
diff --git a/src/version.h b/src/version.h
index 0aa7675f..412944b4 100644
--- a/src/version.h
+++ b/src/version.h
@@ -4,7 +4,7 @@
namespace AutoVersion{
//Date Version Types
- static const char _DATE[] = "14";
+ static const char _DATE[] = "15";
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 = 5717;
- static const long _REVISION = 14559;
+ static const long _BUILD = 5740;
+ static const long _REVISION = 14700;
//Miscellaneous Version Types
- static const long _BUILDS_COUNT = 6004;
- #define _RC_FILEVERSION 0,7,5717,14559
- #define _RC_FILEVERSION_STRING "0, 7, 5717, 14559\0"
- static const char _FULLVERSION_STRING[] = "0.7.5717.14559";
+ static const long _BUILDS_COUNT = 6058;
+ #define _RC_FILEVERSION 0,7,5740,14700
+ #define _RC_FILEVERSION_STRING "0, 7, 5740, 14700\0"
+ static const char _FULLVERSION_STRING[] = "0.7.5740.14700";
//These values are to keep track of your versioning state, don't modify them.
static const long _BUILD_HISTORY = 0;