Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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
1  Java Game APIs & Engines / JOGL Development / Re: trying to understand result of dFdx(), dFdy() on: 2009-08-25 20:54:44
Spasi thank you for your responses. It's so funny that it's you who replied, as I am working through the Loop Blinn paper right now -- which is why I am concerned with antialiasing! LOL. Small world.

Almost all of your responses cleared up my questions. I will do a bit more research and prime this thread if I have any more questions. But, I think you've given me the clues I need.

I have read the Advanced Renderman section you mention, but will reread again.
2  Java Game APIs & Engines / JOGL Development / trying to understand result of dFdx(), dFdy() on: 2009-08-25 00:45:31


NOTE: originally, what is labeled as "dFdy(t)" above, was mislabeled as "dFdx(t)". Also, what is labeled as fragment sample point was previously labeled "f( s, t )". I suppose that isn't wrong per se, but I thought it wasn't very clear, so I fixed it. You may have to refresh or clear cache to see the revision.

I am working on antialiasing a procedural texture. In order to do so, I am trying to understand how dFdx() and the y version work. I looked through the orange book, and the GLSL spec. Based on how I understand it currently, I have drawn in the image above. Can you let me know if I am understanding this correctly?

It is my understanding that dFdx() is not giving you a derivative ( which makes sense to me -- how could the GL possibly derive that without knowing the texture function? ), but rather the distance in s ( for dFdx() ), or t ( for dFdy() ) to the next position there would be a sample in that direction, if offset by one pixel in the x, and y direction in the frame buffer.

How can you find out which direction these virtual samples are from the current fragment? Is that universal, or manufacturer dependent? Again, I may be mistaken in my understanding, but if it does work the way I am seeing it now, what happens when dFdx( t ) + t is no longer inside the primitive ( e.g.  dFdx(t) + t < 0.0, or dFdx(t) + t > 1.0 )?

I may be misunderstanding how this function works. If so, I'd love to understand this, and will correct my drawing for the record.

Thanks!
3  Game Development / Newbie & Debugging Questions / Re: How to do a C-style initialization of a variable on: 2009-08-05 22:22:24
I had no idea it worked that way. When they mentioned pass by value for the primitives, that made sense. But, I was surprised that that held true for Objects as well.

Thanks Riven.
4  Game Development / Newbie & Debugging Questions / Re: How to do a C-style initialization of a variable on: 2009-08-03 22:19:07
would be better, but normally in java you would design this more OO like, e.g. with a dedicated Shader class:

I was considering doing this. I saw that there are some convenience classes in JOGL2 aimed at GLSL, similar to those we currently have for textures. Is that going to be a while before release ( couldn't find a release date )? If so, I may just get cracking on that for my project.

cheers
5  Game Development / Newbie & Debugging Questions / Re: How to do a C-style initialization of a variable on: 2009-08-03 21:36:40
Thanks Riven and Demon. OK, so after looking through the OpenGL spec, I guess I am OK initializing integers for use as Program and Shader IDs to 0 since zero is reserved and will never be issued as an ID from the GL. So, I guess, the whole question was wrong! lol. Oh well, I am glad for the refresher from both of you. That's one of the funny things about JOGL is that you are thinking part C, part Java.

cheers!
6  Game Development / Newbie & Debugging Questions / Re: How to do a C-style initialization of a variable on: 2009-08-03 20:53:30
OK, well I did post in clueless newbies! lol. But, I get the point now: primitives are assigned, and passed by value, so I would have to have an Object with a null to pass to a function for initialization if I wanted that. I think I get it now.

Thanks both for fast replies.
7  Game Development / Newbie & Debugging Questions / Re: How to do a C-style initialization of a variable on: 2009-08-03 19:15:02
Sweet. Thanks demonpants! Makes total sense.
8  Game Development / Newbie & Debugging Questions / How to do a C-style initialization of a variable on: 2009-08-03 19:08:01
I am working with GL identifier ints, and have a very quick question: is there a why to pass a field/variable identifier to a function for initialization in Java? So far, this gives me errors:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public class ScratchPad
{
    public static void main( String[] args )
    {
        ScratchPad s = new ScratchPad();

        int monkey = 0;

        s.test( monkey );

        System.out.println( monkey );
    }

    private void test( int ID )
    {
        ID = 3;
    }
}


output = 0, instead of expected 3.

I am just trying to understand why. This little mini program just illustrates the point. In a perfect world I'd like to have something like this:

1  
2  
3  
4  
int vertexShaderID; // declare uninitialized
// or, if necessary, int vertexShaderID = 0 since that int is not used by the GL ( I believe GL ids are > 0 ).

compileShader( vertexShaderID, GL.GL_VERTEX_SHADER, vertexShaderSource );


However, this only works if I have initialized vertexShaderID before passing it into the function. The sample program above encapsulates what is happening. If I don't assign the ID before calling compileShader OpenGL sends and error.

I'd like the compileShader function to assign the ID with the call to gl.glCreateShader instead of doing that before the function is called.

Thanks for any insights.
9  Java Game APIs & Engines / JOGL Development / Re: floats vs. doubles on: 2009-04-02 00:21:25
ah. Thank you Riven. OK, so sounds like either work in floats, or convert to floats then use glInterleavedArrays(). I know this stuff is sort of obvious to an experienced person, so thanks for the response.

cheers
10  Java Game APIs & Engines / JOGL Development / floats vs. doubles on: 2009-04-01 18:02:53
Up until now, I have just been using doubles everywhere. Mostly, I have done this because I'm far too lazy to type a lot of "f"s after numbers. Now that I am beginning to deal with larger volumes of data going from the client to the GPU, I've noticed that glDrawElements() is the biggest pig at the CPU trough. So, I've set everything up to leverage glInterleavedArrays(); but I noticed that it only supports floats ( from what I can tell ). I can see that if throughput becomes an issue, I would want to send floats across to the GPU to reduce the amount of data. So, how do JOGLrs out there deal with this?

Work in double format on client side, then convert when you send to GPU?
Work only in float format?
Work only in double format -- just use multiDrawElements(), make your data as sparse as possible, and just deal with that?

cheers
11  Java Game APIs & Engines / JOGL Development / Re: Scenegraph Design on: 2009-01-18 00:54:31
There are two main components, the scene graph that describes the relations and a renderer that takes in "render atoms" that describe the minimal set of things needed to render an object (geometry, appearance and location).  This enables the renderer to be used as is, or implement radically new organizational tools to describe the scene.  Because my knowledge of databases and anything of that nature is limited, I chose to implement a simple scene graph that relies on the renderer.

it sounds like we're approaching it from a similar angle. i have been basing my work on this thesis paper:

http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fwww.plm.eecs.uni-kassel.de%2Fplm%2Ffileadmin%2Fpm%2Fpublications%2Fchuerkamp%2FDiplomarbeiten%2FJohannes_Spohr_thesis.pdf&ei=i3dySdKkLZy6MvfhgBw&usg=AFQjCNErYb7RpieGzHnUA2G_U_R8-AI2wA&sig2=NC_A8oH9p9o-jLAppwyclA

while most renderers are basically variations on a theme, i found the way he organizes the flow fit the way i imagine it more closely. for example, while there is much amazing information in Eberly's book, this thesis paper just made more sense to me.

in mr. spohr's thesis, the system provides a nice atomic rendering scheme that is implementation independent just as you describe. in his system, the atomic unit is the RenderJob. at first, i was kind of grafting the eberly / spatials / scenegraph approach onto spohr's, but, i soon realized that they were at odds with each other because of the dependence on the scenegraph. in spohr's approach, there is still a scenegraph used ( so far, it seems it's silly and/or nearly impossible to get away from a scenegraph entirely ), but i realized it wasn't DEPENDENT on one, and that maybe by shoehorning everything into the well trod eberly approach isn't exactly what's required. anyway, that's how i came to the conclusion that maybe the scenegraph should only be used in a limited scope.

i still haven't done enough to really evaluate that hypothesis though, and have much to do. but it helps to bounce some ideas around a bit and see what people are doing.

thanks for your input.

cheers
12  Java Game APIs & Engines / JOGL Development / Re: Scenegraph Design on: 2009-01-17 21:10:49
If you have nor pedagogical neither scientific reasons to write a scenegraph, maybe you should avoid reinventing the wheel and use an existing one.

yeah, i needed a specialized renderer. most of the opengl stuff i've run into is focused on 3D. whereas the stuff i'm working on is mostly 2.5D ( fake 3D ), so i have specialized needs. however, i just brought this up because as i write the code i realized that the collection of Node types just kept growing and growing because everything needed to be expressed as a Node. after a while i thought that maybe that wasn't the best way, and wanted to see what others had run into. are you saying it's NOT worth creating a more generic ID-based approach? sorry, just trying to clarify because i'm not sure what you were suggesting, but want to know since you are clearly an experienced JOGL user.
13  Java Game APIs & Engines / JOGL Development / Re: Scenegraph Design on: 2009-01-16 18:49:14
I just wanted to share my thoughts on this after working on a simplistic engine for a few months.

At first, I really liked the idea of scenegraph. It's a very intuitive concept. However, as I have begun to use it more, and look at it's design, I realize it's a limited tool. I'm currently refactoring based on the observation that what you really want is a database, with different views. A scenegraph is really just one view of the database. It's the relational view. You can also have a bounding volume hierarchy view. You can have an event handling view, etc.

Anyway, what I've noticed is that many engines, and graphics people use the scenegraph as the central database. This creates a scenario where you have a Node population explosion. If the scenegraph is behaving as your defacto database, everything must be expressed as a node. So, then you are deriving objects form Node class, or interface, and you have a Node population explosion -- everything starts to either has a node, or is a node. Whereas, if you look at your game objects ( or whatever you purpose is ) as simple IDs, and have various views of those IDs, the system becomes simpler.

So, I'm suggesting that people utilize scenegraphs to handle relations between objects, and perhaps as an even messaging structure, and that one utilize a central database as your main store for information about your game objects.

This is only a conclusion after a few months of prototyping and playing. I'm very very curious as to people's views on this.

cheers
14  Java Game APIs & Engines / JOGL Development / Re: gluUnProject? on: 2009-01-12 23:01:04
thanks for taking the time to outline that. i think that gives me the clues i need. thanks.
15  Java Game APIs & Engines / JOGL Development / gluUnProject? on: 2009-01-12 00:46:43
Hey all, I'm trying to RTFM on something, but not sure where in the manual to look, lol.

I'm trying to implement a very simple LOD on bezier or parametric curves, where the number of divisions is sub-pixel. I figured a simple way might be to define that in terms of distance in screen space. But, how does one project form a world coordinate to a screen coordinate?

Is gluUnProject() what i'm looking for? i was reading the man page and wasn't quite clear. if this is the tool i need, i can investigate further on my own, but wanted to know if this is what i'm looking for.

thanks
16  Java Game APIs & Engines / JOGL Development / Re: move object along a curve on: 2008-08-13 01:57:10
i just completed a project where i had particles that needed to follow a curve through space. i defined a bezier curve, and then stored positions in my particles relative to that curve. so a particle might be at .5, .25, 2PI radians. this translates to t = .5 ( the distance along the bezier curve from 0, 1 ), .25 is distance along a normal ray of MAX_RAY_LENGTH, also in the 0,1 parameter space using linear interpolation, and 2PI radians is the amount of rotation around the curve at t = .5.

using this setup, i was able to perform collision, and add rules for the particles behavior and let it run. the particles then appear to follow an invisible path through space. this could be extended to any object. however, this is good for sprites and particles only.
17  Java Game APIs & Engines / JOGL Development / Re: glCanvas.setSize(), and drawable.setSize() dont' work... on: 2007-12-17 20:13:49
d'oh. and i know better too. thanks ken.
18  Java Game APIs & Engines / JOGL Development / Re: glCanvas.setSize(), and drawable.setSize() dont' work... on: 2007-12-16 18:04:46
hello. thanks ken.

as i said, i tried this already, and the frame collapses to it's bare minimum size. however, i was doing that with MY opengl renderer and it's canvas. of course, if you say it should work as you list ( which i tried already ), then it does. which is great, because that means that it must be caused by something else. at least i don't have to pound my head on that anymore. wish me luck hunting for this bug. i'll try to make a super simple test case to see if i can make it happen -- then maybe i can see what's causing this. thanks.
19  Java Game APIs & Engines / JOGL Development / Re: Problems with glTexImage2D on: 2007-12-14 21:27:59
not sure what the exact issue is here, but i was recently building textures procedurally, and delivering bytebuffers to the glTexImage2D as well. i ran into issues of misaligned pixels, nullPointerExceptions, etc. finally, i tried different combination of the format and internal formats, and got it to work. in my case i had to switch from RGB to BGR. just something to consider that maybe it's the formats...
20  Java Game APIs & Engines / JOGL Development / glCanvas.setSize(), and drawable.setSize() dont' work... on: 2007-12-14 21:25:02
hello all. i'm trying to get it so that my GL's canvas to be exactly my requested size. currently, if i call glCanvas.setSize( new Dimension( 1024, 768 ) ), then put it in a Frame, it will shrink down to the minimum size available. if i go back to the basics, and do frame.setSize( new Dimension( 1024, 768 ) ), then everything SEEMS correct. but, in the init() call in the GL, if i ask drawable.getWidth(), or .getHeight(), i get 1024 x 768 - 22 because of the Frame's title bar.

how can get the glCanvas to set to a specific size, then put it in the frame? for example, if i want to set my glcanvas to 1024 x 768, then put it into a frame. then the frame should be 1024 x 768 +22... edit: obviously, i could just ADD 22 to the requested dimension, but that's not going to platform independent i don't think...

sorry if this is such a noob question, and i have tried out a lot of experiments in my code first.

thx.
21  Java Game APIs & Engines / JOGL Development / Re: opinions needed: approaches to 2D gradients in OpenGL on: 2007-12-14 21:06:17
thanks chris. i think the issue is the fact that i'm working at high resolutions, over a limited range. for example, doing a gradient @ 1920 x 1080 where i'm interpolating from say ( .5, .5, .5 ) to ( .75, .75, .75 ), is that it's simply mathematically impossible ( even with dithering ) to hide that kind of banding.

i received some advice that if i work internally with a 16bpp texture, then dither, i might get what i'm looking for.

i'm writing some tests right now, and will post results when complete.
22  Java Game APIs & Engines / JOGL Development / Re: opinions needed: approaches to 2D gradients in OpenGL on: 2007-12-09 20:30:17
yeah, i can simulate gradients using the glColorVertex3f() method. the issue is the banding though. even with glEnable(GL.GL_DITHER), the results are bad.

how can i work in higher internal precision, then perhaps dither everything?
23  Java Game APIs & Engines / JOGL Development / Re: opinions needed: approaches to 2D gradients in OpenGL on: 2007-12-06 00:50:53
hey guys. thanks so much for the replies. and, sorry for the overly ambiguous question. i'm from an artist background, so often i know what i want to know, but don't know how to ask...lol.

anyway, i think i can elucidate the problem better now:

1. the animation is a one-off application for use at an event. i can specify the platform, and will run something with a bunch of texture memory.

2. i have to span over large distances at high resolution ( 1920 x 1080 ), so dithering will becoming necessary. i've already done tests using vertex color blending built into opengl. banding is too much for the client's taste.

3. i need to animate the colors in the gradients such as going from orange and magenta to blue and green. in addition, we may animate some of the triangles' vertices.

hope this helps and is more clear. thanks for your valuable input.
24  Java Game APIs & Engines / JOGL Development / opinions needed: approaches to 2D gradients in OpenGL on: 2007-12-05 20:35:00
Hello guys. I'm working on a real-time animation that requires a lot of gradient compositing. Just to give you a rough idea:



The image above is a prototype and shows various overlapping triangles that are filled with color gradients in Adobe Illustrator. Illustrator allows the user to define an arbitrary start point, and end point to a gradient. This generates a fill pattern, and is masked off by the Path of the graphic object getting the fill. In this case, it's a triangle.



In order for my project to deal with rapid changes from the client, I have figured out how to extract relevant data from a PDF file. I can pull out the geometry, the colors in the gradient, the gradient start, end, and rotation.

The basic way ( the only way I know, lol ), is to read the data, generate pixel data, generate triangle vertices, bind pixel data as texture, and achieve the rotation by transforming the texture in the model's ( triangle ) space. I think I can achieve this. However, before I do all this, it occured to me that I might also approach this problem with a GLSL shader instead.

1) Which approach would you go for?

2) If I want to animate, or update the gradients on the fly, does that preclude the use of the GLSL approach.

3) Is the basic way I describe above flawed, or are there some gotchas to consider here.

Thanks for any help in advance oh gurus.
25  Java Game APIs & Engines / JOGL Development / Re: gl.glColor3f() problem on: 2007-11-10 01:31:51
i agree with the previous poster. i would develop and work on all the subsystems independently, and build them up one at a time. first i developed a mesh, then i created a scenegraph, etc. each subsystem takes a lot of work to design and test. the good thing is that even if you end up scrapping it and using an existing engine, or portions of one, you will have a much better understanding of how it all works under the hood.

with opengl, you're creating a drawing system. but then you need a system that uses the drawing system. then you need to take that system and add your content and rules. quite a few steps, and each one is not easy. just work on one thing at a time. first get it to work, then generalize.

good luck
26  Java Game APIs & Engines / JOGL Development / Re: best practice for transfering data across to GPU on: 2007-11-08 18:29:36
AWESOME! thank you very much cylab.

so, if i understood the thread as it relates to my questions:

1. scenegraph sorting and management is important, but not the end of the world. my main goal here is to just look for what has changed only, sort them into appropriate buckets, do whatever optimization i can then...

2. minimize calls across JNI. therefore, when i'm crawling my graph, i want to be preparing and packaging my renderables at that time so that i can present the vertex, color, texture data to GL in the minimum possible number of calls.

3. don't pass the GL object to the scenegraph crawler, instead queue up all of my data ( REFERENCES to primitives ) into a collection of state change buckets. hand this collection over to the GL object which will have a bunch of routines for interpreting these states as drawing commands.

does that make sense?

working with astronomical data, i often have to sort through 100K objects. but recently i'm working on a new way of graphing items on a sphere that is a little different than the traditional right ascension and declination. if anyone is interested:

here is a link to traditional astronomical coordinates on a sphere:

http://lyra.colorado.edu/sbo/astroinfo/coords/coordinates.html

and here is the newer, faster way ( to work with data relating to projection of the celestial sphere ):

http://skyserver.org/htm/
27  Java Game APIs & Engines / JOGL Development / best practice for transfering data across to GPU on: 2007-11-08 01:29:59
hey all. been working on an astronomical map using JOGL. i'm curious as to how people approach moving the data across to the GPU. more specifically, do you traverse your scenegraph and assemble your data as a collection, then optimize ( or do this as you go ), then hand over data to OpenGL renderer to munch on, OR, do you pass the GL object reference to whatever's crawling your scenegraph to call a GL rendering method during traversal.

or maybe more simply, should i restrict all GL calls to my object that contains the GL reference? if so, what should i hand over to that object: vertex data, or a scene objects that have draw() methods, etc.? hope this makes sense.
28  Java Game APIs & Engines / JOGL Development / Re: FPSAnimator producing irregular frametimes on: 2007-06-20 17:52:25
i was also displeased with this. so i went on a little adventure, built my own clock based on System.nanotime(), and created my own animation driver. however, it is non-trivial to produce a steady clock and frame rate. so, eventually i just went back to FPS animator.

the problem with a fixed frame rate is that at the end of the day it involves prediction. and all that a programmer can do really is make a guess based upon how long the last frame took to process and render. of course, basing your frame delta time calculations on the last frame will get you in the ballpark, but ultimately, it's just not going to be steady.

i wasn't satisfied still, so i spent time looking into this issue. it's the same everywhere in computing -- for audio, for C code, everywhere. if you want to look up the technical terms, it's referred to as DRIFT and JITTER. computers are not good at steady clock, and usually can only achieve this via buffering time. the basic process to keep two times for everything. first, you calculate what time it should be. for example if we are on frame 10 at 60fps, the time now SHOULD be ( .166666666... * 10 ) seconds. then what you do is manually adjust the page flip to the perfect time by adding delay, or going early. however, this involves latency. so if you arrive at the page flip 3 milliseconds early, you just burn some thread time then flip. even if you don't mind the latency this creates, when i ask the thread to kick it and chill for a bit you CANNOT be assured that it will do so accurately. i found that thread sleep times vary by platform, and reliability. so, if the delay you ask for to match perfect time isn't even reliable, what's the point? btw, the technique described above is the same that is used for VOIP to ensure streamed audio stays together and is typically called a de-jitter buffer.

in the world of audio production, people pay big bucks to create a steady clock buy purchasing specialized hardware clocks. i'm not a games programming expert, but after spending the time i did on this subject, i found i was just fine with FPS animator because i proved to myself that the better solutions are a lot of work and aren't really that much better.

i found that time spent pooling objects and carefully managing GC is a more practical way to get a steady rate.

btw, this is a HUGE topic in real time graphics, and audio. there is no good solution currently that is universal among platforms. in the old days, they would use the screen refresh as the clock because it's pretty steady, but you can't even really do that anymore.
29  Games Center / Archived Projects / Re: Toy Blocks on: 2007-06-15 17:41:43
hey kev, i really liked this. such a simple idea, and a brilliant one. i have a gameplay suggestions: i found, hands down, that the best mode was freeplay. but of course that gets a little old. i was thinking this could be a great internet game a la Line Rider. i really enjoyed balancing beams on blocks, then dropping something on it to launch a projectile -- which hit's another beam. i'm imagining kind of a rube goldberg machine challenge, where i can set up, and let it run. the challenge would be to top, other player's machines for internet fame and glory. lol. i laugh, but look at the creativity and following Line Rider has...
30  Java Game APIs & Engines / JOGL Development / Re: how does the 3d model (for emample .3ds) load in JOGL? on: 2007-06-14 17:54:12
you probably won't get a lot of responses because this is such a basic thing ( meaning people want you to do a little more research before asking ). have you investigated the demos that come with jogl? there is a 3ds loader and an obj loader. i recommend building an obj loader as a starting place. most modelers export this, and it's a dead simple file format. check out the jogl demos, or search for jogl obj loader. look at the source, it's not too complicated -- simple parsing.
Pages: [1] 2 3
 

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 (33 views)
2014-12-15 09:26:44

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

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

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

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

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

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

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

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

toopeicgaming1999 (32 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!