VBO doesn't draw anything

后端 未结 2 423
情话喂你
情话喂你 2021-01-24 07:48

I am trying to draw a square with VBO in my native blackberry 10 application. My implementation is,

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    g         


        
2条回答
  •  囚心锁ツ
    2021-01-24 08:47

    You are doing something weird to your buffer. Without knowing what tileCoordList is it's hard to say if you are adding the data correctly.

    In general, regarding both of your concerns here: VBOs store the data for you. It is not only possible, but encouraged to do:

    vbo_1, vbo_2;
    
    vbo1.LoadData(data_1);
    vbo2.LoadData(data_2);
    
    main_loop {
        vbo1.Bind();
        Draw();
        vbo2.Bind();
        Draw();
    }
    

    I have used pseudocode here, but you should get the idea. I don't understand what the SubData call is supposed to do; in general, one simple glBufferData should be enough. Bind call sets the buffer as an active one.

    This line made me cringe - why is VBOId public? Smells like a poorly designed abstraction to me:

    glGenBuffers(1,&decompressTileImage->VBOId);
    

    And oh, please don't use this->. The only thing it does here is worsen readability.

提交回复
热议问题