glDrawElements gives 1282 error code

Yes, I have changed those aswell.

You should test glDrawElements() and ibo.length within it. From personal experience I’m still confused if this should be number of objects to draw, elements or number of bytes that the elements uses. Further, I type-set the pointer (GLvoid *) .
Yes, I’m another newb

Ah, good catch! When an index buffer is bound (i.e. there is a buffer object bound to GL_ELEMENT_ARRAY_BUFFER) the last parameter to glDrawElements is used to specify the offset into the buffer, so for most simple cases it should be 0 to use indices starting from the beginning of the buffer.

I’m trying to write the proper syntax, but the editor uses * (star-symbol) for formatting

My kode works when I use
(GLvoid *) + 0 [with extra white space]
Should I write it from memory I would probably
(*GLvoid) + 0
Should I reduce it from rationale:
( GLvoid ) + 0

On writing this, the symbols (with more spacing) may be interpreted as formatting
Could that happen in my code editor/compiler (CodeBlocks)?

You can use single back-ticks (“`”) to identify a string that should be formatted as code. For example, “`this is code`” becomes this is code. Formatting, aside from the closing back-tick, is ignored within the code. Hence: (GLvoid*)0).

Personally, I prefer reinterpret_cast<void*>(X) syntax, where X is the byte offset.

Quick respons!
I were still editing.

The problem now conserns how the code-editor will ingest it.

What your “code-editor” does is irrelevant (though any text editor worth using will know that it’s looking at C code and act accordingly). What matters is your compiler. Which has no knowledge of any form of text formatting.

As for the particulars of what you’re writing, that’s a matter of how C and C++ works.

  1. (GLvoid *) + 0 This works by accident. The “+ 0” will be interpreted as the literal 0 modified by the “+” prefix operand, which makes the value positive. Which 0 already is (by integer literal rules). Thus, this is no different from (GLvoid*)0.

    Also, outside of its use to separate token that need to be separated, C and C++ don’t care about whitespace.

  2. (*GLvoid) + 0 is a compile error. *GLvoid is not a valid type.

  3. ( GLvoid ) + 0 This performs a cast to the type void. Which discards the result of the + 0 expression. With certain exceptions in C++ (and this isn’t one of them), you cannot pass an expression of type void to anyone or do anything meaningful with it.

Always a pleasure to be serviced by you lot

I am struggling with this error.

GL CALLBACK:  type = 0x8251, severity = 0x826b, message = Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
GL CALLBACK:  type = 0x8251, severity = 0x826b, message = Buffer detailed info: Buffer object 2 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
GL CALLBACK: ** GL ERROR ** type = 0x824c, severity = 0x9146, message = GL_INVALID_VALUE error generated. Invalid size.
1281
GL CALLBACK:  type = 0x8251, severity = 0x826b, message = Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.

Here is my project:
https://github.com/AnnoyingB/Andromeda

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.