1

Currently I use GR32 functions for my project, where I have lots of blending, image operations such as saturation, contrast, blur etc. Also custom image operations.

Basically I would like to replace GR32 (or GDI, no difference) with graphic card instructions, in order to use graphics card for processing instead of CPU.

I don't need OpenGL unit, I don't want to make any 3D operations, I just want to use graphics card calculations instead of CPU instructions.

My questions are >

  1. What is the best way to use GPU?
  2. Is there any libs written for these purposes?
genpfault
  • 51,148
  • 11
  • 85
  • 139
Ivan Mark
  • 463
  • 1
  • 5
  • 17
  • https://msdn.microsoft.com/en-us/library/windows/desktop/dd370990(v=vs.85).aspx – selbie May 04 '15 at 22:09
  • You can take a look at SDL or SFML if you want to do 2D things with a simpler API than OpenGL or DirectX. – Jerem May 05 '15 at 06:55
  • 1
    GLScene is also a possibility. Also, if you're not really seeking the best performance, but something easy, take a look at the FireMonkey side of the newer XE Delphis. They are quite easy to work with, though has their annoyances as well. You can have 2D and 3D on the same form for example. XE5-7 versions are quite usable, earlier version have a lot of bugs. – kgz May 05 '15 at 09:05
  • FireMonkey! It uses Direct2D (a 2D layer in DirectX) on Windows, and OpenGL on other platforms. Use 'effects', which are implemented via shaders, to blur, saturate, etc. – David May 05 '15 at 20:48

1 Answers1

4

Use OpenGL or Direct3D. These are the APIs for talking to the GPU.

Also neither OpenGL nor Direct3D operate on 3D scenes. All they do is drawing points, lines or triangles to a pixel framebuffer, applying programmable shaders and fixed function blending operations. In other words they do exactly what you want.

The only thing that is "3D" about OpenGL and Direct3D is, that the coordinates for the points, lines or triangles have more than 2 dimensions, but ultimately these coordinates are projected into 2D window coordinates. And the points, lines and triangles are then rasterized as flat, 2 dimensional shapes in window coordinate space.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Thanks, this is what I've expected. But is there some lib for Delphi that contains some wrapped functions, that could replace OpenGL/Direct 3D functions? – Ivan Mark May 04 '15 at 22:12
  • Well, I don't know about Delphi in particular, but Cairo ( http://cairographics ) has a (experimental) OpenGL backend; Cairo has a C style API, so it shouldn't be too hard to create bindings for Delphi, if there are not some available already somewhere. – datenwolf May 04 '15 at 22:40
  • There's FireMonkey - a whole graphics and UI API, provided in the box with Delphi, that uses Direct2D or OpenGL depending on the platform. See my comment directly on your question. – David May 05 '15 at 20:49