Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Do Mär 28, 2024 20:32

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 4 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Checking if GLSL is supported
BeitragVerfasst: Do Jan 09, 2014 21:30 
Offline
DGL Member

Registriert: Mo Jul 08, 2013 05:28
Beiträge: 14
Programmiersprache: Delphi
I have been using dglopengl to support GLSL shaders a while now.

Most of the time it all works as expected, but I have a strange issue on a few PCs. This also seems to only happen with dual monitor setups it seems, but when I got a second monitor for my development PC it didn't show the issue. When I check for GLSL support their screen flickers black for a second. If the person has their desktop scaled to 150% this also causes windows to move around and is annoying.

This is the code I use when checking if the PC can support GLSL

Code:
  1.      try
  2.         GLSL_DC:=form1.canvas.handle;
  3.         InitOpenGL;
  4.         GLSL_RC := CreateRenderingContext(GLSL_DC, [opDoubleBuffered,opGDI], 32, 24, 0, 0, 0, 0);
  5.         ActivateRenderingContext(GLSL_DC, GLSL_RC);
  6.         ReadImplementationProperties;
  7.         ReadOpenGLCore;
  8.         parselst:=tstringlist.create;
  9.         versionstr:=string(glGetString(GL_SHADING_LANGUAGE_VERSION));
  10.         parse(versionstr,' ',parselst,true);
  11.         if strtofloat(parselst[0])<3 then GLSL_Available:=false else GLSL_Available:=true;
  12.         parselst.free;
  13.         GLSL_Available:=true;
  14.      except
  15.            GLSL_Available:=false;
  16.      end;
  17.  

InitOpenGL, ReadImplementationProperties and ReadOpenGLCore are all the default code from dglopengl.
GLSL_DC is a Windows.HDC
GLSL_RC is a Windows.HGLRC

Is there anything I am doing wrong there? Is there a more bullet proof way of checking for GLSL support?


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: Checking if GLSL is supported
BeitragVerfasst: Fr Jan 10, 2014 21:22 
Offline
DGL Member
Benutzeravatar

Registriert: Di Apr 29, 2008 18:56
Beiträge: 1213
Programmiersprache: Delphi/FPC
Hey,

you variable 'GLSL_Available' is always true (see Line 13). Maybe the issue is caused somewhere behind the check, because it returns always true?
Do you need the 'opGDI' flag? I've read about some flickering when this is enabled.
Try to use 'GetDC(form1.Handle)' in line 2. If nothing of this will help, you can also try to use this wrapper class to create your context:
https://github.com/martok/gl-context/bl ... /README.md
viewtopic.php?f=13&t=10979

greetings Bergmann.

_________________
Aktuelle Projekte: BumpMapGenerator, Massive Universe Online
Auf meiner Homepage gibt auch noch paar Projekte und Infos von mir.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: Checking if GLSL is supported
BeitragVerfasst: Sa Jan 11, 2014 11:03 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
Simply check for the presence of the GL_ARB_SHADING_LANGUAGE_100 extensions, that's the official recommended way of detecting wether an implementation supports shading or not.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: Checking if GLSL is supported
BeitragVerfasst: Mo Jan 13, 2014 01:39 
Offline
DGL Member

Registriert: Mo Jul 08, 2013 05:28
Beiträge: 14
Programmiersprache: Delphi
OK, what is the minimal code I need to check if GLSL version 3.0 or higher is supported on the PC?

I manged to cut the above code down to

Code:
  1.      try
  2.         GLSL_DC:=form1.canvas.handle;
  3.         InitOpenGL;
  4.         GLSL_RC := CreateRenderingContext(GLSL_DC, [], 32, 24, 0, 0, 0, 0);
  5.         ActivateRenderingContext(GLSL_DC, GLSL_RC);
  6.         parselst:=tstringlist.create;
  7.         versionstr:=string(glGetString(GL_SHADING_LANGUAGE_VERSION));
  8.         parse(versionstr,' ',parselst,true);
  9.         if strtofloat(parselst[0])<3 then GLSL_Available:=false else GLSL_Available:=true;
  10.         parselst.free;
  11.         optionsform.vendorinfo.caption:='GLSL Version '+glGetString(GL_SHADING_LANGUAGE_VERSION);
  12.         DeactivateRenderingContext;
  13.         DestroyRenderingContext(GLSL_RC);
  14.      except
  15.            GLSL_Available:=false;
  16.      end;

But that still causes the screen to go black and flicker for a second when that code is run.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 4 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 12 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.028s | 17 Queries | GZIP : On ]