@Capehill Probably you right,i should check it myself too, but should it crash if i still don't ?
As for point 2, i am using os4depot version of SDL, will try now r213.
EDIT: sdl2 at moment should be configured/make only, no makefile.amigaos4 ? (at least can't find at moment). I start to rebuild it with configure;make, but as i have not very recent SDK, i ends up with some undefs in graphics.library includes, so updated to the latest one and was able to build it , time to test
If you receive a NULL pointer and keep messing with it, things might not work nicely. Anyway, I'm interested to see the results with error checking.
There is no native makefile yet. Configure + make works more or less. There is also a semi-working Cmake but it's not finished (works for me you know).
@Capehill Are you sure you delete all other tests from main, and test exactly testOpenGLES2(); ? For me it all the time crashes in the glMatrixMode(), and , that functinon in the minigl includes..
But, when i test pure testOpenGL(); it works, but testOpenGLES2(); crashes.
You are correct, it's my bug. There is no glMatrixMode in OGLES2 of course! For me it fails differently (context creation fails) because I cannot run OGLES2 on my machine.
@Capehill Yeah, it open your library, but as it didn't works on your HW it quit early. But if it will works, once it done init stuff in , etc, it will crashes for you same as for me..
I found the cullpit, well, sort of. Check the helloworld testOpenGL() and testOpenGLES2() fucntions, they both open the same window, and then call openGL(w); , which do opengl based stuff.
Differences is that in testOpenGLES2(), we firstly do:
Well, fun part now starts: If i comment out first line: it works. If i comment only second line , it works too ! If i comment second, and third line, but keep first one, it works too !
I.e. not exactly call which crashes, but probably many of them in a row, dunno ..
@Capehill I feel it is somehow related to the SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); line, as if i repeat that one many times i can reproduce crash. Maybe 0 taken as some null pointer or whatever somewhere where should't ?
Strange of course that stack-trace point on glMatrixMode(), but it is first function in the routine opengl() function, so it will crashes there on any other ones, just before something trashed somewhere.
And crash btw 80000003 one, and r0 and r6 registrs are 00000000, and crashed instruction are "lwz r0,276(r9)".
Edited by kas1e on 2018/1/23 20:35:46 Edited by kas1e on 2018/1/23 20:37:36
@capehill Thanks, but you just rewrite test code , not SDL2 code :) Idea is to port sdl2 stuff, but if we cant pass simple test case, how we can port later something without massive rewrite like full blow engines and games :)?
Almost all gles2 stuff around will use gl functions, even primitive ones. Are you sure its not just nullpointer problem in gles2 sdl2 wrapper not related to context creating ?
But, i anyway tested rewroten testcase, and it just exit after window created with words "ogles2 context createt", without drawing anything (because no GL functions called anymore from it). But of course we can create ogles2 context, that no the point for us .. idea is to have original helloworld.c working , where we can use ogl, ogles2, swith between them, etc.
And even if i just trying to use testOpenGL(); it also says "ogles2 context created" and exit.
Imho, we need back original helloworld.c , and fix it all in SDL. I mean we open minigl.library from opengl, we open ogles2.library from ogles2. And we should be able to call eath others, mix them, swith between them, that the point of that test case :)
Edited by kas1e on 2018/1/24 7:15:16 Edited by kas1e on 2018/1/24 7:18:49 Edited by kas1e on 2018/1/24 7:21:14 Edited by kas1e on 2018/1/24 11:56:03
I fixed a buggy test case. "helloworld" is not "official" SDL2 testware, it was written by me.
If you want to see OGLES2 in action, try testgles2 rather. To draw things in OGLES2 you have to create shaders.
EDIT: extending my response.
1) Keep eye on the serial log. It will show useful stuff regarding OpenGL context opening and other things.
2) The proper way of using OpenGL is to load each function. Then it's possible to know does the particular glFunction() actually exist. I made lazy code that just assumed things like glMatrixMode exist. It does, for MiniGL. It does not, for OpenGL ES 2. Take a look at any proper project like ScummVM or ioquake3. Yes they do load and check their GL functions before using them.
I fixed a buggy test case. "helloworld" is not "official" SDL2 testware, it was written by me.
Ah, i was fear its official one :) But in r214 it didn't works anyway, it just open ogles2 context and exit, even if we call testOpenGL() fucntion.
Quote:
If you want to see OGLES2 in action, try testgles2 rather. To draw things in OGLES2 you have to create shaders.
That one works ! Through needs little changes (added || defined(__amigaos4__), so to have #define HAVE_OPENGLES2 working, and then, it), but it works :)
Quote:
Take a look at any proper project like ScummVM or ioquake3. Yes they do load and check their GL functions before using them.
In other words in all normal projects all will works as should, good !
As SDL2 is documented to initialize haptic subsystem when SDL_INIT_EVERYTHING is passed, behaviour is probably correct. If someday there is force feedback support in AmigaOS, it can succeed. We could #ifdef HAPTIC out but it would be another hack. Maybe it should be rather documented that SDL_INIT_EVERYTHING fails due to this.
@Capehill But it do so also for calling testopenGL(), while shouldnt ? I mean if i call testopenGLES() and if i call testopenGL() its the same create gles context.
Can you show some console + serial log or your test diff because I'm not completely sure what is happening there? Probably just a test code issue but anyway..
First one ok, i press "q", then second one ok, "gles2 context created and exit", and then create empty window, and all hangs, greamreaper not appears, but crash visibly on serial log, there is: helloworld_crash.txt