LWJGL calls in Slick2D code.

I know that slick2d is built on top of LWJGL but when I try to use an immediate mode call like this:


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1f, 1f, 1f);
glBegin(GL_LINES);
 glVertex2f(10, 5);
 glVertex2f(10, 15);
glEnd();

I don’t understand as this is valid LWJGL code yet it does not work in slick. Does it have something to do with the spritebatch or something? IDK.

OpenGL is a state machine. Slick sets its state up to be right for how it renders it. You can’t just type some code and assume it’ll be in the right state for exactly what you want to do. Use Slick or use OpenGL directly.

You want to use one of these:

http://slick.ninjacave.com/javadoc/org/newdawn/slick/opengl/SlickCallable.html

Cheers,

Kev

Thanks Kev!

One question, your website is Coke and Code right? Does that mean you made Slick2d?

He did indeed.

I did a long time ago in a galaxy far far away. I don’t make libraries any more, don’t have the time. Focusing on the games :slight_smile:

Cheers,

Kev