DGL
https://delphigl.com/forum/

Software OpenGL to hardware OpenGL
https://delphigl.com/forum/viewtopic.php?f=19&t=11676
Seite 1 von 1

Autor:  GL123 [ Mi Jan 16, 2019 01:27 ]
Betreff des Beitrags:  Software OpenGL to hardware OpenGL

I want to update some older OpenGL code to use hardware v3+ OpenGL. My current code is OpenGL v1.1 compatible and runs using the Microsoft software OpenGL DLLs.

In my current OpenGL code I replaced the old gl and glu uses calls with dglopengl, but still got v1.1 GLVERSION reported.

For the OpenGL init I use;

Code:
  1. DC:=tbm.canvas.handle;
  2. InitOpenGL;
  3. RC := CreateRenderingContext(DC, [opDoubleBuffered,opGDI], GetColorBits, 32, 0, 0, 0, 0);
  4. ActivateRenderingContext(DC, RC, true);

tbm is a tbitmap32 bitmap. DC is an HDC and RC is an HGLRC.

After those calls I use the usual/same glenable etc calls and draw objects between glbegin and glend pairs. The display works as expected, but it is no faster than using software OpenGL. I added a call to check GLVERSION and it returns 1.1.0?

How can I get the OpenGL code to initialize and use my GPU for faster OpenGL processing and display?

Thanks for any tips.

Autor:  GL123 [ Mi Jan 16, 2019 02:43 ]
Betreff des Beitrags:  Re: Software OpenGL to hardware OpenGL

I also tried using CreateRenderingContextVersion I saw in dglOpengl. But even using v1.1, ie

Code:
  1.      RC := CreateRenderingContextVersion( DC,                        //DC: HDC
  2.                                           [opDoubleBuffered,opGdi],  //Options: TRCOptions
  3.                                           1,                         //MajorVersion:Integer
  4.                                           1,                         //MinorVersion:Integer
  5.                                           true,                      //ForwardCompatible:boolean
  6.                                           32,                        //Colorbits:Integer
  7.                                           0,                         //Zbits:Integer
  8.                                           0,                         //StencilBits:Integer
  9.                                           0,                         //AccumBits:Integer
  10.                                           0,                         //AuxBuffers:Integer
  11.                                           0);                        //Layer:Integer
  12.  


Gives me the exception "Could not get function pointer address for wglCreateContextAttribsARB - OpenGL 3.x and above not supported" dglopengl line 20,000.

Autor:  TAK2004 [ Di Jan 22, 2019 16:36 ]
Betreff des Beitrags:  Re: Software OpenGL to hardware OpenGL

Hi GL123,

One issue of the OpenGL3+ API is, that it didn't solved the issue of using an own init function.
You need to create an old context, request the GL3+ init function as a kind of extension and then use this to create a GL3+ context, switch to it and destroy the GL1+ context.
C++ working code
This code comply with the specs and don't raise any warnings on the intel, nv, amd drivers.
NV allowed in the past to create a GL3+ context directly but this was not conform with the spec and didn't worked on AMD, Mesa and Intel which stay strict to specs.

edit:
I missed to mention the OpenGLGetProcAddress function.
You can find it here.
First check with the system specific function then as fallback ask the library.

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/