Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Java Game APIs & Engines / JOGL Development / Re: Huh. Even specialer.
|
on: 2004-05-16 14:53:03
|
What is the reasoning behind allowing the operating system to make a forced choice, and what might coax the operating system into making not-the-absolutely-stupidest-possible choice? Dunno, but the DefaultCapabilitiesChooser is nothing more than "default"  If you want something that suits you needs, you'll have to write yours. From what I've read, it seems quite hard to pick the right configuration for integrated graphic chipsets and "exotic" cards... However I thought the score-based algorithm was supposed to solve most problems. Comments anyone ?
|
|
|
|
|
2
|
Java Game APIs & Engines / JOGL Development / Re: JOGL Blue Screen Of Death
|
on: 2004-05-16 08:21:18
|
The "GL_RENDERER: GDI Generic" part clearly shows that you got software rendering instead of hardware. This must be related to the recent changes in GLCapabilitiesChooser but since I still use an older version I can't tell for sure. You could try the nightly build instead of a release, maybe the bug is corrected. If it isn't, you may have to write your own GLCapabilitiesChooser to get hardware acceleration. 
|
|
|
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: How to use compressed textures with OpenGL
|
on: 2004-05-11 13:59:55
|
So actually you use the GL_EXT_texture_compression_s3tc extension then? What's with the GL_ARB_texture_compression? How can I compress a texture so that it can be used with this extension? {Edit} Use one of those tools at Ati/Nvidia/blabla to lossy compress it. Yes you should use Nvidia plugin (either with photoshop or command-line). It is safe for DXT. Since I mostly played with Far Cry textures so far, I haven't created my own DDS files yet. Extensions - an alien world to me. :) Me too. I got part of the code from CodeSampler's DDS loader and added some missing stuff. ;D
|
|
|
|
|
4
|
Game Development / Newbie & Debugging Questions / Re: How to use compressed textures with OpenGL
|
on: 2004-05-11 13:54:22
|
Well there is only one parameter to change.  However I don't know how it works with GL_COMPRESSED_{RGB, RGBA, ALPHA, ...} : I only used it with DXT and I don't plan to support any other method at the moment. DXT compressed DDS textures are definitely great : having all mipmap levels and/or cubemap faces stored in a single file with high compression ratio is invaluable. Though I wish Nvidia had respected MS specs with their DDS exporter : now a lot of DDS files have wrong header and size, which makes it difficult to write a stable loader. 
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: How to use compressed textures with OpenGL
|
on: 2004-05-11 13:22:33
|
This is how I display DXT compressed textures with my DDS loader : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| if(pixelFormat.isDXT()) { boolean supported = true; int compressedFormat = 0; switch(pixelFormat.getDXTVersion()) { case 1 : compressedFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break; case 3 : compressedFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; case 5 : compressedFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; default : supported = false; break; } if(supported) { int size = image.getSize(); gl.glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormat, width, height, 0, size, pixels); } } |
Your problem is that the 'size' argument should be the total compressed size of the texture, not its storage type. At least that's how it works with DXT 
|
|
|
|
|
7
|
Java Game APIs & Engines / OpenGL Development / Re: Cant see things
|
on: 2004-05-10 15:17:34
|
ok, I can see things now by using the following code, I have no viewport or camera of any type set. I need to now find out what all the OpenGL call do and mean.  Then you definitely need the Redbook.  IMHO OpenGL is not the kind of API you can master just by playing a bit with a piece of code. You need to understand what goes under, both the math and the core calls. Either read some detailed tutorial or a book (the Redbook can be found online), every hours you spent on it will pay. 
|
|
|
|
|
8
|
Java Game APIs & Engines / OpenGL Development / Re: Cant see things
|
on: 2004-05-10 14:30:37
|
Is there another method where you setup the "camera" ? It is usually done in a 'reshape' or 'init' callback and should contain stuff like glViewport(), gluPerspective() or glOrtho()... Just a wild guess though : there seems to be a huge difference between line strip coordinates and other primitives. You could try to draw your quad using x and y vars, and see if it's visible. 
|
|
|
|
|
9
|
Java Game APIs & Engines / OpenGL Development / Re: Cant see things
|
on: 2004-05-09 18:36:02
|
|
I think you should call glPushMatrix() after glClear() and add the corresponding glPopMatrix() at the end of your render method.
Right now your are appending translations to your model-view matrix without removing them, which causes your drawing to "leave" the viewport.
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / Re: Is the Redbook the best tutorial for OpenGL?
|
on: 2004-05-05 07:45:40
|
The Redbook is great to start with OpenGL : it covers most core features and is an easy read. However it won't get you into game programming, you'll need more specific tutorials such as those of NeHe or Gametutorials. My current learning roadmap  : - Redbook (completed) - Gametutorials (in progress) - CodeSampler (there is some crazy stuff there) - messing a bit with Return to Castle Wolfenstein 
|
|
|
|
|
14
|
Java Game APIs & Engines / JOGL Development / Re: Texture Mapping
|
on: 2004-04-21 15:15:18
|
Well it took me almost 2 days to get a "generic" texture loading class which can convert most BufferedImages into textures. I first wrote a small program that loads an image and dumps every useful information and then I tested various GL parameters to display it correctly. Now it works nicely, but I haven't tested it much (currently I mostly do ports from C++ tutorials to Java). I'll have to clean it when I'll start my first engine  If you want I can mail you the files.
|
|
|
|
|
15
|
Java Game APIs & Engines / JOGL Development / Re: Texture Mapping
|
on: 2004-04-21 11:55:44
|
|
ddu88 : IIRC the texture loader from the NeHe Lesson06 ports makes heavy assumption on image formats. It was not designed to handle any images, so you'll have to create your own BufferedImage -> GL texture code.
For a quick'n'dirty solution, you could try to change GL_RGB to GL_BGR in the GL calls : since the two channels are reversed when the texture is loaded, it should work.
|
|
|
|
|
17
|
Java Game APIs & Engines / JInput / Re: plugin property
|
on: 2004-04-16 13:57:32
|
Good point  However I think absolute paths could be useful during the testing phase, when you work with several plugin directories. In a game release the plugin directory would be under the root, as you pointed out before. As far as I'm concerned, I put all jogl/joal/jinput stuff in my jre/lib and jre/lib/ext directories, because I am too lazy to add them to the classpath manually  So at the moment I don't need that feature, but the code is here if someone want to test it or to include it in JInput.
|
|
|
|
|
18
|
Java Game APIs & Engines / JInput / Re: plugin property
|
on: 2004-04-16 13:06:49
|
In fact the JVM was complaining that the library path was relative, not absolute. The error is in the findLibrary method of PluginLoader : instead of 1
| String libpath = parentDir.getPath() + File.separator + System.mapLibraryName(libname); |
it should be something like : 1
| String libpath = parentDir.getAbsolutePath() + File.separator + System.mapLibraryName(libname); |
Well there are several other changes involved to support correctly absolute paths, I'll post the code here so that it can be tested before submitting an official RFE + patch  All these changes are made in net.java.games.input.DefaultControllerEnvironment. 1) replace method scanControllers() with 1 2 3 4 5 6 7 8 9 10 11 12
| private void scanControllers() { String pluginPathName = System.getProperty("jinput.controllerPluginPath"); if(pluginPathName == null) { pluginPathName = "controller"; }
File[] dirs = getPotentialDirectories(pluginPathName);
for(int i = 0; i < dirs.length; i++) { scanControllersAt(dirs[i]); } } |
2) replace method scanControllersAt(String path) with 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| private void scanControllersAt(File file) { try { Plugins plugins = new Plugins(file); Class[] envClasses = plugins.getExtends(ControllerEnvironment.class); for(int i=0;i<envClasses.length;i++){ try { if (DEBUG) { System.out.println("ControllerEnvironment "+ envClasses[i].getName() +" loaded by "+envClasses[i].getClassLoader()); } ControllerEnvironment ce = (ControllerEnvironment) envClasses[i].newInstance(); addControllers(ce.getControllers()); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } |
(this is exactly the same method, except that it handles directly Files) 3) add the following methods 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| private String[] getPotentialPaths(String pluginPathName) { String javaHomePath = System.getProperty("java.home") + File.separator + "lib" + File.separator + pluginPathName; String userDirPath = System.getProperty("user.dir") + File.separator + pluginPathName; String rawPath = pluginPathName;
String[] allPaths = { javaHomePath, userDirPath, rawPath };
return allPaths; }
private File[] getPotentialDirectories(String pluginPathName) { String[] paths = getPotentialPaths(pluginPathName); File[] dirs = null;
if(paths.length > 0) { File[] allDirs = new File[paths.length]; int validDirCount = 0;
for(int i = 0; i < paths.length; i++) { try { File f = (new File(paths[i])).getCanonicalFile();
if(f.exists()) { boolean duplicated = false;
for(int j = 0; j < validDirCount; j++) { duplicated |= f.equals(allDirs[j]); }
if(! duplicated) { allDirs[validDirCount] = f; validDirCount ++; } } }
catch(IOException ioe) { ioe.printStackTrace(); } }
dirs = new File[validDirCount]; System.arraycopy(allDirs, 0, dirs, 0, validDirCount); }
else { dirs = new File[0]; }
return dirs; } |
getPotentialPaths constructs the paths to be explored. getPotentialDirectories makes sure that no directory will be searched twice by comparing files (trying to load the same library several times generates errors). [EDIT] Sorry, my code indentation got screwed up by this damn forum  If you are interested, I can mail you the file.
|
|
|
|
|
19
|
Java Game APIs & Engines / JInput / Re: plugin property
|
on: 2004-04-16 09:39:22
|
Supporting absolute paths isn't high on the priority list in my own opinion as when you then deploy your application the absolute path will probably be different on the machines it's installed on, if you want to make the changes and submit a patch thats not a problem, if you raise a bug on the jinput issue tracker you can then submit the patch to that too and someone will stick it in cvs. I am fine with the current system : absolute paths wouldn't add much to JInput. Furthermore, my first tests raised an error when loading a native lib and I am not enough experienced with dynamic classloading to correct it at the moment. I'll investigate it if I really need this functionality, but it is not my priority either.
|
|
|
|
|
20
|
Java Game APIs & Engines / JInput / Re: plugin property
|
on: 2004-04-16 08:18:17
|
|
No, absolute paths won't work. I opened the sources and currently, JInput scans for plugins :
* JAVA_HOME/lib/PLUGIN_PATH * USER_DIR/PLUGIN_PATH
where JAVA_HOME is System.getProperty("java.home"), USER_DIR is System.getProperty("user.dir") and PLUGIN_PATH is System.getProperty("jinput.controllerPluginPath") or "controller".
Supporting absolute paths would require some trivial changes to net.java.games.input.DefaultControllerEnvironment in the scanControllers and scanControllersAt methods.
|
|
|
|
|
22
|
Java Game APIs & Engines / JInput / Re: plugin property
|
on: 2004-04-15 19:09:15
|
I tried it too, with my controller dir containing both dxinput.jar and dxinput.dll. The dxinput plugin seems to be detected but I get another exception : 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
| Scanning jar: dxinput.jar Examining file : META-INF/ Examining file : META-INF/MANIFEST.MF Examining file : net/java/games/input/DirectInputAxis.class Examining file : net/java/games/input/DirectInputDevice.class Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class java.lang.NoClassDefFoundError: IllegalName: net/java/games/input/DirectInputEnvironmentPlugin at java.lang.ClassLoader.preDefineClass(ClassLoader.java:459) at java.lang.ClassLoader.defineClass(ClassLoader.java:598) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access+100(URLClassLoader.java:56) at java.net.URLClassLoader+1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at net.java.games.util.plugins.Plugins.processJar(Plugins.java:115) at net.java.games.util.plugins.Plugins.scanPlugins(Plugins.java:88) at net.java.games.util.plugins.Plugins.<init>(Plugins.java:76) at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(DefaultControllerEnvironment.java:199) at net.java.games.input.DefaultControllerEnvironment.scanControllers(DefaultControllerEnvironment.java:189) at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultControllerEnvironment.java:58) at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControllerEnvironment.java:109) at java.security.AccessController.doPrivileged(Native Method) at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:107) |
Could someone explain me what that line means ? 1
| java.lang.NoClassDefFoundError: IllegalName: net/java/games/input/DirectInputEnvironmentPlugin |
|
|
|
|
|
23
|
Java Game APIs & Engines / JOGL Development / Re: jogl API feedback requested for JSR 231
|
on: 2004-04-15 07:52:00
|
shaddam_IV : RTFM übern00b ! (sorry  I couldn't resist) Quoted from OpenGL 1.5 specs (GL command syntax, page 7) : "The declarations shown in this document apply to ANSI C. Languages such as C++ and Ada that allow passing of argument type information admit simpler declarations and fewer entry points." I don't know how you read it, but it seems that GL API is not carved in stone. Depending on the language capabilities you can produce a simplified binding which ease developers work without breaking the specs. IMO the bloated aspect of the C version is mostly due to language shortcomings. Now there are pros and cons, and an oversimplified API would achieve the opposite of the desired effect. When googling around for Java/OpenGL bindings I found YAJOGLB ( http://home.earthlink.net/~rzeh/YAJOGLB/doc/YAJOGLB.html), which use gl.vertex syntax. Here is an excerpt from the PlainCube demo : 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 29 30 31
| public void paint(GeometryViewer viewer, GL gl, GLU glu) { gl.pushMatrix(); gl.rotate(30.0f, 1.0f, 1.0f, 1.0f); gl.material(FRONT_AND_BACK, AMBIENT_AND_DIFFUSE, material); gl.begin(QUADS); gl.normal( 0.0F, 0.0F, 1.0F); gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex(-0.5F, 0.5F, 0.5F); gl.vertex(-0.5F,-0.5F, 0.5F); gl.vertex( 0.5F,-0.5F, 0.5F); gl.normal( 0.0F, 0.0F,-1.0F); gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex(-0.5F, 0.5F,-0.5F); gl.vertex( 0.5F, 0.5F,-0.5F); gl.vertex( 0.5F,-0.5F,-0.5F); gl.normal( 0.0F, 1.0F, 0.0F); gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex( 0.5F, 0.5F,-0.5F); gl.vertex(-0.5F, 0.5F,-0.5F); gl.vertex(-0.5F, 0.5F, 0.5F); gl.normal( 0.0F,-1.0F, 0.0F); gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex( 0.5F,-0.5F,-0.5F); gl.vertex( 0.5F,-0.5F, 0.5F); gl.vertex(-0.5F,-0.5F, 0.5F); gl.normal( 1.0F, 0.0F, 0.0F); gl.vertex( 0.5F, 0.5F, 0.5F); gl.vertex( 0.5F,-0.5F, 0.5F); gl.vertex( 0.5F,-0.5F,-0.5F); gl.vertex( 0.5F, 0.5F,-0.5F); gl.normal(-1.0F, 0.0F, 0.0F); gl.vertex(-0.5F,-0.5F,-0.5F); gl.vertex(-0.5F,-0.5F, 0.5F); gl.vertex(-0.5F, 0.5F, 0.5F); gl.vertex(-0.5F, 0.5F,-0.5F); gl.end(); gl.popMatrix(); } |
Is it that ugly ? As far as I'm concerned, the main simplification I would like is redundant suffix removal (see my first post). The rest I don't really care, but I think we should aim at the best readability / efficiency balance.
|
|
|
|
|
24
|
Java Game APIs & Engines / JOGL Development / Re: OpenGL Commands outside of Display
|
on: 2004-04-14 16:31:38
|
|
I don't know how professional games handle time consuming operations, but I suspect that :
* most of them are performed at level-loading time (where there is almost no GUI response, even progress bars don't progress "smoothly"),
* if it has to happen during game, it is broken down into smaller parts so that it may span over several frames.
Texture generation can usually benefit from the latter.
|
|
|
|
|
26
|
Java Game APIs & Engines / JOGL Development / Re: jogl API feedback requested for JSR 231
|
on: 2004-04-09 21:49:10
|
1) No additional safety checks please, it could kill performance and make it really difficult to compete with native apps. Wouldn't a big "WARNING : Don't mess too much with buffers" be sufficient ?  2) Restricted permission could prevent the use of OpenGL in applets, so this decision shouldn't be taken lightly (IMHO OpenGL applet could be a great way to draw people into java game development). 3) I second the removing suffixes proposal, "duplicated" functions clutter the API. For example, glActiveTextureARB and glActiveTexture are exactly the same thing so it would make sense to merge them into a single glActiveTexture call which would fall back to glActiveTextureARB if necessary. If I understood the whole ARB process correctly, we could suppress every ARB suffixes. As of EXT suffixes I don't know : is there the any guarantee that they would keep the same meaning if they were promoted to ARB or core ? 4) VBO offset : I haven't used them yet but any nice, non native way to handle them would be welcomed 
|
|
|
|
|
28
|
Java Game APIs & Engines / JOGL Development / Re: How to draw circle with radial gradient fill
|
on: 2004-04-07 07:09:44
|
This draws a 2D circle centered on (0,0) : 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
| public void radialGradientCircle(GL gl, float[] innerColor, float[] outerColor, int slices, float radius) { float incr = (float) (2 * Math.PI / slices);
gl.glBegin(GL.GL_TRIANGLE_FAN);
gl.glColor3fv(innerColor); gl.glVertex2f(0.0f, 0.0f);
gl.glColor3fv(outerColor);
for(int i = 0; i < slices; i++) { float angle = incr * i;
float x = (float) Math.cos(angle) * radius; float y = (float) Math.sin(angle) * radius;
gl.glVertex2f(x, y); }
gl.glVertex2f(radius, 0.0f);
gl.glEnd(); } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|