I’m probably being an absolute idiot here ( as usual ) , i’m trying to render a simple shape in my new graphics engine and while the window is shown no image is shown on the screen. Below is the relative code.
public void render() {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
int index = 0;
for(index = 0; index < buffer_objects.size();index++){
BufferObject render_object = buffer_objects.get(index);
vbo_core.bind_shader();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, render_object.texture.id);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, render_object.vertex_id);
GL20.glEnableVertexAttribArray(vbo_core.locationattribvertex);
GL20.glEnableVertexAttribArray(vbo_core.locationattribtex);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER,render_object.vertex_id);
GL20.glVertexAttribPointer(vbo_core.locationattribvertex, 2,
GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, render_object.texture_id);
GL20.glVertexAttribPointer(vbo_core.locationattribtex, 2,
GL11.GL_FLOAT, false, 0, 0);
// Draw the textured rectangle
GL20.glUniform2f(vbo_core.locationdimension, width, height);
GL20.glUniform2f(vbo_core.locationtransform, render_object.translation.x,
render_object.translation.y);
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, render_object.vert_count);
GL20.glDisableVertexAttribArray(vbo_core.locationattribvertex);
GL20.glDisableVertexAttribArray(vbo_core.locationattribtex);
GL11.glEnable(GL11.GL_BLEND);
vbo_core.un_bind_shader();
}
}
public int create_buffer(int size , Vertex2d[] data,Texture t){
int index = create_buffer(size,t);
BufferObject buffer = buffer_objects.get(index);
for(Vertex2d vertex :data){
buffer.verticies.put(vertex.x);
buffer.textures.put(vertex.u);
buffer.verticies.put(vertex.y);
buffer.textures.put(vertex.v);
buffer.vert_count+=2;
}
buffer_objects.set(index,buffer);
buffer.flip();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, buffer.vertex_id);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer.verticies, GL15.GL_STREAM_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, buffer.texture_id);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer.textures, GL15.GL_STREAM_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
return index;
}
Any help an obvious error pointing out would be helpful.