Situation is that i want to made the same amigaos4 src code which use SDL2 / OpenGL ES to works on my win32 machine, so i can easyly tests things like which is working/not working on aos4, and which is working/not working on win32.
Now, i grab Hans's free tutorial he released some time ago called "OpenGL ES 3 + SDL2 tutotrial" located there:
all fine, i can change glClearColor values, and can see how colors changes in window, so it shows that all works.
Second example also works fine (with very little changes in includes, etc), i can use those simple shaders on aos4, white triangle draws , etc, all fine too, all works.
But then .. I want to make it works on win32/visualstudio. By default OpenGL ES 2 didn't works on desktops (at least not on my) and as i see from tutorial , Hans use "Angle" to made OpenGL ES working on desktop's (Angle in this case emulate all OpenGL ES calls through DirectX). So, there is even visualstudio's template provided by Hans, which contain necessary prebuilded Angle libs (libglesv2.lib/dll and libelg.lib/dll) as well as in the same template auto-installing of SDL2 happens.
So, with usage of that template, i create first test case (simple glClearColor/glClear thing). And, while all builds fine, black window shows fine, all works, then , does not matter how hard i tried to change glClearColor() values, it still always black (while as i say, on amigaos4 all changes fine).
I trhough that ok, maybe some bug somewhere, let it be, and going to second example, but that one also fail (while as i say works on amigaos4 fine), and it fail with such an output:
Yeah, compilation of shader failed .. Its there, it opens, etc, but failed.
Now, what i didn't get is that if Angle should tranfer all OpenGL ES 2 calls to DirectX , is it somehow mean that in my case it isn't ? Maybe some special hardware settings need to be done ? Maybe because i have discrete gfx board (2 at the same time) it throw issues at me ?
From another side, i tried 2 another OpenGL ES 2.0 emulators :
That one works fine, but it works ONLY through libegl.dll, so even if i use SDL2 only, and link with their libglesv2.dll, it still throw at me errors about unitialisation of EGL context.
But when i use EGL for context creation, it works fine. So, emulator works in this case, just not with SDL2 only.
From Han's tutorial its clear that it should work, but by some reasson's didn't. Sure, in those 2 emulators EGL usage can be inbuild and hardcoded, but then with Angle it should work ! Why it didn't and to where to look at for begining ..
Each chapter in my tutorials book has a download for the finished tutorial. Have you tried downloading and running one of those? That'll quickly tell you if there's an issue with your code, or a problem with Angle on your machine.
Does it have to be OpenGL ES? OpenGL 3+ is mostly compatible
Yeah, it need to be OpenGL ES 2.0 exactly, because that what works on amigaos4, and that why i need it on win32, to have the same 1:1 code works for testing purposes.
@Hans Quote:
Each chapter in my tutorials book has a download for the finished tutorial. Have you tried downloading and running one of those? That'll quickly tell you if there's an issue with your code, or a problem with Angle on your machine.
Mm.. In the PDF i have by hands now (v1.1), it didn't have any download link of examples: not at end of chapters, not at the final end. You probabaly just mess it with "getting started with Warp3DNova", where download links of examples present, while in "GLES3 + SDL2" are not.
Also, it doens't explain why the same code works on amigaos4, but fail that strange on win32 .. But, yeah, will be interesting to try ready-to-use code. Just where to download it, as pdf have no links to.
I have no experience on any of those wrappers. If I were to test a shader on Windows, I would just load the required OpenGL functions as usual and then draw something. And of course, check GL errors once per frame :)
@Capell Sure there other ways if i only want to check some shaders, but i still need opengl es 2 + sdl2 combo works on win32, so any test codes will be the same on 99.9% and for os4, and for windows.
For testing purposes it always good to have less as possible differences. Besides, i just want to make it works now because it didnt work while should :)
@Hans Thanks, but that one of course don't go too : its just pure amigaos4 example taken from Codebench. More of it its even without usage of SDL, its handle all things in amigaos4 way, so that source for win32/visualstudio of course didn't go. Probabaly its just called "gltutorial", but that is tutorial from amigaos4 specific tutorials, not that one from GLES3+SDL2 book.
What i need is those 2 first example sources from your GLES3+SDL2 tutorial, for VisualStudio. Just to recheck them to be sure that i type i correctly and there no errors, and to be sure that something is wrong on my win10 side with Angle or so.. Maybe you use some different flags for visualstudio project, dunno..
The more i read and check all the google links, the more i find that ppls use EGL all the time with all those Angle and other emulators. But as you wrote those tutorials with example with SDL2, then they for sure works for you somehow..
@Hans Thanks, that it now. But i still have the same problem :(
I.e. i got your archive, unpacked, dbl-click on GLTutorial.sln, it opens in my visualstudio2019. It ask then about "retarget project" to windows sdk 10, and platform toolset update to "v142", so press "ok", then "f5" for build test case : all builds fine, it show black window.
Now, i just change :
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
to
glClearColor(0.3f, 0.4f, 0.5f, 1.0f);
press "F5" for recompile, and window still black ! While the same source code compiled for amigaos4 works , and window is not black anymore.
Now, i just add before glClearColor (right after SDL_GL_CreateContext) , this:
SDL_Log("Version : %s", glGetString(GL_VERSION));
And it crashes on that line, with:
Quote:
Unhandled exception at 0x6C7C0480 (SDL2.dll) in GLTutorial1.exe: 0xC0000005: Access violation reading location 0x00000000.
Funny thing , is that if i use exactly the same source code, but just change include from SDL_opengles2.h to SDL_opengl.h, and link not agains GLESv2 , but against opengl32 (i.e. just via changing in GLTutorial1.vcxproj 2 instances of libGLESv2.lib, to opengl32.lib) , then the same code works fine, window not black, and not crashes on that line, and it correctly says :
INFO: Version : OpenGL ES 3.0 - Build 22.20.16.4749
I.e. showing that when we link against opengl32.lib, then quering OPENGL ES 3 renderer works. Just when we link against libGLESV2.lib those problems starts.
Very strange ! For you it definately works ? I mean, same Tutorial1 , just change black color to another one in glclearcolor(), press "f5" in visual studio, and all works ?
If so, can you also upload plz also ready "debug" directory after you press "F5" , so i can just unpack it somewhere and run, to see, if it will works on me..
Oh, finally deal with ! Prepare for long story, wall of text ! :)
There was everything : reinstalling of everything bunch of times to make that overblown visualstudio2019 with all those sdks, debuggers and co be fast and more or less small and clean.
Another issues was to compile my own build of Angle (issues with pathes, environments, some errors there and there), and after spending a day on it i was able to do it. But still i feel something nasty in all this modern today's projects.. I mean, its just in whole i feel sad how whole world move to some fast computers, gigabytes of data, projects which include everything inside and easy counts in gygabytes, but its all always slower than can be, languages they use most of time have some "classes" for hundreds of megabytes (!) of size, and most of time that much hi-level, that they have bagage of hundreds megabytes of anything. And those corporate guys alway fit in your face some new technology like, you know, its what you dream of, and you should start to use it right now :) Not sure if it what i wish to have for os4 any day :) Less progress kind of make it be clean still :)
So ok, build own copy of Angle, to only realize that it still bring _the same_ issues ! Damny crap !
Now, i made again some simple GLES2 example, but this time with usage of EGL instead of SDL2 : now that works, same as with emulators.
And so, after some fidding with code , googling all sort of queries i found, that there should be magic line *IN SDL2 CODE*, which make it all works:
And even, when it works, still, GLESv2.dll directly use EGL.dll _in any_ case. Does not matter that you didn't have it in your SDL2 code, it will be used, so EGL.dll should be in place too, just you have no needs to know that under the hood egl is used anyhow.
So, after adding that line and putting in code gl query of GL_VERSION, GL_VENDOR and GL_RENDERER i have:
Quote:
GL_VERSION = OpenGL ES 3.0.0 (ANGLE 2.1.0.dc2c5c5a419e) GL_VENDOR = Google Inc. GL_RENDERER = ANGLE (Intel(R) HD Graphics 620 Direct3D11 vs_5_0 ps_5_0)
And all Hans's examples start to work (but of course i still need to add that Hint line to all examples).
Good thing also that i made it all works through MSYS2, without needs for visualstudio or anything:
(press open in new tab for fullsize)
Another question is, how it all works for Hans before, if in his tutorials he cleary didn't do any call to SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1");
More of it, as i aware, that was added only in SDL2.0.6 , while in the Template provided by Hans he have SDL2.0.5, where is no SDL_HINT_OPENGL_ES_DRIVER was implemented. So how it works ? Maybe on Hans's setup just some AMD drivers setuped , and OpenGL ES works as it, not over Angle.
@Hans
Can you put in our example you upload those lines after context creation:
Then compile and run on your setup (on that one where you wrote book), and we will see, if in your case Angle is used at all, or it just inbuild AMD's opengles support working, while Angle didn't.
Because if SDL_HINT_OPENGL_ES_DRIVER was added only in 2.0.6, but your template have 2.0.5 , and you didn't use that HINT call, then it should't probabaly works for you over Angle. But as it works for you at all (because how else that book can be writen), it can mean it works over AMDs OpenGL ES support in end and not over Angle. Try it plz for sake of truth, maybe some info can be added later to the book because of that.
In my case it was very visibly because i have Intel gfx , so no inbuild opengles2 support. Also my one are discrete (2 gfx cards at the same time), so go figure how driver reacts there, etc. But in your case maybe AMD drivers did the trick to make it all works, and Angle in your case not used.
Check it plz the way i show , pretty intersting to know :) I found my way of course, and can now test 1:1 the same code on both win32 and amigaos4, so that will be very handy to help impove issues on our side, but still knowing the truth also interesting, as well as book can be a little fixed if there will be anything to add.
Glad you figured it out. I'll check it out on my machine later (which has Intel and nVidia graphics, NOT AMD). A quick search online suggests that the SDL_HINT_OPENGL_ES_DRIVER hint was indeed added in v2.0.6.
In the meantime, you may wish to file a bug report against SDL2. It should fail gracefully rather than sort-of work.
Btw, start firstly all your example on win32 now , so later to migrate them all to amigaos4, and found now the same issue which i had when i first time trying to make examples work on amigaos4 : can't make example_03 (textured quad) working :(
I tried the same source code on amigaos4, and have same error, just the code of error on aos4 not 1282, but 1281.
I double-triple rechecked that i put all the code as in tutorial, and even deleted everything and done again from scratch from working example2 , but still fail like this.
Can you also upload the same as you do for tutorial01, but tutorial03, so i can compare , if i missed something in the code (or if tutorial missed something).
ps. Also found little typo on the page35:
it have now:
In Main.cpp, add the following code below the shaderLoad() section:
but should be: In Main.cpp, add the following code below the shaderProg() section:
I've tested it, and get the same glClear() problem on my Windows 10 machine. The GL version strings are empty. This is with SDL 2.0.5 which does *NOT* have SDL_HINT_OPENGL_ES_DRIVER.
It used to work back when I originally wrote the tutorial, although I can't remember exactly what hardware/software configuration that was (other than Visual Studio 2015). That may have been on my old MacMini.
You should definitely submit a bug report to SDL2, as the following line should be enough to switch to ES drivers:
@Hans Recieved your tutorial03 example, and it works on both win32, and on amigaos4. For amigaos4 i only change SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); on SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
to make it works. Even includes stays the same, as well as shaders:
(press open in new tab for fullsize image):
Will try to figure out if it was problem me typing from book, or book missed some part which source didn't. Will write you back once figure it out
@All Some more good news : Once SDL2.0.6 minimum is used, and that SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1"); call done, then you can use OpenGLES 2/3 on win32 not only over Angle, but over those other emulators i say about at begining : and one from PowerVR (PVRFrame tool) and ones from Mali.
There is little summary of all them, in all cases x64 versions of libs are tested, on win10, all tests compiled on msys2.
Angle:
- need to download git source and build (visualstudio only, not easy, but can be taken from Hans's template) - release size of libEGL.dll : 368k, libGLESv2.dll : ~5mb - output for GL_VERSION, GL_VENDOR, GL_RENDERER & GL_EXTENSIONS:
- no needs to build, just download some installer and install things. Need only PVRFrame tool. - release size of libEGL.dll : 2.7mb, libGLESv2.dll : 8.6mb - output for GL_VERSION, GL_VENDOR, GL_RENDERER & GL_EXTENSIONS:
- no needs to build, just download some installer and install things. - while size of libEGL.dll : just 80kb and libGLESv2.dll : 130kb, don't be fooled, it come with other additional libs need it for use it: libMaliEmulator.dll - 7.5mb, log4cplus.dll ~1mb and Mali-T600_r7p0-00rel0.dll about 2mb. - output for GL_VERSION, GL_VENDOR, GL_RENDERER & GL_EXTENSIONS:
So, what ones to use pretty much depends on which one are best in doing things to make OpenGL ES 1/2/3 working on win32. By amount of extensions available seems PowerVR is win. It also have just 2 dlls , same as Angle. But from another side, Angle is used by Chromium, which is probabaly more tested than PowerVR tools.
In other words, any of them can be used with SDL2, just 2.0.6 is minimum, and that SDL_HINT call is must.
@All Find out that at moment Angle is better : it bring more verbose output about shaders compilation if something going wrong and more "human" related explaining of them.