Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  EzEngine - Easy Wrapper for LWJGL  (Read 3736 times)
0 Members and 1 Guest are viewing this topic.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Posted 2013-01-21 15:33:54 »

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... Tongue
Will post this on Google Code, and make .jar when i get home. (or something Tongue)

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

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
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #1 - Posted 2013-01-22 11:20:18 »

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...
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #2 - Posted 2013-01-22 14:30:21 »

Added Texture support, use
1  
int texture = TextureLoader.loadTexture("");
to load textures.
Example added to First post.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #3 - Posted 2013-01-23 10:31:07 »

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.
Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #4 - Posted 2013-01-23 22:12:47 »

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.

novasharp
Offline davedes
« Reply #5 - Posted 2013-01-23 22:39:11 »

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

Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #6 - Posted 2013-01-23 22:44:51 »

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

novasharp
Offline HeroesGraveDev

JGO Kernel


Medals: 212
Projects: 11
Exp: 2 years


If it wasn't Awesome, it wasn't me.


« Reply #7 - Posted 2013-01-24 07:23:20 »

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.

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

Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #8 - Posted 2013-01-24 08:13:36 »

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.

Quad.draw(renderer, pos, size, texcoords, color)
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:
1  
Dragon.draw();

that would fit everybody's taste.

I will probably add something like this in the future:
1  
2  
3  
Cube.draw();
Hexagon.draw();
Model.addCube();

Offline HeroesGraveDev

JGO Kernel


Medals: 212
Projects: 11
Exp: 2 years


If it wasn't Awesome, it wasn't me.


« Reply #9 - Posted 2013-01-24 08:18:17 »

1  
2  
3  
4  
5  
[quote author=orogamo link=topic=28491.msg259669#msg259669 date=1359011616]

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:
[code]Dragon.draw();

that would fit everybody's taste.
[/code]

[/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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #10 - Posted 2013-01-24 10:00:43 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
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.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #11 - Posted 2013-01-25 16:20:43 »

Project currently on hold... Stare
Will start developing a SDL port of this project


EDIT:
Kicking life back in this project, will probably port to SDL later (maybe) Undecided
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #12 - Posted 2013-01-28 12:23:45 »

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

Example:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
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);
   }

}
Offline Sickan

Senior Member


Medals: 8



« Reply #13 - Posted 2013-01-28 15:16:01 »

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

I'm just here to learn.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #14 - Posted 2013-01-28 15:24:35 »

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

I'm norwegian Smiley
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #15 - Posted 2013-01-30 10:27:09 »

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

Senior Member


Medals: 5
Projects: 1



« Reply #16 - Posted 2013-01-30 15:30:46 »

Small tweaks and updated Example.java

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

Senior Member


Medals: 5
Projects: 1



« Reply #17 - Posted 2013-01-31 09:35:59 »

Fixed buggy Cel-Shading and Added demo application download.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #18 - Posted 2013-01-31 13:45:37 »

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

Senior Member


Medals: 5
Projects: 1



« Reply #19 - Posted 2013-02-01 10:07:15 »

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.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #20 - Posted 2013-02-01 13:22:51 »

A little Demo "Game"(not finished), showing off some Cel Shading Tongue
Download
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #21 - Posted 2013-04-17 12:00:31 »

After some a long time in the dark, this engine is now back.
I have already implemented TextRenderer and a 2D Graphics lib  Shocked

Example:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
import org.ezlwjgl.GL.*;
import org.lwjgl.input.Keyboard;

public class Example {

   public static void main(String[] args) {
      WindowManager.enableMouse = true;
      WindowManager.mouseGrab = true;
      WindowManager.enableKeyboard = true;
      WindowManager.createWindow("Test", 800, 600, 60);
      int texture = TextureLoader.loadTexture("/shop.png");
      while (true) {
         Renderer.make3D();
         Renderer.make2D();
         /**
          * ALIGN_CENTER align the text to center of screen
          * drawString(String text, int align) */

         Graphics.drawString("Center Aligned Text", Graphics.ALIGN_CENTER);

         /* drawString(String text, int textSize, double x, double y, double z) */
         Graphics.drawString("Absolute Coordinate Text", 1, 32, 250, 0);

         Graphics.drawString("Small text", .5, 32, 265, 0);

         Graphics.drawString("Big text", 2, 32, 275, 0);

         /* drawTexture(int textureID, double x, double y, double width, double height) */
         Graphics.drawTexture(texture, 0, 0, 32, 32);
         Graphics.drawString("<- Full texture draw", 1, 40, 8, 0);
         
         
         /**
          * Renders a tile from texture tile_x = tile x coordinate in pixels, tile_y = tile y coordinate in pixels, tile_w = tile width in pixels,
          * tile_h = tile height in pixels, size_x = texture width, size_y = texture height.
          *
          * drawTexture(int textureID, int tile_x, int tile_y, int tile_w, int tile_h, int size_x, int int size_y, double x, double y, double width, double height) */

         Graphics.drawTexture(texture, 0, 0, 16, 16, 32, 32, 0, 40, 32, 32);

         Graphics.drawString("<- Tiled texture draw", 1, 40, 48, 0);
         if (WindowManager.update() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
            break;
         }
      }
      WindowManager.destroyWindow();
   }
}

Produces:
Offline Danny02
« Reply #22 - Posted 2013-04-17 13:12:11 »

hi I took a quick look at the source of your textrenderer and you probably should take a look at for loops
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #23 - Posted 2013-04-17 13:43:07 »

hi I took a quick look at the source of your textrenderer and you probably should take a look at for loops

I know, just threw that TextRenderer together for an other project. (It's actually my first working text renderer Cheesy)
plus there are some font alignment issues(if you scroll down you'll see).
There were alot of copy-paste, but i'll probably look into adding some for loops at a later date.
Offline orogamo

Senior Member


Medals: 5
Projects: 1



« Reply #24 - Posted 2013-04-19 10:44:33 »

Added for loops to TextRenderer.java, it now contains 70% less code Tongue
100 - (538 / (1771 / 100)) = 69,621682665160926030491247882552% reduction
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (30 views)
2014-04-15 18:08:23

BurntPizza (27 views)
2014-04-15 03:46:01

UprightPath (42 views)
2014-04-14 17:39:50

UprightPath (24 views)
2014-04-14 17:35:47

Porlus (41 views)
2014-04-14 15:48:38

tom_mai78101 (63 views)
2014-04-10 04:04:31

BurntPizza (123 views)
2014-04-08 23:06:04

tom_mai78101 (222 views)
2014-04-05 13:34:39

trollwarrior1 (189 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!