glDrawArrays stops working when using ofCreateWindow

I have simple test code shown below that works in a default OF project.

GLuint bid;
    auto x = glm::vec3(-10, 10, 0);
    auto y = glm::vec3(100, 100, 0);
    auto z = glm::vec3(400, 200, 0);
    std::vector<glm::vec3> verts;
    verts.push_back(x); verts.push_back(y); verts.push_back(z);

    glGenBuffers(1, &bid);
    glBindBuffer(GL_ARRAY_BUFFER, bid);
    glBufferData(GL_ARRAY_BUFFER, verts.size() * sizeof(glm::vec3),, GL_STATIC_DRAW);
    glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), (void*)0);
    glDrawArrays(GL_TRIANGLES, 0, 3);

I switched out my main method to begin the OF shaders tutorial with the below snippet:

int main() {
	ofGLFWWindowSettings settings;
	settings.setGLVersion(3, 2); //we define the OpenGL version we want to use
	// settings.width = 1024;
	// settings.height = 768;
	// this kicks off the running of my app
	ofRunApp(new ofApp());
	return 0;

This causes any code that I have with glDrawArrays to stop working. (Though the shaders in the tutorial work correctly).
Is there something I am missing with ofCreateWindow that I have to add so that it I can use glDrawArrays in my project when following the shaders tutorial?


I would recommend you to use an ofMesh or ofVboMesh for making the same thing and it will handle properly everything. Which tutorial are you following?

I was looking at this, where they provide a new main method to use for trying out the shaders:

I’m about to try ofVboMesh - it’s probably the 3rd time I’ve been told to use it, though I’m still trying to get the standard opengl basics down.

sure but in that tutorial there is no direct calls to gl like the ones you are using. While it makes sense trying to understand how it works then it brings problems with the different versions of openGL and the different renderers which you are not handling while if you use ofMesh or ofVBOMesh with actually handle.
If you are curious how OF handles this you can peek here and here
Notice that there are two GL renderers, the old and the programable, the latter which you activate when calling ```
settings.setGLVersion(3, 2);