Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Games Center / Featured Games / Re: The Intergalactic Trashman - PLAYABLE ALPHA VERY SOON!!! on: 2013-12-25 19:11:51
I have to disagree with you Axeman! I think the music sounds good. Not perfect but certainly not unpleasant either.

Gameplay looks fun and I really like the coherent art style!
2  Games Center / WIP games, tools & toy projects / Re: Copod on: 2013-11-10 01:35:25
I like the new colors, but I would go for a more consistent color palette. Don't go too far away from one color or just accent it.

Cool game overall!
3  Games Center / Showcase / Re: Ten Second Sketch [Ludum Dare Jam Entry] on: 2013-09-10 10:27:57
Awesome game ... played it through immediately! Last two levels took me quite some while Smiley
4  Discussions / General Discussions / Re: How hard it is to make a game like ace combat 3 in libgdx? on: 2013-08-15 11:54:37
Memory management is a pain in the ass. You really have to pay close attention what you do if you want to push the chance of some very retarded (silent) bugs below "likely". While working with C++ I learned to love the security of java memory management.

Also things like refactoring (in eclipse), built-in exceptions and the package-system make java such a comfortable language for me.
5  Game Development / Newbie & Debugging Questions / Re: I want to use Inheritance in a static way on: 2013-08-11 20:01:29
If you want to do things like static inheritance you probably should re-think your OO-design.

Why does the class Skill has fields specific to "Fishing" although you have an explicit class for it as well?
Why not instantiate skills? I could imagine different characters having a different skill-level makeing and OO-approach a necessity.
6  Discussions / Miscellaneous Topics / Re: Moving to Linux... on: 2013-05-28 13:48:43
If you really want to get into linux try it the arch way.

I first tried it 3 weeks ago (never used Linux before) and I'm totally into it. Also: Awesome WM  Cool
7  Discussions / Miscellaneous Topics / Re: What music do you listen to while you code? on: 2013-04-22 00:08:15
Tech/Deep House like
https://soundcloud.com/chlaurien/mix-april-2013  Pointing

Nothing with too dominant vocals or complex rhythms because that distracts me!
8  Discussions / Miscellaneous Topics / Re: Procrastination Issues on: 2013-04-13 20:44:33
A really good article on one of my favourite websites:
http://lesswrong.com/lw/3w3/how_to_beat_procrastination/
9  Java Game APIs & Engines / OpenGL Development / Re: GLSL and struct arrays on: 2013-04-07 15:58:21
Hm I see ... arg why is everything so uncomfortable ...

Another followup question:
Lets say I have 32 fixed lights. All have a specific position in model space. I have to transform these light coords with the mvpMatrix to get my light calaulations right. It makes absolutly no sense to perform this calculation for every fragment so I wanted to do it once in the vertex shader and then pass it via the positions via an out variable to my fragment shader. Problem is: The amount of "in"-variables in the fragment shader is limited. Much more limited then the amount of uniforms.

Is there a solution to this problem?
10  Java Game APIs & Engines / OpenGL Development / Re: GLSL and struct arrays on: 2013-04-06 23:16:37
Okay I found the problem! Thank you.
One followup question: Is there a way to determine the length of an implicit declared (uniform) array? .length() doesn't work. Is there some other way to iterate over the array?
11  Java Game APIs & Engines / OpenGL Development / Re: GLSL and struct arrays on: 2013-04-06 18:32:48
Wow thanks, I didn't konw that.
If I declare a uniform in the fragment shader because I only need it in the fragment shader, do I still have to declare it in vertex shader as well? My test suggests that but it doesn't really makes sense.
vertex shader
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
#version 140

in vec4 vertex_position;
in vec4 vertex_color;

uniform vec2 camera_offset;
uniform mat4 mvp_matrix;
// if I remove this the color uniform the uniform in the frag shader is not what it should be
uniform vec4 color;

out vec4 frag_position;
out vec4 frag_colorcode;

void main() {
   frag_position = vec4(vertex_position.xy - camera_offset.xy, vertex_position.zw) * mvp_matrix;
   frag_colorcode = vertex_color;
   gl_Position = frag_position;
}

fragment shader
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
 #version 140
 
//@insert global_lights.struct

in vec4 frag_position;
in vec4 frag_colorcode;

uniform vec4 color;
uniform Global_lights[] frag_lights;
 
 void main() {
    gl_FragColor = (color + frag_colorcode);
}


Thanks!
12  Java Game APIs & Engines / OpenGL Development / GLSL and struct arrays on: 2013-04-06 15:11:26
Hello,

I want to compute multiple lights in my fragment shader. I pass the light data to the vertex shader via a uniform struct[] and then I want to do something like that:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
struct Global_lights {
  ...
};

uniform ...
uniform Global_lights[] lights;

out ...
out Global_lights[] frag_lights;

void pass_lights() {
   frag_lights = lights;
}

The fragment shader:
1  
2  
3  
4  
5  
6  
struct Global_lights {
  ...
};

in ...
in Global_lights[] frag_lights;


If I try to compile this I get two errors:
Error compiling Shader
Vertex shader failed to compile with the following errors:
ERROR: 0:27: error(#282) Implicitly sized arrays can not be assigned to
ERROR: 0:27: error(#160) Cannot convert from: "uniform array of structure" to: "default out array of structure"
ERROR: error(#273) 2 compilation errors.  No code generated


I somewhat understand the error message but I'd like some kind of source to read what is allowed and what not. Can someone offer a soluting? The exact amount of lights has to variable.
Thanks!
13  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Problem with Viewport and Windows Aero vs. Basic on: 2013-03-30 22:13:11
I know this comes late, but I finally managed to resolve the problem and for further reference here the solution (that worked for me):
For some reason the LWJGL Display bugs out if you issue Display.create(...) before the Display.setResizable(true). So the solution for me was changing
1  
2  
3  
4  
5  
//...
Display.setDisplayMode(displayMode);
Display.create(pixelFormat);
Display.setResizable(resizable); // true
// ...

to
1  
2  
3  
4  
5  
// ...
Display.setDisplayMode(displayMode);
Display.setResizable(resizable); // true
Display.create(pixelFormat);
// ...
14  Java Game APIs & Engines / OpenGL Development / Re: Question regarding interaction between VAO bindings and sperate VBO bindings on: 2013-03-25 19:54:58
Thank you, everything works now and I can confirm:
You can bind and unbind the VBO / IBO as much as you want without disturbing the VAO.
15  Java Game APIs & Engines / OpenGL Development / Question regarding interaction between VAO bindings and sperate VBO bindings on: 2013-03-24 19:40:36
Hello,

I've got the following question for you:
When I set up my VAO I bind the VAO (glBindVertexArray) then bind the VBO (glBindBuffer(GL_ARRAY_BUFFER)) and IBO (glBindBuffer(GL_ELEMENT_ARRAY_BUFFER)) and then unbind the VAO. As I understand it now the VBO and the IBO are "connected" to the VAO and before I want to draw something I just have to call glBindVertexArray() (without binding the VBO and IBO again).

Now, can I bind the VBO / IBO separately (e.g. for calling glBufferSubData()) and don't lose the "connection" between VAO and VBO / IBO (or do I have to go through the hole binding VAO, then VBO/IBO again)?

I ask this question because I changed up some code (for optimizing performance) and now I get a
1  
org.lwjgl.opengl.OpenGLException: Cannot use offsets when Element Array Buffer Object is disabled 
I can't quite trace back where the problem is.
EDIT: Found the problem that caused the exception (missing glGenBuffers() call  Roll Eyes). Question above remains but now I think that I can bind/unbind the VBO/IBO as much as I want without losing the "connection". I'd be very grateful if some could confirm.
Thanks!
16  Game Development / Newbie & Debugging Questions / Re: Correct way to render thousands of polygons on: 2013-03-20 21:12:34
Hello,

I'm not sure what you mean by 1) but you will have to issue the following OpenGL calls every frame (assuming you interleave the data and have a single vbo):
> Bind the VBO (VAO if you use one - what you should do)
> Bind the shader program
> Call the GL draw methode (There are quite a few depending on how you set up your VBO / VAO) e.g. glDrawElements(...)
> Unbind the program
> Unbind the VBO (VAO)

Things you don't have to do and should not do every single frame:
> Uploading new/updated data. You should minimize the calls of glBufferData and glBufferSubData

Things you only have to do once:
> Compiling/Linking your program
> Generating a pointer to your VBO (glGenBuffer)


2)

Expensive GL calls are:
> Uploading data. Try to use uniforms (e.g. for (offset)-positions) as much as possible
> Switching VBOs (binding / unbinding). Try to use very few VBOs. I think 4 MB / VBO is recommended.

Less expensive:
> the drawing itself

3)
If all the quads (2 triangles) require the same vertex attributes (which I think they do) the pack the triangles in VBOs รก 4 MB. If you are using more than, say, 20 VBOs you are doing something wrong. So I would suggest that one object holds all the tiles which need the same vertex attributes and one VBO (or more if you have a huge number of triangles) for the geometry data.

One of the more experienced members of this form might give you better advice, but thats what I would suggest you to do.
17  Games Center / Cube World Projects / Re: Voxel - a start on: 2013-03-16 20:53:21
I don't know how much you know about (vertex & fragment) shader but you might want to look into setting positions via a shader uniform rather than modifying the vertex data itself (which is much more expensive). Since you're already useing OpenGL 3.1+ (VBOs) you might as well use shaders as well - if you are not using them already.

The loop would look something like that:
1. use shader program (glUseProgram) and upload the uniform offset (glUseUniform)
2. render the vbo
3. get the next vbo and continue

Of course this only works as described if all vertices share the same offset which should be the case with chunks.
18  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Problem with Viewport and Windows Aero vs. Basic on: 2013-03-13 18:47:07
Sorry this comes two days late, had lots of work to do. Here some code:

glInit (Display)
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  
   private void glInitContext() {
      DisplayMode displayMode = new DisplayMode(main.getWidth(), main.getHeight());
      windowDimensions = new int[] { 0, 0, main.getWidth(), main.getHeight() };
      PixelFormat pixelFormat = new PixelFormat().withSamples(8);
      try {
         Display.setDisplayMode(displayMode);
         Display.create(pixelFormat);
         Display.setTitle(title);
         Display.setResizable(resizable);
      } catch (LWJGLException e) {
         e.printStackTrace();
      }
      glEnable(GL_DEPTH_TEST);
      glDepthFunc(GL_LEQUAL);
      glDepthMask(true);
      glDepthRange(0.0f, 1.0f);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_MULTISAMPLE);
      glEnable(GL_SCISSOR_TEST);
      glViewport(0, 0, Display.getWidth(), Display.getHeight());
      glScissor(0, 0, Display.getWidth(), Display.getHeight());
      EPHVertexArrayObject.glInitShaderProgramPool(shaderParentPath);
      glInitialized = true;
      synchronized (glInitMonitor) {
         glInitMonitor.notifyAll();
      }
   }


glDraw (VAO)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public synchronized void glRender() {
      if (handle < 0 || !updated) glInit();
      if (size > 0 && hasVisibleEntries()) {
         glBindVertexArray(handle);
         glViewport(viewPortRect[0], viewPortRect[1], viewPortRect[2], viewPortRect[3]); // viewportRect is set correctly
        glScissor(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]); // scissorRect is also set correctly
                       // Binding the Program
                       // upload the uniforms
                       // glDrawElements(...)
                       // unbind the Program
        glBindVertexArray(0);
      }
   }


I'm not too sure what kind of code you'd like to see ... I thought this are the parts where the viewport is important .
19  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Problem with Viewport and Windows Aero vs. Basic on: 2013-03-11 09:55:16
I'm using 2.8.5 which should be the latest version. If someone has an idea feel free to post here. I think I might post it in the lwjgl forums as well an see if I get an answer there.
20  Java Game APIs & Engines / OpenGL Development / [LWJGL] Problem with Viewport and Windows Aero vs. Basic on: 2013-03-10 14:26:09
Hello,

today I used a different PC than I'm usually using for my OpenGL development. On my standard PC I run Win7 with Windows Aero ... everything works just fine. But on this new maschine I get a different result using Viewports:

Normal PC / different PC with basic (intended):


different PC with Aero (problem):


It appears that for same reason the glViewport(5, 5, widht, height) gets transformed to glViewport(10, 0, width, height) ... or something like that. I checked the glViewport call and the values are correct but the result stays flawed.
Also interesting: as soon as I change the displayMode or manually resize the window the viewport gets applyed correctly.

Can someone explain why this problem occurs?
Thanks!
21  Game Development / Game Mechanics / Simple Polygon Collision and (!) getting the intersection area on: 2013-03-07 21:58:06
Hello,

I know there a A LOT of collision threads and tutorials and what not, but after searching for ~1 hour I decided to create yet another thread:

I'm familiar with the SAT and (to same degree) PIP (Point in Polygon) algorithms and they're working fine, but I need additional information:
I need to know the "line" or set of vectors representing the intersection "cut" area:



I need either the red or the blue edge(part)s (depending on which polygon intersects which) as a set of vectors / lines. I know I can get the minimum translation vector via SAT but I can't come up with or find any ideas that give me what I want.

If someone has a link for me or can discribe how to get my intersection cut?
Thank you in advance!
22  Java Game APIs & Engines / OpenGL Development / Re: Very small sets of data and VAOs on: 2013-03-06 21:01:30
Could you explain what you mean with
Quote
configuring vertex attributes
?
Yes you might be right ... it just somehow bothers me to have such small VAOs as I do .... especially if you look at the recommended size of one VBO ...

It doesn't matter with my small application anyway ... thanks for answering though!
23  Java Game APIs & Engines / OpenGL Development / Very small sets of data and VAOs on: 2013-03-06 12:14:41
Hello,

I've got another question concerning modern OpenGL. In my application I have a few very small (!) sets of vertex data. The vertex attributes are very specific and dont fit in other VAOs I already have. E.g.: I've got 4 vertices and 6 indices (defining 1 quad) for a very specific animated background.
As stated the configuration of vertex attributes doesn't really fit the other VAOs and it would be ugly to force it into one of my existing VAOs (e.g. defining unused attributes or making the shadercode and variable naming very nasty).
But on the other hand its obviously far from optimal to create a new VAO including a VBO and IBO (with the lots of overhead on the client side as well as the cost of one additional VAO to switch between) either.

How would you suggest to deal with that?
Thanks in advance!

24  Game Development / Newbie & Debugging Questions / Questions regarding (VisualVM) profiling on: 2013-03-03 22:57:33
Hello,

today I tested the VisualVM Profiler on my current project and was quite suprised by the data it gave me. To understand the results I got I have some questions:

  • Watching the heap memory usage (monitor tab) I observed that my programm's used heap memory steadily increases until it hits ~25 MB used the drops to 3-5 MB within seconds and increases again. Is this normal behavior and why does it happen?
  • Watching the thread dispatching I noticed something strange: My gameloop is looping permanently with 1 MS sleep delay build in. I've got no other threads and my console output / fps-data suggests that the loop does what it is supposed to do. But the profiler says my loop-thread sleeps ~75% of the time. I think thats quite contradicting. Can someone explain this?
  • The profiler says that a thread called "RMI TCP Connection" allocates A LOT (75%) of data. Also the largest amount of data is char[] ... why?

Thanks in advance!
25  Java Game APIs & Engines / OpenGL Development / Re: Pooling VertexArrayObjects on: 2013-03-02 21:04:51
Okay thank you for your answer!

Just to plan for the "worst case":
Lets say I've got ~200 vaos with each ~100 vetices. Do you think that amount of data and switching would be to much for the average system?

26  Java Game APIs & Engines / OpenGL Development / Re: Pooling VertexArrayObjects on: 2013-03-02 20:03:07
I think you missunderstood me which may be due to my bad english (or just me explaining poorly).
I'm perfectly aware that one vao has excatly one vbo and how the binding works. Let me try to explain it a bit more detailed:

Lets assume we have 1 vao with 1 vbo and 1 ibo attached to it. The mode of the vao is GL_TRIANGLES and the attributes are 3 vec4 (float).
Each frame we bind the vao once. We bind our shader program (and upload uniforms) and use glDrawElements to draw the vbo to the screen. Then we unbind the program and the vao and do other stuff waiting for the next frame. Until now everything should be pretty normal indexed vao rendering.

In code:
1  
2  
3  
4  
5  
6  
7  
8  
public void render() {
    vao.glBind();
    shaderProgram.glBind();
    shaderProgram.uploadUniforms();
    glDrawElements(GL_TRIANGLES, vao.size(), GL_UNSIGNED_INT, 0);
    shaderProgram.glUnbind();
    vao.glUnbind();
}


So here comes my "idea":
The only thing set in stone here is the mode (GL_TRIANGLES) and the vertex attributes. Lets introduce "vao entries" represented by an object with specifies a data-section in the vbo and ibo (upper and lower bound). We render these entries using the offset in glDrawElements. It looks something like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void render() {
    vao.glBind();
    shaderProgram.glBind();
    shaderProgram.uploadUniforms();
    for(VAOEntry e : allVAOEntries) {
        glDrawElements(GL_TRIANGLES, e.upperBound - e.lowerBound, GL_UNSIGNED_INT, e.lowerBound);
    }
    shaderProgram.glUnbind();
    vao.glUnbind();
}


Now we render sections of the vao content separately using the same shader program. The last adjustment I make is giving each entry a separate shader program with the condition all shader programs use the same vertex attributes.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void render() {
    vao.glBind();
    for(VAOEntry e : allVAOEntries) {
         e.glBindShaderProgram();
        e.uploadUniforms();
        glDrawElements(GL_TRIANGLES, e.upperBound - e.lowerBound, GL_UNSIGNED_INT, e.lowerBound);
        e.glUnbindShaderProgram();
    }
    vao.glUnbind();
}


Now I want to create only one VAO for the most common mode / vertex attrib combination and use entries and different shader programs to store completly different graphic-objects in these vao (but all sharing the same mode and vertex attribs).

That minimises the amount of vao drastically as I'm combine "to-draw-objects" in one vao over the "interface" of a common mode and vertex attribs.

Hopefully its more comprehensible now.
27  Java Game APIs & Engines / OpenGL Development / Pooling VertexArrayObjects on: 2013-03-02 11:15:59
Hello,

I'm tinkering around with modern OpenGL (using vaos w/ indexed vbos) and efficient usage of vbos. My (hopefully reasonable) goal is to minimise the amount of vaos and in consequence less switching between vaos (which - as I understand it - is really expensive performancewise).

So the main difference between different vaos is the data storage namely the type (GL_POINT, GL_LINE, GL_TRIANGLE) and the attributes (datatype, name, location).

I observed that (at least) in my applications certain types of vaos are used very frequently:
  • [GL_TRIANGLE, (3x4 float Attrib)]
  • [GL_TRIANGLE, (4x4 float Attrib)]
  • [...]
Currently I have quite a decent amount of different vaos despite an overlap of this distinctive vao characteristic. So I thought about creating exactly one vao for each of these commonly used specifications and applying different shader programs with different uniforms as I need them. In other words: pooling commonly used vao specifications.

Possible downsides are:
  • increased shader program switching
  • forcing a standardised shader attrib naming for the pooled vaos and all shader programs I want to use with them
  • significant more effort required write the code manageing the pool
  • can you point out some more?

Do you think that might work at all? In my applications that would reduce the amount of vaos from ~80 to ~30 vaos which is quite a huge number. Do you think the performance increase is worth the hassle?

Thanks in advance!
28  Java Game APIs & Engines / OpenGL Development / (LWJGL) Subdivision of the Display on: 2013-01-22 20:23:39
Greetings!

I'm currently working on the basics of my lwjgl-project and got the following question:
How can I subdivide my Display into different parts? I need something like different clipping-panes for different parts. I think there is something in the fixed-function pipeline but I want to use non-deprecated OpenGL only!

To give you an example:
Say, I want to divide my display into two equally big parts (part 1 & 2) (vertically). I then want to render objects of type A to part 1 and objects of type B to part 2. Both should be clipped when crossing the vertical "boarderline".

One possible solution I already tested is simple discarding the fragments out of my imaginary clipping pane via frag-shader. But this seems like a rather ugly solution because I'd have to implement that in every frag-shader and so every object. I'm looking for a better option to to this.

Thank you in advance!
29  Discussions / General Discussions / Re: C++ for Modern OpenGL on: 2013-01-20 19:07:16
How can an specification be "made for" a language?
30  Discussions / General Discussions / Re: C++ for Modern OpenGL on: 2013-01-20 19:02:03
OpenGL is no programming language (its a specification) neither is it "made" for any particular language. Fact is that (the common) implementation(s) for OpenGL are written in C and thereby making it much easier to use these implementations in C / C++ (see the pointer-problem in Java).

The fact that most tools are written for C / C++ is that most applications that make use of OpenGL are traditionally written in C / C++.
To use modern OpenGL you need a modern implementation (and a wrapper for it if you cannot use that implementation dircetly). So feel free to use the JNI and the implementation dircetly or choose a modern wrapper framework like LWJGL or JOGL (for java).

Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (32 views)
2014-07-14 16:23:47

Riven (31 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!