Timeline for Problems with porting LWJGL code to C++ (glDrawElements call returns error 1281/GL_INVALID_VALUE)
Current License: CC BY-SA 4.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 26, 2022 at 10:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 27, 2021 at 5:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Mar 18, 2021 at 13:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Feb 16, 2021 at 12:15 | answer | added | Budschie | timeline score: 0 | |
Feb 16, 2021 at 11:00 | comment | added | Maximus Minimus |
Check your glBindBuffer (GL_ELEMENT_ARRAY_BUFFER calls - unless you've made such a call when your VAO is bound, then your index buffer is not in your VAO state. I also see that you're unbinding (...I really wish tutorials wouldn't do that...) so make sure that you don't unbind your GL_ELEMENT_ARRAY_BUFFER while your VAO is bound as well.
|
|
Feb 16, 2021 at 10:13 | comment | added | Budschie | Also, I should point out that I am using GLuint as the type of the index buffer. Could that be a problem? | |
Feb 16, 2021 at 10:11 | history | edited | Budschie | CC BY-SA 4.0 |
added 808 characters in body
|
Feb 16, 2021 at 10:10 | comment | added | Budschie | @MaximusMinimus Sorry if I am bothering you but how can I exactly check if my Indices Buffer is bound to my VAO? Also, I am gonna post how I load my VAO for debugging purposes. | |
Feb 16, 2021 at 9:54 | comment | added | Maximus Minimus | Can you check and confirm that you've actually got an index buffer bound when you draw? I see that you're using VAOs and the element array buffer binding is part of VAO state, not global state, so the glBindBuffer you do on creation won't hold after a VAO change. | |
Feb 16, 2021 at 9:32 | history | edited | Budschie | CC BY-SA 4.0 |
fixed formatting issues
|
Feb 16, 2021 at 9:26 | history | edited | Budschie | CC BY-SA 4.0 |
added 184 characters in body
|
Feb 16, 2021 at 9:23 | comment | added | Budschie | @MaximusMinimus Yes, indeed, if I call glDrawArrays like you've said, everything works fine. | |
Feb 16, 2021 at 8:25 | comment | added | Maximus Minimus |
Since you're only drawing a single triangle here, could you try it with glDrawArrays (GL_TRIANGLES, 0, 3) and see what happens? I'm not proposing this as a solution (otherwise it would be an answer not a comment) but as a troubleshooting step. If glDrawArrays works you have a problem in your index buffer setup. If glDrawArrays also fails your problem is most likely elsewhere. That should then help you narrow it down and get your glDrawElements call working.
|
|
Feb 15, 2021 at 20:01 | comment | added | Budschie | @Tyyppi_77 Yeah I saw that too... But unfortunately, after a quick debugging session, I could be sure that my vertices amount is not negative. In fact, the vertices amount is 3. | |
Feb 15, 2021 at 19:13 | comment | added | user35344 |
The docs for glDrawElements says that GL_INVALID_VALUE is returned if count , so planeVAO->getVerticesAmount() is negative. Could this be the case?
|
|
Feb 15, 2021 at 17:35 | review | First posts | |||
Feb 23, 2021 at 23:19 | |||||
Feb 15, 2021 at 17:35 | history | asked | Budschie | CC BY-SA 4.0 |