Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
English forum / User plugins in C/C++
« Last post by JeGX on June 23, 2014, 03:04:35 PM »
GLSL Hacker 0.7.0+ brings the support of user plugins (or dynamic/shared libs: *.dll under Windows, *.so under Linux and *.dylib under OS X). These dynamic libraries must implement the following functions:

Code: [Select]
int gxl_dylib_start(void* render_window, int width, int height, const char* data, void* user_data);
int gxl_dylib_stop(const char* data, void* user_data);
int gxl_dylib_frame(float elapsed_time, const char* data, void* user_data);
int gxl_dylib_resize(int width, int height, const char* data, void* user_data);
int gxl_dylib_set_message(const char* message);
char* gxl_dylib_get_message();


render_window is a pointer on the following data structure:
Code: [Select]
struct RenderWindowData_v1
{
#if _WINDOWS 
  HDC _dc; // Device context.
  HWND _hwnd; // Handle on the 3D window.
  HGLRC _glrc; // OpenGL context.
#endif

#if _OSX
  void* _glrc; // OpenGL context.
#endif

#if _LINUX
  Display* _display; // not set, alwyas = 0
  Window _window; // not set, alwyas = 0
  void* _glrc; // OpenGL context.
#endif
};

Once your DLL is coded with these functions, you can load it and use it in GLSL Hacker:

INIT script:
Code: [Select]
dlib = gh_utils.dylib_load(dylib_filename)
plugin_data = ""
gh_utils.dylib_start(dlib, winW, winH, plugin_data)



FRAME script :
Code: [Select]
plugin_data = ""
gh_utils.dylib_frame(dlib, elapsed_time, plugin_data)


SIZE script :
Code: [Select]
winW, winH = gh_window.getsize(0)
plugin_data = ""
gh_utils.dylib_resize(dlib, winW, winH, plugin_data)


TERMINATE script :
Code: [Select]
plugin_data = ""
gh_utils.dylib_stop(dlib, plugin_data)
gh_utils.dylib_unload(dlib)

You can use the plugin_data variable to pass arbitrary string to the plugin.

A complete demo (including the DLL source code in C/C++ for Windows and OS X) is available in the host_api/User_Plugin/ folder of the code sample pack.

This demo initializes and draws a simple triangle:




72
Forum en français / Plugin utilisateur en C/C++
« Last post by JeGX on June 23, 2014, 02:52:22 PM »
GLSL Hacker 0.7.0+ apporte le support des plugins ou DLLs utilisateurs. Ces librairies dynamiques doivent implémenter les fonctions suivantes:

Code: [Select]
int gxl_dylib_start(void* render_window, int width, int height, const char* data, void* user_data);
int gxl_dylib_stop(const char* data, void* user_data);
int gxl_dylib_frame(float elapsed_time, const char* data, void* user_data);
int gxl_dylib_resize(int width, int height, const char* data, void* user_data);
int gxl_dylib_set_message(const char* message);
char* gxl_dylib_get_message();

render_window pointe sur la structure suivante:

Code: [Select]
struct RenderWindowData_v1
{
#if _WINDOWS 
  HDC _dc; // Device context.
  HWND _hwnd; // Handle on the 3D window.
  HGLRC _glrc; // OpenGL context.
#endif

#if _OSX
  void* _glrc; // OpenGL context.
#endif

#if _LINUX
  Display* _display; // not set, alwyas = 0
  Window _window; // not set, alwyas = 0
  void* _glrc; // OpenGL context.
#endif
};

Une fois que vous avez codé votre DLL avec ces fonctions, il suffit de la charger dans GLSL Hacker avec gh_utils.dylib_load():

Script INIT:
Code: [Select]
dlib = gh_utils.dylib_load(dylib_filename)
plugin_data = ""
gh_utils.dylib_start(dlib, winW, winH, plugin_data)

Il ne reste plus qu'à appeller les fonctions start, frame, resize, etc.

Script FRAME:
Code: [Select]
plugin_data = ""
gh_utils.dylib_frame(dlib, elapsed_time, plugin_data)

Script SIZE:
Code: [Select]
winW, winH = gh_window.getsize(0)
plugin_data = ""
gh_utils.dylib_resize(dlib, winW, winH, plugin_data)


Script TERMINATE:
Code: [Select]
plugin_data = ""
gh_utils.dylib_stop(dlib, plugin_data)
gh_utils.dylib_unload(dlib)


La variable plugin_data permet de transmettre une chaine de caractères au plugin. Cette chaine de caractères vous permet d'envoyer des informations quelconques au plugin.

Une demo complete (avec les codes sources de la DLL pour Windows et OS X) est disponible dans le code sample pack dans le répertoire
host_api/User_Plugin/

Cette demo charge un plugin C++/OpenGL tout simple qui initialise et dessine un triangle:


73
Forum en français / Fenetres transparentes sous Mac OS X
« Last post by JeGX on June 23, 2014, 02:18:19 PM »
La version 0.6.4.5 de GLSL Hacker apporte le support des fenetres transparentes sous OS X. Par default une fenetre est totalement opaque. Pour faire une fenetre transparente, il suffit de changer sa valeur alpha dans le noeud XML scene:

Code: [Select]
<window name="win3d01" title="3DS loading"
                 width="800" height="600" alpha="0.6"
                gl_version_major="3" gl_version_minor="2" />

Si alpha=1.0, la fenetre est totalement opaque, si alpha=0.0, la fenetre est totalement transparente.

74
English forum / Transparent windows under Mac OS X
« Last post by JeGX on June 23, 2014, 02:14:29 PM »
The version 0.6.4.5 of GLSL Hacker brings the support of transparent windows under Mac OS X. By default a window is fully opaque. To make a transparent window, just set its alpha value in the XML window node:

Code: [Select]
<window name="win3d01" title="3DS loading"
                 width="800" height="600" alpha="0.6"
                gl_version_major="3" gl_version_minor="2" />

if alpha=1.0, the window is fully opaque, if alpha=0.0, the window is fully transparent.

75
Forum en français / Le plugin FreeImage (GLSL Hacker 0.6.4.3+)
« Last post by JeGX on June 23, 2014, 02:06:40 PM »
Depuis la version 0.6.4.3, GLSL Hacker est dispo avec un nouveau plugin pour charger les images. Ce plugin est basé sur FreeImage, une puissante librairie de manipulation d'images. Elle supporte des tonnes de formats ainsi que les formats HDR (128-bit par pixel ou 4 float par pixel).

GLSL Hacker intègre depuisle début un plugin basé sur la lib stb pour charger les images. La question est: comment sélectionner le plugin qui sera utilisé pour charger les images?

La réponse à cette question est toute simple: il faut utiliser la fonction set_current_image_codec() de la lib gh_texture:

Code: [Select]
gh_texture.set_current_image_codec(nom_du loader)

Pour utiliser le plugin FreeImage:
Code: [Select]
gh_texture.set_current_image_codec("FreeImage")

Maintenant toutes les fonctions de chargement d'images utiliseront le plugin FreeImage.

Pour revenir au plugin intégré:
Code: [Select]
gh_texture.set_current_image_codec("stb")
76
English forum / FreeImage plugin (GLSL Hacker 0.6.4.3+)
« Last post by JeGX on June 23, 2014, 01:59:16 PM »
From the version 0.6.4.3, GLSL Hacker is shipped with a new image loader plugin based on the popular FreeImage library. FreeImage is a powerful library to manage images and supports a lot of formats as well as 128-bit formats (each channel is coded on a float). But GLSL Hacker comes already with a built-in image loader (based on STB). So the question: how to choose the image loader?

This simple question has a simple answer: the set_current_image_codec() function of gh_texture lib:

Code: [Select]
gh_texture.set_current_image_codec(plugin_name)

To use the FreeImage loader, just do:
Code: [Select]
gh_texture.set_current_image_codec("FreeImage")

Now all texture functions that load an image file will use the FreeImage plugin.

To use the default image loader:
Code: [Select]
gh_texture.set_current_image_codec("stb")
77
3D-Tech News Around The Web / (WebGL) Vermeer's ‘The Milkmaid’ in 3D
« Last post by Stefan on June 21, 2014, 01:44:35 PM »
Quote
[non-Blender] ‘The Milkmaid’ in 3D

    This model was made in 3DS Max, but I thought it was inspiring enough to share here: Kou-c30 re-used a 3D model by Eiichi Nagai to create this interactive view of one of the world’s most famous painting: The Milkmaid (Het Melkmeisje) by Johannes Vermeer. I think it’s a fascinating new way to explore artwork!
   
78
NVIDIA Kepler Cards Get HDMI 4K@60Hz Support (Kind Of)

An interesting feature has turned up in NVIDIA’s latest drivers: the ability to drive certain displays over HDMI at 4K@60Hz. This is a feat that would typically require HDMI 2.0 – a feature not available in any GPU shipping thus far – so to say it’s unexpected is a bit of an understatement. However as it turns out the situation is not quite cut & dry as it first appears, so there is a notable catch.
79
3D-Tech News Around The Web / NVIDIA HairWorks tools public release
« Last post by Stefan on June 21, 2014, 06:08:12 AM »
 NVIDIA HairWorks has been used in several released and upcoming games like Call of Duty: Ghost, The Witcher 3 and Strife – just to name a few. The tools for making fur can now be downloaded from our webpage and we also provide several tutorials, for more information click here.
 
80
English forum / Re: MadShaders 0.3.0 - Dolphin scenario
« Last post by JeGX on June 20, 2014, 08:04:06 PM »
Thanks, I will look at a fix for the next release of MadShaders.
Pages: 1 ... 6 7 [8] 9 10