Recent Posts

Pages: [1] 2 3 ... 10
1
Donation / Donation
« Last post by Patrice Terrier on April 02, 2020, 11:21:02 am »
      If you want to support my work!

       

Click here to make a donation

     Or you can also use: paypal.me
2
Post Your Questions & Comments Here / Re: To Domenico Labate
« Last post by Domenico Labate on April 01, 2020, 08:40:21 pm »
Hi Patrice,
I believe that now, thanks to your great help, I can put myself in working hard to overcome my limits and arrive at a promising result useful to convince the thesis supervisor and proceed towards the preparatory phase for my daughter's doctoral research. I don't have a word now to say thank you. But I promise, as a gentleman as you are too, that I will do something to show my gratitude and esteem to the man Patrice Terrier. To the programmer, designer, planner and creator of spectacular graphic elaborations I can only say that I am happy and lucky to have known a great and talented code writer. Later on I will ask you if between the code you have written in the past there is something about how to distribute the load of my brute force algorithms that work on the graphs[1] of the possible paths on the CPU or GPU cores. Now I will try to understand how your precious and fundamental example works.
Thanks a lot Patrice and and best wishes for a peaceful period of Holy Easter!

Grazie infinite, domenico

[1] From graph theory, mathematical structures used to model pairwise relations between objects
3
Post Your Questions & Comments Here / Re: To Domenico Labate
« Last post by Patrice Terrier on April 01, 2020, 05:08:04 pm »
Domenico

here is the core zGetDIBits API used to fulfill an array in both PB and C++

PB
Code: [Select]
FUNCTION zGetDIBits ALIAS "zGetDIBits" (BYVAL hBitmap AS LONG, PixelArray() AS LONG) EXPORT AS LONG
    LOCAL bi AS MYBITMAPINFO
    LOCAL bm AS BITMAP
    LOCAL dwp AS DWORD PTR
    LOCAL hIC, hDC AS LONG
    IF hBitmap THEN
       hIC = zDisplayDC()
       hDC = CreateCompatibleDC(hIC)
       SelectObject(hDC, hBitmap)

       GetObject(hBitmap, SIZEOF(bm), bm)
       bi.bmiHeader.biSize        = SIZEOF(bi.bmiHeader)
       bi.bmiHeader.biWidth       = bm.bmWidth
       bi.bmiHeader.biHeight      = -bm.bmHeight ' Put top in TOP instead of bottom!
       bi.bmiHeader.biPlanes      = 1
       bi.bmiHeader.biBitCount    = 32
       bi.bmiHeader.biCompression = %BI_RGB
       REDIM PixelArray(bm.bmWidth - 1, bm.bmHeight - 1) AS LONG
       dwp = VARPTR(PixelArray(0,0))
       FUNCTION = GetDIBits(hDC, hBitmap, 0, bm.bmHeight, BYVAL dwp, bi, %DIB_RGB_COLORS)

       DeleteDC(hIC)
       DeleteDC(hDC)

    END IF
END FUNCTION

C++
Code: [Select]
long zGetDIBits (IN HBITMAP hBitmap, LPVOID lpArray) { // dllexport AS LONG
    long nRet = 0;
    if ((hBitmap) && (lpArray)) {
       HDC hIC = zDisplayDC();
       HDC hDC = CreateCompatibleDC(hIC);
       SelectObject(hDC, hBitmap);
       BITMAP bm;
       GetObject(hBitmap, sizeof(bm), &bm);
       BITMAPINFO bi;
       bi.bmiHeader.biSize        = sizeof(bi.bmiHeader);
       bi.bmiHeader.biWidth       = bm.bmWidth;
       bi.bmiHeader.biHeight      = -bm.bmHeight; // Put top in TOP instead of bottom!
       bi.bmiHeader.biPlanes      = 1;
       bi.bmiHeader.biBitCount    = 32;
       bi.bmiHeader.biCompression = BI_RGB;
       //REDIM PixelArray(bm.bmWidth, bm.bmHeight) AS LONG
       //LOCAL dwp AS DWORD PTR
       //lpArray = VARPTR(PixelArray(0,0))
       nRet = GetDIBits(hDC, hBitmap, 0, bm.bmHeight, lpArray, &bi, DIB_RGB_COLORS);
       DeleteDC(hIC);
       DeleteDC(hDC);
    }
    return nRet;
}

You can see how close they are.

Note: It is better to use a static array matching the size of the bitmap.

But you can also work directly with bit rather than long (4-bit), and then no need to pass an array, like in this code

Code: [Select]
    long nStep = bm.bmBitsPixel / 8;
    long x, y, w, h;
    BYTE* pBits = (BYTE*) bm.bmBits;
    w = bm.bmWidth;  // width
    h = bm.bmHeight; // height
    for (y = 0; y < h; y++) {
        for (x = 0; x < w; x++) {

             // Here you can manipulate the bits
             pBits[3] = A; // alpha
             pBits[2] = R; // red
             pBits[1] = G; // green
             pBits[0] = B; // blue

            pBits += nStep;
        }
    }

There is an example of bit manipulation in the attached resource.bas example, search for CASE %ID_MOVE_ZMAGIC.
To see it in action press the button named "Show Bitmap Overlay", this is an old example but still accurate ;)
4
Post Your Questions & Comments Here / Re: To Domenico Labate
« Last post by Domenico Labate on April 01, 2020, 08:35:48 am »
Bonjour Patrice!
I have studied a lot in this period but I have not been able to solve the problem. It is not easy to switch from PB to C ++, as you have wisely indicated. Windows under the bodywork is very powerful but it is not easy to master it. Especially for me who have always worked with character interface. Now, I'm in a difficult situation. Since I absolutely cannot tell my daughter that I cannot complete the project, I have to produce something that at least gives a glimpse of the path to follow. Moving over time the construction of a better and more efficient model. I have the temporary advantage of the povemic for covid-19 which leaves universities closed but sooner or later the universities will reopen. What I want to do now is to write the module that reconstructs the movement performed by a person by analyzing a script saved in an image. For this reason, I asked for an example in pbcc sdk to begin to see if the various algorithms can result to some extent (50%, 60%, 70%, or more). I studied various books of manipulation and analysis of the position of the pixels in two-dimensional plane. But it is difficult to implement them in a language that is not part of me. Now in order not to distract you from your things, I wanted to ask you if you have a simple example (in pbcc 5 or 6) of reading from an image file, in order to examine the dispositions of the pixels represented in the two-dimensional plane. And how do you read the individual pixels through your GDImage. I'm pretty motivated but I need to use something familiar. I am sure you understand my mood and I am confident that you will be in excellent health despite what is happening outside our homes but close to us. Thanks, as always, for your time.
See you soon
Domenico
Domenico
5
The 3D Model Collection / Hulk Buster
« Last post by Patrice Terrier on March 14, 2020, 10:11:57 am »
Hulk Buster
Author o0ozexo0o (Sketchfab)

ObjReader version by Patrice Terrier.

Note: This model requires ObjReader version 3.00 and above









Note: Attachments are only available to registered users.
6
ORDLL64 / ORV64 C++ version
« Last post by Patrice Terrier on March 07, 2020, 12:11:24 pm »
ORV64 C++

Is the Visual Studio 2019 project, showing the use of the ORDLL64 API within a 64-bit application.

Note: ORV64 being a viewer only, it uses only a limited subset of the native ObjReader functions.


The source code, allows you to use either a standard Windows GUI or a WinLIFT skinned interface.




Both binary, and source code are attached to this post.

Updated to version 3.00.05 on 03-09-2020
Updated to version 3.00.06 on 03-24-2020

7
ORDLL64 / ORDLL64.dll API
« Last post by Patrice Terrier on March 07, 2020, 11:56:32 am »
ORDLL64.dll

Allow the use of the ObjReader API inside any 64-bit programming language.

Note: Bass.dll (www.un4seen.com) is a prerequisite to play audio animations.

ORDLL64 constants

#define NVIDIA                  1
#define ATI                     2
#define INTEL                   3

#define ALPHA                   1
#define DEMO                    2
#define PLAYAUDIO               3
#define SYNCAUDIO               4
#define ANIMATION               5
#define FPS                     6
#define TURBO                   7
#define NOSYNC                  8

#define LOADED                  9991
#define ENABLED                 9992
#define CHECKED                 9993
#define AUDIO_VOL               9994
#define LOADING                 9995
#define TIMER                   9996
#define FOCUS                   9997



API list

OR_CreateWindow(IN DWORD dwExStyle, IN HWND hParent, IN DWORD dwStyle, IN long x, IN long y, IN long w, IN long h, IN HMENU CtrlID);
Create the OR OpenGL window, could be either a child or a popup window (WS_EX_TOOLWINDOW).

OR_DetectGPU();
Detect between NVIDIA, ATI, INTEL.

OR_GPUinfo();
Return an unicode string about the GPU being used.

OR_About();
Return an unicode string about the model being displayed.

OR_ViewReset();
Restore the model size and location to its default state.

OR_GetAudioVolume();
Return the audio volume setting.

OR_SetAudioVolume(IN long nVolume);
(Bass.dll) adjust the audio level.

OR_ProcessCommandLine(IN WCHAR* lpCmdLine);
Select a specific .obj file or a model folder, using a full qualified path.

OR_Vertices();
Return the number of vertices used by the model.

OR_Triangles();
Return the number of triangles used by the model.

OR_Indices();
Return the number of indices used by the model.

OR_Meshes();
Return the number of meshes used by the model.

OR_Materials();
Return the number of materials used by the model.

OR_ObjSize();
Return the size of the .obj file.

OR_LoadTime();
Return the ellapsed time to load the model in memory.

OR_Version();
Return the DLL version number.

OR_TimerEnable(IN BOOL enable);
Set to TRUE, if you want to use the OR sync timer (see the marquee text in the ORV64 demo project)

OR_SetSwapInterval(IN BOOL bUseInterval);
This is an advanced API
bUseInterval = 1 (Turbo mode, that is the default)
bUseInterval = 2 (Standard mode)
bUseInterval = 0 (no wait state, maximum GPU speed, requires the use of a GPU cooler fan)

New in Version 3.00.06

OR_ObjFileName();
Return an unicode string with the name of the active .obj file.

OR_GPU();
Return the GPU memory percentage used by the application.

OR_CPU();
Return the CPU memory percentage used by the application.

OR_GetAniTick();
Return the last tick used by the OR sync timer.

Note: You must use the OrResource folder aside the ORDLL64.dll.
The .LIB file is inside the ORDLL64.7z attachment.


Updated to version 3.00.05 on 03-09-2020
Updated to version 3.00.06 on 03-24-2020
8
Get ObjReader & Documentation / Re: ObjectReader
« Last post by Patrice Terrier on March 05, 2020, 03:36:49 pm »
Version Lite 3.01

- Zooming has been reworked to work directly with the internal sync timer.
- New button "Full screen" to switch to full screen mode.
- New button "Reset" to reset the size and location of the model in the view port (back to default).
9
WinDev ObjReader viewer / WinDev OR64 project
« Last post by Patrice Terrier on February 21, 2020, 10:50:40 am »
This is a Work In Progress, the latest version is attached to this post.

The attached WINDEV project is compatible with: WD17+

This thread is to explain how to use ObjReader inside of a 64-bit WinDev application.

The OR17 project is based on the "ObjReader Lite" version 3.00

You can post your questions and comments about using it with WinDev in this thread.

History:
  • 02-21-2020 Release V01 - First beta
  • 02-24-2020 Release V02 - ComboBox + new "3D_models" folder (located into the EXE's)
  • 02-25-2020 Release V04 - Model info (Vertices, Triangles, Indices, Meshes, Materials, OBJ size, Loaded in)

Note: To test the project you can use this animated model

The latest OR17.zip is attached to this post (WD source code and EXE binary)




The core ORDLL64.dll 3D engine, expose this set of API:
(Note: The use of GDImage64.dll is a prerequisite)

OR_CreateWindow(IN DWORD dwExStyle, IN HWND hParent, IN DWORD dwStyle, IN long x, IN long y, IN long width, IN long height, IN HMENU CtrlID)
Create the OpenGL viewport window.

OR_DetectGPU()
Detect the graphic card being used (nVidia, ATI, Intel).

OR_GPUinfo()
Return a string with specific informations matching the GPU being used.

OR_About()
Return a string about the current model used.

OR_ViewReset()
Reset the OpenGL viewport to the model specific default.

OR_GetAudioVolume()
Get the current audio volume used by the model, in the range 0 to 100 (the value is reseted, each time you load a new model).

OR_SetAudioVolume(IN long nVolume)
Adjust the audio level volume, in the range 0 to 100.

OR_ProcessCommandLine(IN WCHAR* lpCmdLine)
To select the full path of a specific 3D model.

OR_Vertices()
The vertices number.

OR_Triangles()
The triangles number.

OR_Indices()
The indices number.

OR_Meshes()
The meshes number.

OR_Materials()
The materials number.

OR_ObjSize()
The .OBJ file size.

OR_LoadTime()
The ellapsed time to load the project into the GPU memory.

OR_Version()
The DLL internal version number.

OR_TimerEnable(IN BOOL enable);
Set to TRUE, if you want to use the OR sync timer (see the marquee text in the ORV64 demo project)

OR_SetSwapInterval(IN BOOL bUseInterval);
This is an advanced API
bUseInterval = 1 (Turbo mode, that is the default)
bUseInterval = 2 (Standard mode)
bUseInterval = 0 (no wait state, maximum GPU speed, requires the use of a GPU cooler fan)

OR_ObjFileName();
Return an unicode string with the name of the active .obj file.

OR_GPU();
Return the GPU memory percentage used by the application.

OR_CPU();
Return the CPU memory percentage used by the application.

OR_GetAniTick();
Return the last tick used by the OR sync timer.


User guide:

3D model to use
You must use any model from the 3D collection, they have been highly optimized (with C4D) to use the unique features of the ObjReader material,
thus to achieve top-notch rendering quality in real time, and high refresh rate (FPS).

Memory
The models are loaded directly into the memory of the graphic card (GPU) to save the CPU ram, but you must have enough graphic memory (4Gb recommended),
and use the latest graphic drivers.

Drag-and-drop
Select a wavefront.obj model with Explorer and drag the icon onto the OpenGL viewport.
You can also do the same with any audio file, audio processing is performed in real time to sync the animations and pulse the lighting of the model.
Note: The processing of the audio signal and the animation sync is related to the use of a specific ObjReader material file.

Mousing
The left mouse button change the model orientation, the right mouse button drag the model left or right, and up or down (paning).
The mouse wheel adjust the zoom magnification (inertia smooth zooming).


3D_models:

The folder named "3D-models", is the right place to put all the models (each one using a distinct subfolder).
All models stored here, are shown into the ComboBox for easy selection.

Note: The attachment has both the WinDev source code, and the compiled binary into the EXE folder.
10
Get ObjReader & Documentation / Re: ObjectReader
« Last post by Patrice Terrier on February 19, 2020, 05:35:25 pm »
The Lite version, is provided without the extra overhead of the model inspection features.

This is the prefered version for those wanting only to browse the "3D Model collection".
Pages: [1] 2 3 ... 10