So I want to start doing stuff with OpenGL using LWJGL.
I understand the basic way of setting up a window, openGL, rendering loop.
But in all the tutorials I have read, not one shows how to render with OpenGL outside of a class. Its all hard coded.
The flow in java using the Graphics object basically goes
tell objects to draw themselves by passing them the Graphics object from your draw method.
public void drawSelf( Graphics g )
double x1 = (int)size >> 1;
double y1 = (int)size >> 1;
Graphics2D g2d = (Graphics2D)g.create();
Composite alphaComp = AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, (float) fade);
g2d.drawImage(texture, (int)(loc.x - x1), (int)(loc.y - y1), (int)size, (int)size, null);
So what is the flow for OpenGl? I know how to hardcode something in it like this
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
But how would you draw say a list of square objects?
Can you not pass them the resources they need to draw themselves?
Do you have to get their drawing information and then use that to drraw them?
I am lost and any help would be fantastic.