LWJGL
June 18, 2013, 22:33:10 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: VBO Draws Cube Wrong  (Read 747 times)
jfbguy
Newbie
*
Posts: 6


« on: April 01, 2012, 14:53:57 »

So I scoured the forums, and many examples, and got my VBO to render to screen, but my vertices are all screwed up.  I assume it has to do with how I set the size or the stride.  With just doing vertices, I didn't think stride mattered at all.
Here is what my cube looks like

Here's my minimal code.  I double checked the float arrays that are placed in the Floatbuffer, and the vertices seemed to load in correctly.  Any help would be appreciated, thanks Smiley

Code:
public static boolean render() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);  // Clear The Screen And The Depth Buffer
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
   
    Camera.lookThrough();
   
    //VBO
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    Util.checkGLError();
   
    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, VBOVertexid);
    Util.checkGLError();
   
    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textures.get(0));
   

    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, objects.get(0).vertices.size());
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
   
        Lighting.setLightPosition(GL11.GL_LIGHT1);
       
        return true;
    }
Logged
jfbguy
Newbie
*
Posts: 6


« Reply #1 on: April 01, 2012, 15:34:05 »

Okay, I think my problem is I'm not using the faces information in my object file, thus I believe its only rendering the 8 vertices.  Quick last question, can I use the face information with OpenGL or do I have to calculate and add the triangles to the draw array when I'm loading in information from my object file?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!