Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 ... 26
1  Game Development / Newbie & Debugging Questions / Re: Floating point texture issue on: 2014-07-20 11:27:46
I have come back to the problem and it was trivial, and yet silly. I needed to transpose the data I uploaded. OpenGL textures are uploaded in column order, and not row order. If your data is in row order then simply transpose it.

The solution was obvious after I noticed certain patterns, then I though there might be some funny rotation issues. Uploaded a 3x3 texture and compared it to the image I was generating and noticed it immediately.

1  
2  
3  
4  
5  
6  
val colourData = Array.tabulate(rows, cols)((i, j) => {
      val depth = fbm(i, j)
      val c = getSubSpriteData(depth)._3
      imgColData.setRGB(i, j, new Color(c(0), c(1), c(2)).getRGB)
      List(c(0), c(1), c(2), 0.0f)
    }).transpose.flatten.flatten.array
2  Game Development / Newbie & Debugging Questions / Floating point texture issue on: 2014-07-12 06:21:02
Here is how I use and upload the texture to OpenGL.
http://pastebin.com/GGjNGhhq

1  
2  
3  
4  
5  
6  
7  
8  
val colData = Array.tabulate(rows, cols)((i, j) => {
      //val depth = fbm(i, j)
     //val c = getSubSpriteData(depth)._3
     val tc = if (((i&8)==0)^((j&8)==0)) List(1.0f, 1.0f, 1.0f)  else List(0.0f, 0.0f, 0.0f)
      tc
}).flatMap(arr => arr.flatMap(l => l)).array

tileColours = new DataGL(colData, rows, cols, 3, 2)


Distortion:
http://postimg.org/image/46lthwo3z/

This does not occur if I throw my data into an image and then upload it.

Now, if I save this result as an image and upload that to my GPU it works perfectly. However I would rather directly upload data to the GPU than encode it into an image and upload that.

The shader simply does a UV mapping like so:
1  
2  
3  
4  
5  
6  
7  
vec2 getUV() {
    vec2 uv = gl_FragCoord.xy/viewport;
    uv.y = 1. - uv.y;
    return uv;
}

vec3 col = texture2D(subspriteColours, getUV()).rgb;


I should add that I am not using PO2 dimensions, which strangely enough work without issue. The data stored is a dimension of (120, 45), however I can save the non-po2 data as a non-po2 image and load that perfectly. The issue is purely when uploading the above data (or any, but this example shows the problem perfectly), I have tried other RGB modes as well, but the issue persists, which leads me to believe a possible driver issue.
3  Java Game APIs & Engines / JOGL Development / Re: Where to initialize OpenGL objects after the init method has passed? on: 2008-10-12 15:03:11
You're right but if he kept this reference passed to the constructor to render the VBO, it would be unsafe.

That was never an issue. I made sure to read documentation thoroughly before doing something.
https://jogl.dev.java.net/nonav/source/browse/*checkout*/jogl/doc/userguide/index.html?rev=HEAD&content-type=text/html

Under the section "Writing a GLEventListener":
Quote
It is strongly recommended that applications always refetch the GL object out of the GLAutoDrawable upon each call to the init(), display() and reshape() methods and pass the GL object down on the stack to any drawing routines, as opposed to storing the GL in a field and referencing it from there.

Sample init code:
1  
2  
3  
4  
5  
public void init(GLAutoDrawable drawable) {
        GL gl = drawable.getGL();
        ...
        this.prog = new ShaderProgram(gl, vert, geo, frag);
        ...


Render code:
1  
2  
3  
4  
5  
6  
public void display(GLAutoDrawable drawable) {
        GL gl = drawable.getGL();
        prog.enable(gl);
               ...
        prog.disable(gl);
        ...





OP:
If I need to initialise a new object within the game, I use an existing renderable item (I load up everything in the first shot) and change it's properties. For instance, properties of shaders can be changed like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
public void enable(GL gl) {
        gl.glUseProgram(this.id);
       
        while(!this.glVariables.isEmpty()) {
            GLSLVariable variable = this.glVariables.remove(0);
            int location = variable.getLocation(gl, this.id);
            variable.setValue(gl, location);
        }
    }


On the other hand if you wish to pass new geometry it would be worth looking into various data structures and patterns (The state pattern looks suited to this) depending on your existing design.
4  Java Game APIs & Engines / JOGL Development / Re: Where to initialize OpenGL objects after the init method has passed? on: 2008-10-12 09:11:53
I pass the GL reference to my constructor and initialise everything there, it works out very nicely. I'm big on RAII.
5  Game Development / Newbie & Debugging Questions / Re: Graphics and Threads on: 2008-10-04 08:34:50
Threads are a good idea! The problem is that people don't know how to use them. I'm currently developing a game for advanced software engineering (postgrad) and I have to use Agent Oriented Software Engineering, to put it simply everything is in a thread.

Use executors.
Use atomic variables/data structures.
Create your own lock-free algorithms (if you have to, but this can be very difficult).

The easiest way of doing things is what the other suggest, but if you have the time and want to learn what every software developer will need to know in the next decade then go with a proper threaded model.
6  Discussions / Miscellaneous Topics / Re: I can't believe the forums still work on: 2007-05-02 11:27:42
Sorry, my URL I use is:
http://community.java.net/games/

I get redirected to my above posted URL.
Stole it off my bookmarks. Maybe I should update them.
7  Discussions / Miscellaneous Topics / Re: I can't believe the forums still work on: 2007-04-30 00:34:47
I get this:
https://games.dev.java.net/nonav/index.html
8  Discussions / Miscellaneous Topics / I can't believe the forums still work on: 2007-04-29 18:16:04
Everyone forgot about me that they didn't e-mail me about the fact that the forums work.  Roll Eyes
I'm not smart enough to figure out that forums work despite the front page.  Tongue

Anyway, I just wanted to say "Hello" because it's been a while since I last participated in this wonderful community.
9  Discussions / General Discussions / Re: How do we calculate the angle between two vectors? on: 2007-03-09 05:14:29
Sorry.
I'm a f'ing idiot, lets move on.
10  Discussions / General Discussions / Re: How do we calculate the angle between two vectors? on: 2007-03-08 21:52:25
If you want to stick to doing this some other way that's fine, however I'm sticking to my dot products and differential manifolds.
It's obvious that I cannot tell what you are asking by the last several posts.

Why would you use the dot product and why did you ask how to calculate the dot product when it's not what you're after?
11  Discussions / General Discussions / Re: How do we calculate the angle between two vectors? on: 2007-03-08 06:50:17
I wonder why that's yet to happen to me? Oh! I now what I'm doing. Smiley
Sorry but the dot product is defined as above. You seem to be having trouble modelling a situation by the looks of it, you obviously don't know what you are talking about or the solution given by reading your above posts.

Quote
I already know the solution. This is just a challenge question. But i bet most of these sites point out the inner product as the solution which is not correct and will lead people to compute the wrong angle 50% of the time.
12  Discussions / General Discussions / Re: How do we calculate the angle between two vectors? on: 2007-03-07 13:17:27
I never directly work with angles.

acos(1)
   -5.313886335150516808261004276581286123443877333843750081075849201e-85

Which in effect is actually supposed to be 0.

I'm sure alternatives can be used within a given context. Why don't you just use differential equations to compute the angle if that's what you're really after?
There are hundreds of ways to derive the same thing via alternative methods.
13  Java Game APIs & Engines / Tools Discussion / Re: How do you work with 3D Models? on: 2007-03-06 03:32:12
Parsing 3D files is simple, you get the specifications about the format you will or are going to work in and parse it according to that spec.
14  Discussions / General Discussions / Re: How do we calculate the angle between two vectors? on: 2007-03-06 03:29:01
u.v/|u|.|v| = cos(t)
15  Discussions / Miscellaneous Topics / Re: You know your a java geek when... on: 2007-02-28 08:19:14
When the only ASM you know is Java byte code.
16  Discussions / Miscellaneous Topics / Re: Should Java's clone method still be avoided? on: 2007-02-25 15:50:25
As I remember the problem was that memory being copied from one place to another via clone wasn't being done properly. This was a good few years back.
It was even discussed en mass on these forums. Some members even mentioned clone() was slower than creating a new object with the current object's properties.
17  Discussions / Miscellaneous Topics / Re: Should Java's clone method still be avoided? on: 2007-02-25 13:15:00
http://www.javapractices.com/Topic71.cjp
http://www.artima.com/intv/issues3.html

I consider this a bug.
18  Discussions / Miscellaneous Topics / Should Java's clone method still be avoided? on: 2007-02-23 14:17:49
Just wandering if the clone issue is fixed.
I've not heard of it since it's last mentioned that there was going to be a fix for Mustang, but that was several years ago.
19  Java Game APIs & Engines / JOGL Development / Re: JSR-231 1.1.0 Release Candidate 3 Released on: 2007-02-23 08:51:35
Question:
Is gl_pixel_buffer_object_ext is supported?
20  Game Development / Performance Tuning / Re: Making multiple TriangleStrips Vs. one long Triangle array on: 2007-02-21 11:28:27
1/8th of what I do. Smiley

Quote
So thats frustum culling?
21  Game Development / Performance Tuning / Re: Making multiple TriangleStrips Vs. one long Triangle array on: 2007-02-19 14:20:17
That's what I said/meant.
I split my geometry up into 2MB junks in an oct tree and then buffer each segment in video memory via VBOs.

However, I usually test my algorithms with data greater than what my video card can handle, so then I have to use statistics to determine what objects are visible and what sub objects of those objects are visible.
It's far more complicated than that but in any case the way I do things now makes things performingly viable. I've yet to see anything faster than what I do now.

It's not.

VBOs (geometry in vRAM) beat the crap out of VAs (geometry in RAM)
22  Discussions / Miscellaneous Topics / Re: Why does Signum return a float? on: 2007-02-19 13:34:10
You grab your mallet, I'll grab my armour and we'll meet the Sun engineers responsible.  Tongue
23  Game Development / Performance Tuning / Re: Making multiple TriangleStrips Vs. one long Triangle array on: 2007-02-19 03:39:20
Sorry, never actually used that method call.
I do everything on the CPU and then lump everything in large quantities via vertex buffers using glDrawRangeElements. Apparently that's the most efficient way of doing things.
24  Game Development / Performance Tuning / Re: Making multiple TriangleStrips Vs. one long Triangle array on: 2007-02-18 02:42:54
How are you able to put anything on screen if you don't us an index pointer?  Shocked

Im using glDrawArrays, and I haven't seen any "index pointer" yet.
I would also like to enable VBO. Is there a way to upload the index array to the card's memory?
25  Discussions / Miscellaneous Topics / Re: Why does Signum return a float? on: 2007-02-17 12:50:34
I cannot believe I missed the Integer class. Shocked
I'm silly. Roll Eyes

I was using these 2:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html#signum(double)
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html#signum(float)

Thanks.
26  Discussions / Miscellaneous Topics / Why does Signum return a float? on: 2007-02-16 11:32:19
The $1.0e6 question!
I could never figure this out on my own.
27  Discussions / Miscellaneous Topics / Re: Happy New Year - Some Resolutions for 2007 on: 2007-01-09 03:37:11
Learn to control myself when attempting to make a game.
28  Discussions / General Discussions / Re: ByteOrder and duplicate() on ByteBuffer vs FloatBuffer on: 2007-01-08 13:56:32
Now I know about it thankfully. Smiley
Why haven't Sun done anything about this since 1.4 according to the bug report?

No, this is just an example. I'm not using ByteBuffers to copy floats around either, one reason to be it's deadslow. But in more complex cases, you might run into it, and scratch you head bold.
29  Discussions / General Discussions / Re: ByteOrder and duplicate() on ByteBuffer vs FloatBuffer on: 2007-01-08 11:58:48
Funny enough, I didn't know this issue existed however I've always been copying buffers via get() and put(). Funnier still, I don't take this approach to copying batches of other data, just float buffers and byte buffers.

Am I possibly psychic and know when a problem might occur sub-consciously?
30  Discussions / Miscellaneous Topics / Excuse me while I cry: New verifier on: 2007-01-08 04:42:48
https://jdk.dev.java.net/verifier.html

I read it before, but now I'm thinking no run time performance cast from type erasure for objects after the type <E> has been inferred from an instance of a generic class?
It is a runt time (on-line) verifier right?
Generic classes need to be inferred at runtime due to erasure.
Each generic instance that has a different type requires it's own byte code.
So it's fair the new verifier will eliminate a cast and just do a lookup?

Am I drinking and taking drugs?
Am I sane?
How did I manage to reach this conclusion?

More importantly, am I wrong(I'm a pessimist)?
Pages: [1] 2 3 ... 26
 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

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
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!