VBO Draws Cube Wrong

Started by jfbguy, April 01, 2012, 21:53:57

Previous topic - Next topic

jfbguy

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 :)

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;
    }

jfbguy

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?