Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
73 user(s) are online (50 user(s) are browsing Forums)

Members: 0
Guests: 73

more...
Support us!
Recent OS4 Files
OS4Depot.net





OpenGL ES 2 and glDrawArrays
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 576
Trying to fix SDL2 renderer OpenGL ES 2 backend but got stuck. There are some GL errors reported during frame.

For example, when trying to render a rectangle, it seems that glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) triggers GL error 1281. Code alternates between 8 VBOs and problem might be related to VBOs somehow, since after disabling (read: hacking!) VBO usage GL errors went away.

I wonder if there exists a debug build for ogles2.library that might help to sort out these problems?

Shaders compile and program links without errors.

Reference: https://github.com/AmigaPorts/SDL/tree/master/src/render/opengles2

   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Just popping in
Joined:
2015/6/11 8:51
From Cologne
Posts: 195
@Capehill
1281 is GL_INVALID_VALUE. glDrawArrays itself only issues that if the count parameter is negative. This is obviously not the case with your glDrawArrays(GL_TRIANGLE_STRIP, 0, 4).

That's why I asume that the error is set earlier, namely during VBO setup, because as you say the error goes away if you're not using VBOs.

There are multiple conditions on which GL_INVALID_VALUE can be triggered during VBO creation, e.g. a negative count in glGenBuffers, invalid size / offset when dealing with glBufferSubData. Or maybe you got a bug when calling glVertexAttribPointer during your VBO setup (invalid attrib size, invalid stride or invalid index).

_________________
[Facebook] [YouTube Channel]
   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 576
@Daytona675x

I'm checking errors before and after glDrawArrays: if something goes wrong in VBO setup, is it possible that error is only triggered during glDrawArrays instead of glBufferSubData, for example?

glGenBuffers should be OK. It's hard coded with 8. I also tried to call 8 times glGenBuffers with parameter 1.

   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5029
@Daniel
Btw, talking about debug version of ogles2.library, maybe it possible (i.e. if you have time), to create some sort of build which will printf a lot of stuff to serial ? I mean, most of necessary things, vbos, VAs, attribs , what-where, etc, etc (can be controlled via ENV's or something). So with that debug library we can do more better checks when found bugs. + that one may have also -gstabs vesion (as one you send me), so will be all in one debug vesion of library which will help to detect stuff.

If have that kind of build, i for example will have no needs to ask you about special ogles2.library build with printing VA (that what we need to go futher with that bug in fricking-shark when f4 pressed and we have 0xfffffff coming from somewhere, but not from gl4es as we test).

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 576
@Daytona675x

Also error 1282 (GL_INVALID_OPERATION) is set during same glDrawArray() call.

- VBOs created:

https://github.com/AmigaPorts/SDL/blob ... /SDL_render_gles2.c#L2049

- position enabled:

https://github.com/AmigaPorts/SDL/blob ... /SDL_render_gles2.c#L2093

- VBO bound and data buffered: vertsize in this test is either 0 (clear command) or 32 (rectangle command) bytes:

https://github.com/AmigaPorts/SDL/blob ... /SDL_render_gles2.c#L1216

- vertex attribute pointer (stride and offset are 0):

https://github.com/AmigaPorts/SDL/blob ... /SDL_render_gles2.c#L1061

- attempt to draw:

https://github.com/AmigaPorts/SDL/blob ... /SDL_render_gles2.c#L1316


   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Just popping in
Joined:
2015/6/11 8:51
From Cologne
Posts: 195
@Capehill
Sorry, but it's easier if you simply compile an example of your stuff which is failing. Unfortunately I really don't have the time to check out your source and your information is too vague. Now we suddenly also got GL_INVALID_OPERATION. And glDrawArrays cannot even generate that However, a not bound VBO could provoke that e.g. when doing the glBuffer call (which would probably also explain everything else, including why it suddenly works if you don't use VBOs).

Please build the most minimal example you can come up with and put a download link here.

_________________
[Facebook] [YouTube Channel]
   Report Go to top

Re: OpenGL ES 2 and glDrawArrays
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 576
@Daytona675x

Sorry about unclear report: there was a bug in error macro, it had "if" instead of "while" so I didn't see both errors at first.

There is a test SDL2 test binary now on your FTP. It runs in a loop which basically clears the background (seems to work) and then draws a smaller black rectangle (should trigger GL errors).

   Report Go to top





[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project