I have been following ThinMatrix’ tutorials on how to use LWJGL and OpenGL.
When loading data into a model they get stored in VBOs, which are stored in a VAO. My problem is that I don’t know how to specify in which VAO attribute list position which data is.
Currently, it’s like this and it works: 0 Vertex Positions | 1 Texture Coordinates | 2 Colors (and indices stored in an element array buffer).
I want to switch Colors and Texture Coordinates. By simply doing that my rendering doesn’t work correctly anymore. So how do I specify which attribute list position contains which data, when rendering a model?
Here’s my rendering code (working with color-data in 2 and uvCoords in 1):
GL30.glBindVertexArray( entity.getTexturedModel( ).getModel( ).getVaoId( ) );
GL20.glEnableVertexAttribArray( 0 );
GL20.glEnableVertexAttribArray( 1 );
GL20.glEnableVertexAttribArray( 2 );
Matrix4f transformationMatrix = MathUtil.createTransformationMatrix( entity.getPosition( ),entity.getRotation( ),entity.getScale( ) );
shader.loadTransfromationMatrix( transformationMatrix );
GL13.glActiveTexture( GL13.GL_TEXTURE0 );
GL11.glBindTexture( GL11.GL_TEXTURE_2D,entity.getTexturedModel( ).getTexture( ).getTextureId( ) );
GL11.glDrawElements( GL11.GL_TRIANGLES,entity.getTexturedModel( ).getModel( ).getVertexCouunt( ),GL11.GL_UNSIGNED_INT,0 );
GL20.glDisableVertexAttribArray( 0 );
GL20.glDisableVertexAttribArray( 1 );
GL20.glDisableVertexAttribArray( 2 );
GL30.glBindVertexArray( 0 );