#Finding the cause of gldrawelements gl_invalid_operation

76 messages · Page 1 of 1 (latest)

grim umbra
#

please dont just dump files like that nobody has access to

#

consider putting your code on some website like github/gitlab

#

and also also dont just "this doesnt work!!!" "here my code"

compact geode
#

do you seriously think I know what is wrong when there is 0 error nor warnings ?

#

and I get 422 on github I cannot create a repo

grim umbra
#

@compact geode

#

why do you just leave this thread, man

#

fix your github issues

#

then provide the code like everyone else does as well

#

and then describe what you tried, what you think could be it, etc

#

the server is full of similar problems, you could utilize the searchbox too

grim umbra
#

also, you dont have to use dll injection, just launch your program with renderdoc

compact geode
#

to do that rendoc has to inject a dll . When I click run failed ot inject dll

grim umbra
#

no

compact geode
grim umbra
#

why hide the filename?

#

and can you show your settings for "General" and "Core"

#

@compact geode

compact geode
#

nevermind its libwinpthread-1.dll missing

#

because cglm uses it -_-

grim umbra
#

what?

compact geode
#

renderdoc is failing because, windows is failling to run my programme because my porgramme uses cglm to do math. Cglm needs libwinpthread-1.dll in Mingw64

grim umbra
#

dude

#

please speak in a comprehensable fashion

#

all these single fragments make no sense

#

especially if you seek help

#

: C

compact geode
#

Finding to cause of gldrawelements gl_invalid_operation

#

Finding the cause of gldrawelements gl_invalid_operation

#

now It should be not as hard to help me

grim umbra
#

idk what the f you do

#

which version of renderdoc did you use?

#

and why you are unable to tell me the options i asked for

#

is not helping either

#

;C

compact geode
#

what ... , the latest : 1.27 . I can open it just fine in my renderdoc

compact geode
#

@grim umbra do you want the xlm or chrome json ?

compact geode
#

17 API High Miscellaneous 1282 GL_INVALID_OPERATION error generated. Wrong component type or count.

#

I can confirm that the count isn't wrong and the type is GL_UNSIGNED_INT

#
GLuint indices[] =
            {
                    0, 1, 2,
                    0, 2, 3
            };
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
grim umbra
#

you need an index buffer for the indices

#

thats what i see in your bound indexbuffer

#

that looks wrong

compact geode
#

but I have an EBO, its strange

#
EBO initEBO(GLuint *indices, GLsizeiptr size) {
    EBO out = (EBO) malloc(sizeof(struct s_EBO));

    glGenBuffers(1, &out->ID);
    //BindTexture the VBO specifying it's a GL_ARRAY_BUFFER
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, out->ID);
    //Introduce the vertices into the VBO
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW);

    return out;
}

void bindEBO(EBO ebo) {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo->ID);
}

void unBindEBO(void) {
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

void deleteEBO(EBO ebo) {
    glDeleteBuffers(1, &ebo->ID);
    free(ebo);
}

//other file
Mesh initMesh(GLfloat vertices[], GLuint indices[], Texture textures[], uint8_t coordsOnly, uint64_t numberOfTexture,
              GLsizei numberOfIndices) {
    Mesh out = malloc(sizeof(struct s_Mesh));
    out->verticies = vertices;
    out->indices = indices;
    out->textures = textures;

    out->numberOfTexture = numberOfTexture;
    out->numberOfIndices = numberOfIndices;

    out->VAO = initVAO();

    bindVAO(out->VAO);
    // Generates Vertex Buffer Object and links it to vertices
    VBO VBO1 = initVBO(vertices, sizeof(out->verticies));
    bindVBO(VBO1);
    //Generates Element Buffer Object and links it to indices
    EBO EBO1 = initEBO(indices, sizeof(out->indices));
    bindEBO(EBO1);
    //Links VBO attributes such as coordinates and colors to VAO
    if (coordsOnly) {
        linkAttrib(VBO1, 0, 3, GL_FLOAT, 3 * sizeof(float), (void *) 0);
    } else {
        linkAttrib(VBO1, 0, 3, GL_FLOAT, 11 * sizeof(float), (void *) 0);
        linkAttrib(VBO1, 1, 3, GL_FLOAT, 11 * sizeof(float), (void *) (3 * sizeof(float)));
        linkAttrib(VBO1, 2, 2, GL_FLOAT, 11 * sizeof(float), (void *) (6 * sizeof(float)));
        linkAttrib(VBO1, 3, 3, GL_FLOAT, 11 * sizeof(float), (void *) (8 * sizeof(float)));
    }
    //UnbindTexture all to prevent accidentally modifying them
    unBindVAO();
    unBindVBO();
    unBindEBO();

    return out;
}
grim umbra
#

i suggest you dont use any abstraction

#

and just write your opengl thing in raw opengl, and keep it all in the main.cpp

#

until you have a complete understanding of all the things

#

and experimented with diffrent ways of rendering things perhaps

compact geode
#

I have a fully working one, it all broke when implementing the Mesh class. And I can't fugure what I am missing

grim umbra
#

drawindexed/instanced with and without textures... perhaps different vertex types

#

hmm

#

well but something is wrong with your vbo and ebo

#

you can see that if you look at the data in renderdoc

compact geode
#

it least I know where to look

grim umbra
#

your size is also wrong

#

glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW);

#

probably wrong for creating the vbo too

#

size is in machine units, not in element count

#

so 6 * sizeof(whateverdatattypeyouused)

compact geode
#

but the working one is EBO EBO1 = initEBO(indices, sizeof(indices));

#

of yes 24

#

so that's the issue

grim umbra
#

ye 24 is 6 * sizeof(uint) which is 6 * 4

compact geode
#

24 vs 88

grim umbra
#

make sure to h ave the openglspec open

#

to lookup what the params mean for all these glThis and glThat

#

its a bit conchfusing here and there and not always the same across all functions

#

88 sounds more like a vertex element

#

with pos/normal and uv for instance... that would be 3x4 + 3x4 + 2x8 ... ok thats more like 12 + 12 + 8 which is 32 times vertex count

#

3 vertices is 32 * 3, which is 96, 96 bytes to store 3 vertices

compact geode
#

its working now thank you