|
Post by Nicky Peter Hollyoake on Nov 12, 2008 9:47:46 GMT -5
OK, none of this is my work, all I did was convert it. All thanks go to Empyrion Martyr. Download pluginThe test is ran by what Empyrion Martyr done. BUGS * When loading the plugin at the side it will say "Maths plugin v1.0" forgot to change it.  * it can only be run on a 800x600 resolution because I didn't know how to get the window width/height from within the plugin (maybe someone can help on that?). * Some ain't proper C++ like I used "const char", etc. This is due to it wouldn't let me use the "strlen" function, etc with "string" (once again, maybe someone got a solution?). * You have to use "LoadFont(tex)" to load the font at the start because I didn't know how to load textures with C++ (even when I do figure it out, this could be useful for changing fonts if anymore is ever made). And all the other problems which Empyrion Martyr mentioned before (slowness).
|
|
|
Post by matthew on Nov 12, 2008 10:09:29 GMT -5
As you already know, strlen is C, if you want to calculate the length of a string in C++; the following program will show you how. Look here for more info.
// Compile with g++ -Wall -W -Werror StringLength.cpp -o StringLength.exe
#include <iostream> #include <string>
int main() { std::string phrase ("Whats the length?");
std::cout << "Length of phrase is " << phrase.length() << " characters." << std::endl;
// Wait for keypress std::cin.get(); }
|
|
|
Post by Nicky Peter Hollyoake on Nov 12, 2008 10:13:40 GMT -5
Thanks Matthew I'll upload the fix version when I figure out how to get the width/height of the window.
|
|
|
Post by matthew on Nov 12, 2008 11:13:20 GMT -5
I'm been browsing through the Basic4GL source code again & I've found the following information in the file, TomOpenGLBasicLib.cpp. //////////////////////////////////////////////////////////////////////////////// // Interface for DLLs
class WindowAdapter : public IB4GLOpenGLWindow { public: virtual int DLLFUNC Width(); virtual int DLLFUNC Height(); virtual int DLLFUNC BPP(); virtual bool DLLFUNC Fullscreen(); virtual void DLLFUNC SwapBuffers(); virtual const char *DLLFUNC Title(); } windowAdapter;
int DLLFUNC WindowAdapter::Width() { return appWindow->Width(); } int DLLFUNC WindowAdapter::Height() { return appWindow->Height(); } int DLLFUNC WindowAdapter::BPP() { return appWindow->Bpp(); } bool DLLFUNC WindowAdapter::Fullscreen() { return appWindow->FullScreen(); } void DLLFUNC WindowAdapter::SwapBuffers() { appWindow->SwapBuffers(); } const char *DLLFUNC WindowAdapter::Title() { return appWindow->Title().c_str(); }
It looks as if it's a Class holding all the window settings but I haven't figured out how to gain access to the information yet. 
|
|
|
Post by DJLinux on Nov 12, 2008 12:33:08 GMT -5
It looks as if it's a Class holding all the window settings but I haven't figured out how to gain access to the information yet.  Hello matthew can be you must fetch the interface "IB4GLOpenGLWindow" first same as you would fetch the interface "IB4GLCompiler" etc. Joshy EDIT:i have made a short test at seams to work for example i got the width and height from interface "IB4GLOpenGLWindow" but BPP() returns every time 0 here and the 4 first chars fom Title() are corupt (i tested both ways, inside the IDE and as compiled exe) to fetch the right version of the interface "IB4GLOpenGLWindow" i miss the #defines of: IB4GLOPENGLWINDOW_MAJOR and IB4GLOPENGLWINDOW_MINOR do you found it in the curent DLL SDK? printr "Title :" + GetTitle() printr "Width :" + GetWidth() printr "Height:" + GetHeight() printr "BPP :" + GetBPP() while true sleep(100) wend 
|
|
|
Post by matthew on Nov 12, 2008 14:29:57 GMT -5
No, I can't find them in the current SDK. 
|
|
|
Post by Nicky Peter Hollyoake on Nov 12, 2008 14:31:00 GMT -5
Thanks! I'll get straight to testing it out.
|
|
|
Post by Nicky Peter Hollyoake on Nov 12, 2008 15:10:57 GMT -5
Mhm how do I get access to it?  IB4GLOpenGLWindow Window; doesn't work. - Nicky Matthew in the SDK in the include files check this file ... Basic4GLOpenGLObjects.h Got the following ... class IB4GLOpenGLWindow { public: virtual int DLLFUNC Width() = 0; virtual int DLLFUNC Height() = 0; virtual int DLLFUNC BPP() = 0; // (Bits per pixel) virtual bool DLLFUNC Fullscreen() = 0; virtual void DLLFUNC SwapBuffers() = 0; virtual const char *DLLFUNC Title() = 0; }; You know how to use this? - Nicky
|
|
|
Post by Supermonkey on Nov 12, 2008 15:33:07 GMT -5
string hello = "Hello world"; strlen(hello.c_str());
|
|
|
Post by DJLinux on Nov 12, 2008 16:15:42 GMT -5
Mhm how do I get access to it?  ... You know how to use this? not C++ but the steps are the same 1 in plugin.load fetch the interface 2 export Width(),Height(),BPP(),Fullscreen(),SwapBuffers() Download: interface_openglwindow.zipJoshy
|
|
|
Post by Darkjester on Nov 15, 2008 17:29:52 GMT -5
wat about using array data with the plugin?
|
|
|
Post by Empyrion Martyr on Dec 16, 2008 8:36:25 GMT -5
I found out a few problems with my original code... The display list should only be recreated when changing the spacing between the characters... this improves the speed of the example I provided by 60%. from 4.8-5.5 FPS to 10-11FPS. inside my opengl_lib_v12 or whatever it's name was, in the _glPrint sub, the if must be changed to: if __spacing <> __last_spacing then Try changing this line's equivalent in your plugin, i'm sure there will be a significant performance change... However this still means that when you glprint with different spacing between letters, the display list needs to be updated. Doing this too many times ends up with a performance blow, but this problem can be eliminated by building display lists with spacing from the beginning. For example, if your program needs to draw at DEFAULT_SPACING and at DEFAULT_SPACING+10, simply build 2 display lists from the beginning. 10x again nicky for the conversion. PS. The link to the plugin doesn't work for me...  PSS. I forgot, the display lists need to be recreated for each font you use on the screen. But y'all can use the same trick explained earlier to do it without loss of speed. Update: the link that works for me is basic4gl.wikispaces.com/file/detail/OpenGL+text.zip
|
|
|
Post by Empyrion Martyr on Dec 16, 2008 9:09:43 GMT -5
UPDATE 2: one BuildFont call must also be moved. I have rebuild the dll file, if y'all want the updated source code and dll i can upload it again.
|
|
|
Post by Nicky Peter Hollyoake on Dec 16, 2008 14:22:03 GMT -5
UPDATE 2: one BuildFont call must also be moved. I have rebuild the dll file, if y'all want the updated source code and dll i can upload it again. Yes please. Theres a few things I can update on the code which I have found others ways to do now (if you haven't already updated the mistakes  .
|
|
|
Post by Empyrion Martyr on Dec 18, 2008 8:46:15 GMT -5
don't wait for me to upload new versions of the code nicky, i don't have complete paternity of the library, you can do whatever you like with the code, plus, you might have more spare time than i do (since I am preparing for 2 SAT's, one TOEFL and 1 GCSE in the following months  ) ) Most of what I modified is not worth the effort if you have something else to add to code in another way. In fact, you should upload an updated version of the code, then I'll see if my changes are needed anymore. In short, go ahead and upload 
|
|