Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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 ... 7
1  Game Development / Newbie & Debugging Questions / [LWJGL] Sending multiple textures to sampler uniforms in openGL on: 2014-12-18 01:09:24
By convention, I've read on the internet and put into practice that to send a texture to a shader via sampler2D, you need to:
1  
2  
3  
glActiveTexture(GL13.GL_TEXTURE0 + textureUnit);
glBindTexture(GL_TEXTURE_2D, textureId);
glUniform1i(uniform, textureUnit);


But... why do we need textureUnit? Surely there must be some way of sending exactly the texture data to the shader without having to bind it to a texture unit... To me this just seems like an extra little bit of faff that isn't exactly needed...

Could someone explain?

Why couldn't something like this exist:
1  
2  
3  
glUniformSampler(glGetUniformLocation(shaderProgramId, "uSampler1"), texture1id);
glUniformSampler(glGetUniformLocation(shaderProgramId, "uSampler2"), texture2id);
glUniformSampler(glGetUniformLocation(shaderProgramId, "uSampler3"), texture3id);
2  Game Development / Newbie & Debugging Questions / Re: How to force OpenGL Version? on: 2014-12-15 21:19:53
To define a version in a shader just put:
1  
#version (version number)

at the first line of the shader!

For example, in a project of mine, I use version 150 (which I assume is opengl 3).
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
#version 150

uniform sampler2D sampler;
uniform sampler2D normalMap;
uniform float specular;
uniform float gloss;

in vec3 vNormal;
in vec2 vTexCoords;
in vec4 vColor;
in vec3 vEyePosition;

...
3  Game Development / Newbie & Debugging Questions / Re: "Wrong Component Type or Count" GLSL shader error on: 2014-12-15 16:50:39
I figured out the issue. I had a setup where I had two shaders; The normal render shader, and my test shader. When I switched to the test shader, I didn't set all of the uniforms (projection, telling all objects that the shader changed, ect).

All is well now Wink
4  Game Development / Newbie & Debugging Questions / Re: "Wrong Component Type or Count" GLSL shader error on: 2014-12-15 01:08:38
Also wrong data supplied to sampler.

Cas Smiley
Can you explain this?
5  Game Development / Newbie & Debugging Questions / Re: "Wrong Component Type or Count" GLSL shader error on: 2014-12-14 07:10:03
Well if I change the frag shader to:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
in vec3 vNormal;
in vec2 vTexCoords;
in vec4 vColour;
in vec3 vPosition;
in float depth_space;

vec3 floatToColor(float f) {
    return vec3(floor(f*255.0)/255.0,fract(f*255.0),fract(f*255.0*255.0));
}

void main() {
    vec4 textureSample = texture(sampler, vTexCoords);
    if(textureSample.a <= 0){
      discard;
   }

    out_Colour = textureSample * vColour;
}


It doesn't error. So how could it be related to a function called in Java?
6  Game Development / Newbie & Debugging Questions / "Wrong Component Type or Count" GLSL shader error on: 2014-12-14 00:40:55
Hello!
I am working on a small side project, and am experimenting with a 24-but depth buffer shader.

Vertex:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
out vec3 vNormal;
out vec3 vPosition;
out vec2 vTexCoords;
out vec4 vColour;
out float depth_space;

void main() {
    vec4 object_space_pos = vec4(in_Position, 1.0);
   
   vPosition = vec3(MATRIX_VIEW * MATRIX_OBJECT_POSITION) * in_Position;
   vNormal = MATRIX_NORMAL * in_Normal;
   
   vTexCoords = in_TextureCoord;
   vColour = in_Colour * VECTOR_OBJECT_COLOUR;
   
   // Set the correct vertex position
   gl_Position = MATRIX_PROJECTION_VIEW * MATRIX_OBJECT_POSITION * object_space_pos;
   
   vec4 viewSpacePos = MATRIX_VIEW * MATRIX_OBJECT_POSITION * object_space_pos;
   depth_space = viewSpacePos.z / 300.0;
}


Fragment:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
in vec3 vNormal;
in vec2 vTexCoords;
in vec4 vColour;
in vec3 vPosition;
in float depth_space;

vec3 floatToColor(float f) {
    return vec3(floor(f*255.0)/255.0,fract(f*255.0),fract(f*255.0*255.0));
}

void main() {
    vec4 textureSample = texture(sampler, vTexCoords);
    if(textureSample.a <= 0){
      discard;
   }

    out_Colour = vec4( floatToColor(depth_space), 1.0);
}


When running this shader in my game I run into this error:
1  
2  
3  
4  
5  
6  
[LWJGL] ARB_debug_output message
   ID: 1282
   Source: API
   Type: ERROR
   Severity: HIGH
   Message: GL_INVALID_OPERATION error generated. Wrong component type or count.


What's weird is that the shader seems to actually work... Here is the output:


What could be the issue?
7  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-11-25 01:55:53
It ran at 17 fps from the console. First time, it showed this exception:
Second time, I ran it, but configured every option to LOW, and it ran at 17fps.

May I ask what your specs are?
8  Game Development / Newbie & Debugging Questions / Re: [lwjgl] Cannot enable <cap> in the current profile. on: 2014-11-24 05:38:05
You can only enable/disable certain flags in Core profile, like, for example, GL_BLEND is perfectly valid there, but GL_TEXTURE_2D is not, that is deprecated. What flags are you using?
That was it. Texture 2d Smiley Thanks!

Quite odd that this error was not spamming in the console before.
9  Game Development / Newbie & Debugging Questions / Re: [lwjgl] Cannot enable <cap> in the current profile. on: 2014-11-24 05:28:50
I suspect that your old code is using
glEnable
function. That function is deprecated in core profile.
Interesting o:
I've used glEnable() a ton in my projects using core profile and I haven't run into this strange error.

Is there an alternative to glEnable?
10  Game Development / Newbie & Debugging Questions / Re: [lwjgl] Cannot enable <cap> in the current profile. on: 2014-11-24 05:23:35
Are you using Core profile?
yes:

1  
.withProfileCompatibility(false).withProfileCore(true).withDebug(true)
11  Game Development / Newbie & Debugging Questions / [solved] [lwjgl] Cannot enable <cap> in the current profile. on: 2014-11-24 05:20:14
Can someone explain this lwjgl error to me:
Quote
[LWJGL] ARB_debug_output message
   ID: 1280
   Source: API
   Type: ERROR
   Severity: HIGH
   Message: GL_INVALID_ENUM error generated. Cannot enable <cap> in the current profile.

It recently started popping up in an old project of mine; I am not quite sure why.
12  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-11-08 19:00:05
Well, unfortunately, it's not playable for me. First I found a bug when I input my name. Every character is inputted twice. Then the game is utter slow, only giving 1fps for me, but on windows it plays at constant 60fps.

Any Ideas?
Very odd... Does it yield the same result when run via console?
I'm getting a solid 60 fps/tickrate on my macbook pro.
13  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-11-07 22:21:11
I noticed that I had the wrong spawn location set. I have updated the file with the proper location.

It looks great, but before downloading, I'd like to know whether you've fixed the OS X bug, just because the download is large for me.
I had the chance to test it on my MAC; I opened it directly from double clicking the jar. It ran perfectly fine Smiley
14  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-11-07 03:27:42
It looks great, but before downloading, I'd like to know whether you've fixed the OS X bug, just because the download is large for me.
I haven't confirmed if it works on macos yet. Most likely it has the same error as before.
--
My artist made a bunch more kitchen stuff today. Brand new textures, and a counter model. I decided to release the progress so far Smiley

The animation smoothing is still a little... dodgy...

Enjoy Smiley
15  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-11-06 06:04:21
My artist made some neat-o pickup crates!




I've changed the player color slightly. It is a little less blue, and little more green; still however, it is a darker shade Smiley
16  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-30 22:33:07
There is food in the scene, because this is a kitchen design I started Smiley

Here's another screenshot depicting a new color change for the soldier:


I'm not quite sure which one I should go with. I personally like the darker one. Thoughts?
17  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-30 17:12:10
Here's a screenshot of what I've been working on today Smiley


I've also begun making a frame-interpolation system for the player animations. I'll get that finished and release the next demo Smiley
18  Game Development / Newbie & Debugging Questions / Re: [LWJGL] Change axis of a model when using matrices on: 2014-10-24 03:45:26
I figured it out Smiley

I had to translate it to the text origin, rotate it, then translate again to the specific coordinate of that letter (in relation to the text origin).
19  Game Development / Newbie & Debugging Questions / [Solved] [LWJGL] Change axis of a model when using matrices on: 2014-10-24 02:25:00
Hello!

I am trying to draw a line of text, but then rotate the whole line of text. Currently, each letter rotates independently, instead of following in a line.

This is how I have it setup at the moment:
  • Draw Text
    • Start drawing a letter
      • Translate matrix to specific x,y coordinate (for each letter, x increases)
      • Rotate matrix on z axis

What I think I need to do:
  • Draw Text
    • Start drawing a letter
      • Translate matrix to specific x,y coordinate of the START of where the text is drawn
      • Shift origin of matrix over on X axis by how far away the letter is
      • Rotate matrix on z axis



However, I do not know how to shift the origin of the matrix.
20  Game Development / Newbie & Debugging Questions / Re: Could someone explain this snippet of code i found? on: 2014-10-22 13:30:27
From what I can tell, the author of the code is setting the pixel color components (R, G, B) at a given location i based on the value of the "height" variable.

pixels is an array where each entry depicts a specific color value. Because it is 1-dimensional, you need to specify your own "width" in order to correctly draw the array.

-Any height less than 0 has a more "blue" color as that represents the water.
-Any height less than 2945 has a more "green" color as that represents grass
-Any height that is greater or equal to 2945 has (I think) a greenish-white color.
21  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-17 04:21:45
Update Smiley

Changes:
  • You can change graphics settings without leaving the game (does not yet work for textures)
  • A friend of mine mixed together some nice sounds for the game
  • Added "3d" sound type
  • Added Health bar
  • Players make a grunt sound when damaged
  • Players make a scream sound when they die
  • Changed rocket explosion sound
  • Added "FOV" for the enemies
  • Worked on the enemy AI a little bit
  • Added crouching (press C)

Download here

Other stuff:
I found the voice actor that worked on the original Army Men I game. He's agreed to help out with the game!
22  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-14 14:31:14
I don't know much about Trademark-Stuff, so i have to ask: Why do you think you could get problems? Are you using their models? 
If you created them yourself, could you really get problems, just cause they look similar?
In what I'm planning to create, the only thing that I am using that belongs to TakeTwo Interactive, is the name "Army Men".

Anyone can make a game about plastic soldiers as that's pretty darn generic. And no, I won't be using any resources from the older Army Men games.
23  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-14 14:14:51
anyway its not like you are right in front of making a massive game about this
Very true, but I don't know if they're like Nintendo and actively patrol all their Trademarks.
24  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-13 21:34:34
I contacted Trip Hawkens (original owner of 3DO). He isn't quite sure who owns the TM for Army Men now.

After searching through the USPTO Trademark Database, I found that there is one Trademark for the Army Men games still active. It is currently registered to Take-Two Interactive Software.

Fun.
25  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-12 23:05:00
- option screen, labels, white text on cyan background is ok but green-on-cyan-onmouseover is hard to read.
I've been meaning to change those menu buttons all together; they're from First Recon which has a more cyan-colored menu theme.

- option for master volume would be really nice, sound comes in very loud on my "regular" setup.
Can do! Smiley

- starting a game, going into settings does not allow going back to game (?), would be nice tho' Smiley
I'll make it so "esc" doesn't send you back to the titlescreen, and instead opens up a pause menu.

- got a few
java.lang.NullPointerException
, around
net.mantagames.anarchyengine.model.VBOModel.getVertex

I haven't seen this error in quite awhile. Would you  happen to have a full stacktrace?

- ARB Debug spams alot, after asking for ultra-shadows + SSAO, or shadows+textures on ultra. i guess a
GL_OUT_OF_MEMORY
caused a
GL_INVALID_FRAMEBUFFER_OPERATION

Hmm... I don't seem to be getting this debug error. I suppressed a few of the ones my machine was having (due to the newest version of my graphics drivers). I'll look into it! Smiley

- running-animation, could use interpolation. looks like it plays at 15 hz while the screen renders at 60 hz.
Yah, I'll be sure to add in player animation smoothing soon!

Thanks for the feedback!
26  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-12 13:29:53
New Update Wink
Link

Changes:
  • Created new test level (bathroom setting)
  • Added some temp enemies
  • You can kill soldiers by shooting them (unfinished)
  • Enemy soldiers can kill you
  • Changed green soldier color
  • Changed tan soldier color
  • Added a small animation when you first start to shoot (whilst standing)
  • You can no longer run while aiming your gun
  • Worked on climbing animation
  • Increased max size of shadow map resolution
27  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-10 19:05:55
The other is that every now and then, the screen flickers. It looks like as if the camera renders the scene from another position for a single frame. It's hard to explain, so i captured it in a video: http://jpct.de/pix/army.m2v

Turn off your forced Antialiasing through the NVidia Control Panel. We have the same GPU; I only get those rings around the shadows when I have it forced on 16x AA.
28  Game Development / Newbie & Debugging Questions / Re: (LWJGL) A new aproach on: 2014-10-08 12:06:02
Make sure you learn modern OpenGL Smiley
Rewriting a game to use it is never fun.
29  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-08 03:37:26
Not quite. There's still some shaking for me when pressing the right mouse button (i.e. zooming) in some situations (for example when standing left of the keyboard aiming at the computer).

Alright, I believe it is now all fixed! Smiley

Changes:
  • I believe I have fixed most/all occurrences of camera shaking
  • I added a new test level
  • holding ALT key unlocks the camera rotation from the player


Very impressive demo, nice job! Some of the edges of your sky box cube map are visible as black lines by the way! Smiley
Thanks for the compliment! Smiley
Yah, the cube map texture is just something I pulled off of google for the time being Tongue
30  Games Center / WIP games, tools & toy projects / Re: Army Men - a 3do fangame! on: 2014-10-07 15:10:35
I'm getting this when I run on my mac.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
Sris-iMac:ARMY MEN harsha$ java -Xmx1G -Xms1G -jar "Game.jar" nogui
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001054261af, pid=704, tid=3335
#
# JRE version: Java(TM) SE Runtime Environment (8.0_20-b26) (build 1.8.0_20-b26)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.20-b23 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.dylib+0x4261af]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/harsha/Downloads/ARMY MEN/hs_err_pid704.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Abort trap: 6
Sris-iMac:ARMY MEN harsha$

But works on windows, looks awesome.

Oh, you're right... It doesn't work on my mac either. I'll check that out! Smiley

[EDIT 1]
I can get it to work though eclipse on my mac, and /sometimes/ by double clicking the JAR directly. However, I can't seem to get it to run through terminal. I'll keep working on it!

[EDIT 2]
There's a new update available.

Changes:
-Fixed the camera shaking
-Fixed most (if not all) cases where the climbing animation doesn't work properly.
-Changed the color of the green soldier slightly
-Rockets now collide with soldiers (they don't do damage yet)

My artist made some new book models Smiley

Pages: [1] 2 3 ... 7
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29: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!