• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Charting 64-bit

Started by Patrice Terrier, October 29, 2013, 07:33:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

This project is to test the 64-bit version of the GDImage WGL_CreateWindow API.

The purpose of this graphic control is to provide a native GPU container, able to support advanced OpenGL extensions to produce state of the art antialiasing and amazing glass effects.

The output offers the same rendering quality in 3D than in 2D.

The main advantage of OpenGL is that it would work on any OS platform, this is the reason why it has my preference over DirectX and D2D, and the code is always the same what ever the language used. :)

The size of the resulting 64-bit EXE is rather small, only 91 Kb (thanks to the SDK coding style)  ;D

The attached C++ project has been built with VS2010, the binary EXE and graphic resources are within the \Release subfolder.

Added:
Forget to say that you need to have a good graphic card to run the OpenGL extensions, this project has been tested on a nVIDIA GEFORCE GT 650M with 2GB.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

Patrice,
The project converted to VS12 Express no problem and after I commented out a few library #pragmas that weren't needed and changed the path to the GDImage64.Lib it built and ran fine.
  Good stuff.

James

Patrice Terrier

James--

Thanks for the feedback.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Aslan Babakhanov

Nice demo indeed.
On my laptop dell e6420 with W7 64 bit, it's using about 50MB of memory.
The chart is moving smoothly when you zooming to the max.

James C. Fuller

Patrice,
  No matter how pretty you make it I still dislike C++ so .... :)
http://bc9.bcxbasic.com/bc9ChartSpec.htm

I do advocate the use of C++ for anyone going forward but for an old man like me who has been using BASIC for almost 40 years: I don't have enough brain cells left to retain .... where was I ??

The attachment includes all the files incuding the 64bit unicode app created with bc9Basic and VS12.

Again great stuff Patrice

James

Patrice Terrier

James--

I am curious to know how BC9 would translate this piece of code to C++


si.cbSize = SIZEOF(si)
si.fMask  = %SIF_ALL
CALL GetScrollInfo(hParent, %SB_VERT, si)
CALL GetScrollBarInfo(hParent, %OBJID_VSCROLL, sbi)
dxy1 = sbi.rcScrollBar.nTop + sbi.dxyLineButton
dxy2 = sbi.rcScrollBar.nBottom - sbi.dxyLineButton

dxy = (MIN&(MAX&(p.Y, dxy1), dxy2) - dxy1) * ((si.nMax - si.nMin) / (dxy2 - dxy1))


dxy, dxy1, dxy2 are LONG
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jim Dunn

#6
EDITED: to just show the snippet

I just ran BC9 on your code, got this:

static PCHAR   *g_argv;
static int     g_argc;
static long    dxy;
static long    dxy1;
static long    dxy2;

double MAX (double a, double b)
{
  if(a>b)
  return a;
  return b;
}

double MIN (double a, double b)
{
  if(a<b)
  return a;
  return b;
}

int main(int argc, char *argv[])
{
g_argc = argc;
g_argv = argv;
si.cbSize= sizeof( si);
si.fMask=SIF_ALL;
GetScrollInfo(hParent,SB_VERT,si);
GetScrollBarInfo(hParent,OBJID_VSCROLL,sbi);
dxy1= sbi.rcScrollBar.nTop+ sbi.dxyLineButton;
dxy2= sbi.rcScrollBar.nBottom- sbi.dxyLineButton;
dxy=( MIN&( MAX&( p.Y, dxy1), dxy2)- dxy1)*(( si.nMax- si.nMin)/( dxy2- dxy1));
return 0;
}

Patrice Terrier

Here is how it should be translated to C++
dxy = (min(max(p.x, dxy1), dxy2) - dxy1) * ((si.nMax - si.nMin) / (float) ( dxy2 - dxy1));
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

I also need to add C++ min/max instead of the BCX library MIN/MAX double.

James

James C. Fuller

Patrice,
  What is the reason for your STRL$ function?
  to_wstring seems to do the same thing on all numeric types.

  wcscpy_s(zTxt, (WCHAR*) STRL(nI * 10).c_str()) To
    wcscpy_s(zTxt, to_wstring(nI * 10).c_str())

  ws += STRL((long) (rChartZoom * 100)) To
    ws += to_wstring(rChartZoom * 100)



James

Patrice Terrier

#10
James

Now i remember why i wrote STRL$, it works with VS2010, while to_wstring doesn't (only since C++11).  :(

Also working directly with WCHAR means smaller overhead.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

Patrice,
  When are you going to upgrade to Visual Studio 2013?
It states you can install it side-by-side with any other version.

What version cl do you have? (_MSC_VER)
My Win7 SDK version is 1600 While VS12 (aka Visual Studio 2013) is 1800.
I assume Visual Studio 2012 is 1700?

James

James C. Fuller

Patrice,
  This should work for all  using sstr(N) for string and wstr(N) for wstring.

James


#if _MSC_VER < 1800
template <typename T>
string sstr ( T Number )
{
stringstream ss;
ss << Number;
return ss.str();
}

template <typename T>
wstring wstr ( T Number )
{
wstringstream wss;
wss << Number;
return wss.str();
}
#else
#define sstr(x) to_string(x)
#define wstr(x) to_wstring(x)
#endif


Patrice Terrier

QuoteWhen are you going to upgrade to Visual Studio 2013?
I am waiting for the official release of the Pro version.
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com