EzEngine - Easy Wrapper for LWJGL

NOTE: Previous version were called EzRender, but the library will now be a “full wrapper”. So that name would’ve been misleading.

Library Download: Here
Source Code hosted on Google Code
Example here: Example.java
Demo: EzRender Demo

It is open source, so take it and run… :stuck_out_tongue:
Will post this on Google Code, and make .jar when i get home. (or something :P)

UPDATE:
Will now implement more EzFeatures like OpenAL & OpenCL :smiley:

This will be a base engine, made for easier OpenGL rendering.
I threw this together in about 1-2 hours at work, so it is not complete.
If anyone can find this useful, please comment and/or suggest new features.

A little wrapper for LWJGL, which makes it easier to render primitives(with GL_TRIANGLES).

Showing off 2D and 3D, small cubes in corners are 2D(fixed position/GUI)
And Cel Shading, you will see it better in the Demo

Code in Example.java

Found out that instead of using opengl 1 & 2 and up, i will stick to legacy 1.1.
And just make this lib more compatible with “old” computers.
I’ll probably add the opengl 2 and up later on, but for now I will stick with 1.1.
I will use pure OpenGL 1.1, no extensions/ARBs…

Added Texture support, use

int texture = TextureLoader.loadTexture("");

to load textures.
Example added to First post.

Added WindowManager which takes care of Display, Keyboard and Mouse creation.
Began working on Model.loadModel(), which will load Models from file(eventually).
Some small tweaks, updated Example.java accordingly.

This looks pretty awesome. I had tried doing 3-D before, but couldn’t figure out how to render complex models. I still haven’t. Hopefully I can learn from this. One question, are there any resources you would recommend learning about loading textures? I tried looking at The Red Book, but I am new to OpenGL and could not really understand most of it.

OpenGL Textures
Using Buffers with LWJGL
The rest of my GL tutorial series

Thanks. I will look at that. That looks much easier to understand than The Red Book. :slight_smile:

You really need a different system for rendering models. Having to type out all the vertices is what takes the longest time in the first place.

I’ve made classes for my own rendering engine which the programmer passes the basic information, and the class assembles that data into the vertices.

[icode]Quad.draw(renderer, pos, size, texcoords, color)[/icode] is easier than what you currently have.

This lib is for rendering complex structures, not quads and triangles.
I could make it the way you said, but how could I make a:

Dragon.draw();

that would fit everybody’s taste.

I will probably add something like this in the future:


Cube.draw();
Hexagon.draw();
Model.addCube();

[quote="orogamo,post:9,topic:40771"]

This lib is for rendering complex structures, not quads and triangles.
I could make it the way you said, but how could I make a:

Dragon.draw();


that would fit everybody's taste.

[/quote]
You don’t have to. Let the users of the library do that.

My point was to still allow passing the vertices to the renderer like you currently do, but add in helper classes like Quad etc.

And rendering a dragon would be much easier through my method than by creating all the vertices.

I’m planning on adding the following features(in the near feature):


Renderer r;

r.renderCube(float x, float y, float z, float size);
r.renderTexturedCube(float x, float y, float z, float size, int textures[]); // texture[] should consist of 6 textures (0 = top, 1 = bottom, 2 = northface, 3 = westface, etc.)

// renderTexturedCube() explanation:
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{0, 0, 0, 0, 0, 0} /*or pass null*/); // This would be the same as r.renderCube()
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, 0, 0, 0, 0}); // This would apply textures to top and bottom, and ignore the others.
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides, -1, -1, -1}); // This would apply textures to top and bottom, and will use the northFaceTexture on all sides.
r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides}); // Same as above

I will probably also add other primitive shapes.

Project currently on hold… :expressionless:
Will start developing a SDL port of this project

EDIT:
Kicking life back in this project, will probably port to SDL later (maybe) :-\

reAdded GLRenderer class.
You can now create your own renderer.

Example:


public class MyGLRenderer implements GLRenderer {

	public void render(Model m) {
		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(3, 0, m.getModel());

		if (m.isColored()) {
			glEnableClientState(GL_COLOR_ARRAY);
			if (m.isRGBA()) glColorPointer(4, 0, m.getColor());
			else glColorPointer(3, 0, m.getColor());
		}

		if (m.isTextured()) {
			glEnableClientState(GL_TEXTURE_COORD_ARRAY);
			glBindTexture(GL_TEXTURE_2D, m.getTexture());
			glTexCoordPointer(2, 0, m.getTextureCoords());
		}

		glDrawArrays(GL_TRIANGLES, 0, m.getVertexNum() / 3);
		glDisableClientState(GL_VERTEX_ARRAY);

		if (m.isColored()) glDisableClientState(GL_COLOR_ARRAY);
		if (m.isTextured()) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	}

} 

The author of the Google Code files say Lasse Skogland, are you Scandinavian (perhaps even Swedish) by any chance?

I’m norwegian :slight_smile:

New Features:
Made Renderer class static.
Added 2D and 3D support, Renderer.make2D() & Renderer.make3D()
Started working on a ModelBuilder.

Small tweaks and updated Example.java

EDIT:
Rendered outline behind the cube, (buggy) Cel Shading FTW

Fixed buggy Cel-Shading and Added demo application download.

Added Camera Controls,
WASD - Move Camera
Mouse - Rotate Camera Pitch & Yaw

Uploaded a Jar Library, which you can include in your project.
You will also need to include the LWJGL libs too.

I’m now going to make a small/medium game with this library,
and I will only use the functions included in this library.
By doing this I can implement missing features into the library.