Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (734)
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 3 ... 113
1  Game Development / Newbie & Debugging Questions / Re: lwjgl3 newbie texturing problem on: 2016-05-28 12:59:10
Create a debug context and add a debug callback. glGetError() both gives you very little information and reduces performance by forcing the driver to run single-threaded.
2  Game Development / Newbie & Debugging Questions / Re: lwjgl3 newbie texturing problem on: 2016-05-28 10:03:14
Yep, in early OpenGL versions GL_RGBA was a valid internal format, which indicated that the driver was free to choose the precision of the internal format. Theoretically the driver could choose GL_RGBA4 for example, but in practice GL_RGBA is just an alias for GL_RGBA8. For glTexStorage2D() they just made the API more explicit and disallowed GL_RGBA it seems.

You really should use a debug context to avoid missing OpenGL errors. You may even have gotten an exact error message detailing what you did wrong in this case.

EDIT: On Nvidia driver:
Quote
[LWJGL] ARB_debug_output message
   ID: 1280
   Source: API
   Type: ERROR
   Severity: HIGH
   Message: GL_INVALID_ENUM error generated. Internal format not supported.
   Stack trace:
java.lang.Exception: Stack trace
   at java.lang.Thread.dumpStack(Thread.java:1329)
   at engine.util.gl.debug.DebugCallbackHandler.invoke(DebugCallbackHandler.java:87)
   at org.lwjgl.opengl.GLDebugMessageARBCallback.callback(GLDebugMessageARBCallback.java:44)
   at org.lwjgl.system.JNI.callIIIIIV(Native Method)
   at org.lwjgl.opengl.GL42.glTexStorage2D(GL42.java:302)
   at random.test.DebugContextTest.main(DebugContextTest.java:37)
3  Game Development / Newbie & Debugging Questions / Re: lwjgl3 newbie texturing problem on: 2016-05-28 09:21:40
To explain why glTexParameteri() wasn't necessary with glTexStorage2D():

When glTexImage2D() is called the default values for BASE_LEVEL and MAX_LEVEL are these:
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 999);

When glTexStorage2D() is called the default values are:
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, mipmaps-1);

In other words, when glTexStorage2D() is used all mipmaps are allocated and the MAX_LEVEL parameter is set to include those mipmaps. With only 1 level in the texture, the texture is always complete regardless of the filtering used as all mipmaps up to MAX_LEVEL-1 are defined and ready.
4  Game Development / Newbie & Debugging Questions / Re: lwjgl3 newbie texturing problem on: 2016-05-28 08:38:14
I didn't read the entire thread, but I see no glTexParameteri() calls to set up filtering. The default near filter enables mipmapping, so if you don't have mipmaps defined the texture is considered incomplete and won't be readable from shaders.
5  Game Development / Newbie & Debugging Questions / Re: OpenGL - Batch Renderer with Multiple Objects and their Transformation Matrices on: 2016-05-28 08:30:16
Another very common problem is when you have a big world and need good precision matrices. Let's say you have a camera tracking an object at position (10 000 000, 10 000 000, 0). In this case, you would end up adding 10 000 000 to the XY coordinates of the model's vertices when multiplying by the model matrix, then subtracting 10 000 000 again when multiplying by the view matrix (which transforms the matrices to positions relative to the camera). At a scale of 10 000 000, 32-bit floats only have a 1.0 precision, meaning that every single vertex will essentially be rounded to the nearest integer coordinates after this transformation. If you were to precompute a model-view matrix by multiplying the two matrices together, you would end up with a similar but less severe precision problem as the individual vertices would not suffer from horrible precision (the shape of the model isn't completely broken) but the position of the camera and the translation of the model will still suffer from the same precision problem, causing objects to appear to stutter around. However, if you were to compute the model-view matrix at double precision and then finally upload it to OpenGL at 32-bit precision the matrix multiplication is carried out with such precision that you would need larger values than 10 000 000 before the precision of the final 32-bit matrix starts to suffer at all, and even farther before you actually start noticing problems due to that.
6  Game Development / Newbie & Debugging Questions / Re: OpenGL - Batch Renderer with Multiple Objects and their Transformation Matrices on: 2016-05-28 06:45:34
It's not unreasonable to use double quaternions/matrices for this reason. I use double precision view and projection matrices and convert the matrices to float matrices when uploading them to OpenGL.
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-27 16:29:52
<a href="http://www.youtube.com/v/755-fFD6hb0?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/755-fFD6hb0?version=3&amp;hl=en_US&amp;start=</a>
8  Game Development / Shared Code / Re: Bits, Bytes and Insanity on: 2016-05-27 16:23:03
Implement Huffman compression and decompression with it!
9  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-27 07:14:59
Whatever happened to: We Shall Wake?
We're working on it. I'll have a brand new super dynamic terrain system ready soon. The problem is that I have exams until mid-June, but the updates should start flowing after that.
10  Discussions / Miscellaneous Topics / Re: Going to China for 2 months on: 2016-05-23 02:59:11
Have fun!
11  Game Development / Newbie & Debugging Questions / Re: Adding delta value in character movements? on: 2016-05-22 15:21:15
<a href="http://www.youtube.com/v/o9dZm5h2oNQ?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/o9dZm5h2oNQ?version=3&amp;hl=en_US&amp;start=</a>

Don't be Call of Duty.
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-20 01:58:20
Hey everyone!! Today I implemented something I've been putting off for YEARS and holy Jesus I could not be happier that I finally put it in. It was easier than I was expecting and looks so stinkin' good in the game. Basically,

Dynamic 2d shadows! I'll post something on the devlog soon about how I accomplished it. I'm so stoked about how it turned out!!
HOW DID YOU DO THAT?! I MUST KNOW!!! What's the input??? That really looks like 3D shadow mapping!
13  Java Game APIs & Engines / OpenGL Development / Re: Vec4 Mathematics on: 2016-05-12 13:59:03
Way to miss the forest from the trees.
Your answer was technically off-topic. My answer covers the thread AND points out that your answer is technically off-topic. I can't think of a funny saying to point that out though, so I guess you win.

EDIT: If you want to continue this specific discussion we should probably do that by PMs so as not to bother everyone here. Pointing
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-12 13:56:58
As I'm heading to uni to do Game Development I have started learning c++ conventions as it's required in my course..... what an ugly language, their syntax is horrible, my cant I just do it in Java Sad
C++ conventions? What conventions?
15  Java Game APIs & Engines / OpenGL Development / Re: Vec4 Mathematics on: 2016-05-12 02:51:55
Vertex Cache, which i mentioned *is an optimization*. Potato Patato...
That still doesn't have anything to do with GLSL compiling.
16  Java Game APIs & Engines / OpenGL Development / Re: Vec4 Mathematics on: 2016-05-10 22:42:58
Does GLSL do any optimsations? If I pass a 3 x uniform matrix and multiple them in a vertex shader (model / view / projection), does GLSL recognise that the uniforms don't change and only calculate it once?
No, there's no evidence that any driver does this specific optimization. For example:
1  
gl_Position = projection * view * model * vec4(position, 1.0);

compiles to: http://www.java-gaming.org/?action=pastebin&id=1448, and can be optimized massively as this is 2 complete 4x4 matrix multiplications followed by a vector multiplication, which can be optimized to this (monstrous):
1  
gl_Position = projection * vec4((view * vec4((model * vec4(position, 1.0)).xyz, 1.0)).xyz, 1.0);

which only compiles to: http://www.java-gaming.org/?action=pastebin&id=1449

Simple reordering of operations and assuming that the view and model matrices are affine matrices can make your shader go from 52 ALU cycles to 13 cycles. In practice this is not a that big difference as vertex shaders are often bottlenecked by the number of output parameters, but for simple vertex shaders like shadow mapping vertex shaders that only output gl_Position you should always optimize the shader as much as possible.

Quote
does GLSL do any optimsations?
Yes it does, but it depends and implementation specific. ie it is up to the vendor. Assuming your using indexed primitives it can cache vertex calculations. ie properly optimized triangle soups you will very rarely calculate a vertex twice. But typically each and every vertex is calculated once even if some calculations can be taken "out of the vertex loop". But again it is Meh since cards these days just never seem to hit vertex limits anymore, matrix calculations in fragments. Well that is a different story.
What you're talking about is indexed rendering. If you draw a quad using 4 vertices and 6 indices forming two triangles, the vertex shader will only run 4 times (once for each vertex, not index). This is because the vertex shader's output is cached in a finite-size cache (meaning that it MAY need to be rerun if it's used after being evicted from the cache, but not in a trivial case like this), which allows OpenGL to reuse the vertex when building the two triangles. It has nothing to do with the shader's compilation or performance.


EDIT:
To actually answer the question if it's worth doing on the CPU or the GPU: It depends.

In a 2D game, you're usually CPU limited by small draw calls, sorting of sprites, game logic, etc. In addition, you're usually waaaaay underutilizing the GPU with super-simple shaders, tiny texture formats (RGBA8), so anything you can offload to the GPU is usually a win.

For 3D games, you're usually heavily GPU limited by the sheer number of pixels and triangles you have to work with, heavy post-processing shaders, shadow maps, etc etc etc. In this case, optimize everything you can on the CPU. Premultiplying the view and projection matrices can save 20 instructions per vertex X 1 million vertices of GPU performance. It's all a lot more complicated as the GPU has lots of individual hardware that can all bottleneck you in different ways, so it's not a straightforward answer. In general, the answer is "premultiply everything you possibly can on the CPU" unless proven otherwise, which it never usually is.
17  Game Development / Newbie & Debugging Questions / Re: Bloom effect on: 2016-05-10 22:00:08
You have a couple of misunderstandings here.

An FBO does not contain any actual data. What an FBO does is allow you to draw things to a texture. The FBO itself has no actual data; it just tells OpenGL where to put the result of your pixel shader at the end.

Secondly, using an FBO takes very little CPU cycles. The actual gaussian blur shader and the writing to the texture all happens in your graphics card, so it doesn't actually cost any CPU cycles at all (as long as your GPU is fast enough and doesn't lag behind, forcing the CPU to wait for it to catch up).
18  Game Development / Newbie & Debugging Questions / Re: Bloom effect on: 2016-05-10 20:36:47
It is not possible to do bloom without using FBOs. Why are you asking?
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-10 15:27:31
As long as you are below 5 or 15 seconds (depending on if you show loading screen on every level/area loading or only once when game is starting) you don't have anything to worry about. Smiley
I appreciate every effort game developers make to reduce load times. I'm disappointed that multithreaded loading is not more common in CPU limited loads...
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-05-09 03:49:36
Been working on lots of different things, as well as getting all bogged down by school. Reworked our sound engine completely, fixed multiple OGG streams (a static sample buffer? REALLY?!), etc, etc...

Anyway, I implemented a nice little idea I had while chatting with orange451 regarding skyboxes today. The problem with all the nice-looking skyboxes online is that they're not HDR. They often have a sun or bright stars or whatever on them that just end up looking gray and dull when drawn in a HDR game. For example, both a somewhat bright cloud and the gigantic bloom of the sun are both ~0.95-0.98 brightness, but the HDR difference between them is of course huge (>2 magnitudes). They'll essentially be equally bright, even though the 0.03 brighter sun should 100 brighter and bloom as hell (not just be a picture with bloom added to it). The problem is that photos used for sky boxes are essentially "tone mapped" to LDR by the physical limitations of the camera and then saved in common LDR formats, so information is somewhat lost. However, it's possible to partly kinda reconstruct the HDR colors by......... using an inverse tone mapping function. x___x The idea is to take the inverse of a simple tone-mapping function like (color / (1+color)) and apply that to the read LDR colors. It's actually fairly accurate, but we get very low bit precision at higher colors. We also have a problem with the tone mapping function's output approaching 1.0 when the light approaches infinity, so if the skybox contains perfect white 1.0 we end up calculating an infinite HDR color, so some tweaking needs to be done. Anyway, I tried it out. The left half of the image shows the inverse tone mapped sky box, while the right one shows the usual LDR sky box.




(Please right-click the image and open it in a new tab to get a much higher resolution image!)

We can see that the really bright stars and the blue nebula things are much brighter on the left half of the image, even triggering my HQ bloom filter that can bleed over foreground objects.. The right side stars look duller and... fake, as their bloom is baked into the skybox. They're not as bright as they should be.




Here's a second image of the same sky with a massive amount of HDR-correct motion blur applied. The dull right-hand side stars almost completely disappear as they're smeared out since they're already so dim, but the inverse tone-mapped stars explode into awesome looking streaks thanks to their HDR colors. It looks amazing and really catches your eye in motion.

This is essentially only useful for the night sky in WSW, as the atmospheric scattering during the day is calculated based on physical algorithms and produced in HDR already, but it really adds a kick to the night stars!


EDIT: Bonus picture with HDR applied to the whole screen!


EDIT2: Kinda looks like the FF7 opening movie... =P
21  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-03 21:01:54
have you tried implementing mouse smoothing?

Usually done by interpolating the mouse position between either:

1) where the mouse was and where it should be (previous polled position and current polled position)
or
2) where it currently is and by predicting where it will be the next time its polled (current polled position and predicted next position).

Rather than jumping between mouse positions you can move the cursor at a constant speed between mouse positions or draw it at an interpolated position between the two positions at the time the frame is rendered.

This should hide small amounts of lag and give the appearance of smooth movement.
This doesn't really help in this case. It's not that the mouse isn't polled often enough; it's that the screen isn't redrawn fast enough. Interpolation won't help if the mouse position only updates 10 times per second.
22  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3 vs JOGL on: 2016-05-03 08:21:10
I had a loop that created a few hundred FBOs and 1-3% would be 'incomplete' and always render as white.
Ehh? I've never had that problem. What driver and GPU?
23  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 18:48:01
I (honestly) was thinking about that solution too - but it makes your (gameplay) framerate issues even worse, especially when vsync is on.
If it's dynamic enough and only activates at <half the monitor's refresh rate, it should be OK. It might improve the perceived responsibility.
24  Game Development / Game Mechanics / Re: Hardware-like software cursor. on: 2016-05-01 15:21:52
A crazy solution would be to detect frame rate drops and when those happen draw a dummy frame. You'd just copy the contents of the previous frame to the screen (without the old mouse) and redraw the mouse in its new position, effectively doubling the mouse's frame rate compared to the rest of the game's. It would have a tiny bit of overhead (1 fullscreen pass for each extra frame to copy the previous one), but could help a lot if mouse smoothness is critical.
25  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3 vs JOGL on: 2016-04-28 15:02:37
I still can't actually use it commercially, myself, because GLFW still doesn't have buffered controller input :/

Cas Smiley
Hmm? What is "buffered controller input"?
EDIT: This issue? https://github.com/glfw/glfw/issues/601
26  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3 vs JOGL on: 2016-04-28 14:27:59
I'd like to chime in that I do not consider GLFW to be the gold standard of windowing systems yet. It's lacking certain features from LWJGL 2, but most of these have been fixed last month or so. Fullscreen switching without having to recreate the window is in, but it still isn't possible to change from normal windowed to borderless windowed for example. Also, the window icon support is very limited right now. That being said, LWJGL 3 is really frigging great in general.
27  Game Development / Networking & Multiplayer / Re: Port Mapper port forwarding library on: 2016-04-28 02:24:02
How did this not get more attention?!
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-04-27 01:58:11
It took me a few months, but I finally decided to sit down and try my luck at R-trees again. I managed to get basic insertion/split logic working at last.


There's currently a lot of overlap (I think I'm using quadratic splitting right now? o_O), so I'm gonna try my luck at implementing R*-insertion and possibly try my luck on some refining tomorrow.

29  Game Development / Game Mechanics / Re: [java] Rapid trigonometric calculations on: 2016-04-19 18:51:14
See this link: http://www.java-gaming.org/topics/extremely-fast-sine-cosine/36469/view.html
Feel free to compare it against those implementations.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-04-14 20:12:45
I drew my first Vulkan triangle! Grin Grin Grin
Pages: [1] 2 3 ... 113
 
DarkCart (18 views)
2016-05-29 02:30:33

Hydroque (36 views)
2016-05-26 14:45:46

Mac70 (45 views)
2016-05-24 21:16:33

theagentd (49 views)
2016-05-14 18:38:35

theagentd (84 views)
2016-05-10 22:37:41

theagentd (89 views)
2016-05-10 22:33:46

IanParcs (117 views)
2016-04-18 14:18:53

KaiHH (114 views)
2016-04-18 08:35:41

KaiHH (135 views)
2016-04-15 12:43:58

theagentd (141 views)
2016-04-14 02:16:17
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50
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!