Show Posts
|
|
Pages: [1]
|
|
1
|
Game Development / Newbie & Debugging Questions / Re: Broken applet - assist please
|
on: 2012-08-31 15:22:42
|
this one works for me, in index.html file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <applet code="org.jdesktop.applet.util.JNLPAppletLauncher" width="100%" height="100%" archive="jar/applet-launcher.jar, jar/gluegen-rt.jar, jar/jogl.all.jar, jar/<your_file>.jar"> <param name="codebase_lookup" value="false"> <param name="subapplet.classname" value="main.class.here"> <param name="subapplet.displayname" value=""> <param name="noddraw.check" value="true"> <param name="progressbar" value="true"> <param name="jnlpNumExtensions" value="1"> <param name="jnlpExtension1" value="jar/jogl-all-awt.jnlp"> <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> <param name="jnlp_href" value="jar/applet-launcher.jnlp"> </applet> |
applet-launcher.jnlp: 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
| <?xml version="1.0" encoding="utf-8"?> <jnlp href="applet-launcher.jnlp"> <information> <title></title> <vendor></vendor> <homepage href=""/> <description></description> <description kind="short"></description> <offline-allowed/> </information>
<resources> <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/> <property name="sun.java2d.noddraw" value="true"/> <jar href="yourfile.jar" main="true"/> <extension name="newt-all-awt" href="jogl-all-awt.jnlp" /> </resources>
<applet-desc name="Applet" main-class="main/class.here" width="640" height="480"> </applet-desc> </jnlp> |
|
|
|
|
|
3
|
Game Development / Newbie & Debugging Questions / Re: Alpha doesnt work
|
on: 2012-08-30 20:20:40
|
|
ok, found a problem: gl.glTexEnvi (GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
after removing* that transparency works, but everything is red... its red becouse of font rendering.
is there a way to reset opengl color after calling glColor?? and another way to use only texture color no lights?
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Alpha doesnt work
|
on: 2012-08-30 18:02:03
|
Using JOGL, and problem is - there is no alpha. I have a PNG file that shows transparency in photoshop. Loading texture: 1 2 3 4 5 6 7 8
| public void LoadTextureFromResource(String res,String type) throws IOException { InputStream stream = getClass().getResourceAsStream(res); TextureData data = TextureIO.newTextureData(GLProfile.getDefault(),stream,GL2.GL_RGBA,GL2.GL_RGBA, false, type); this.texture = TextureIO.newTexture(data); this.loaded = true; } |
OpenGL init: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| GLCapabilities capabilities = new GLCapabilities(GLProfile.getDefault()); capabilities.setHardwareAccelerated(true); capabilities.setNumSamples(0); capabilities.setAlphaBits(8); capabilities.setSampleBuffers(true);
...... gl.glDisable(GL2.GL_LIGHTING); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable (GL2.GL_BLEND); gl.glShadeModel(GLLightingFunc.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); |
Tried changing blend func, some modes make everything transparent, this one renders fine but without alpha. And ofcourse, im rendering object with that texture last. Help??
|
|
|
|
|
9
|
Game Development / Newbie & Debugging Questions / Re: Texturing problem
|
on: 2011-12-29 22:21:37
|
some things are complicated too much, somewhere used wrong names... but anyway i have checked parsed data, everything is correct. tested with simple object, result: http://img7.imageshack.us/img7/5130/omgwtfqj.jpglooks like texture is applied on every side, instead of whole object. here is my CTexture class: 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
| public class CTexture { private Texture texture; private boolean loaded; public CTexture() { loaded = false; } public void LoadTextureFromResource(String res,String type) throws IOException { InputStream stream = getClass().getResourceAsStream(res); TextureData data = TextureIO.newTextureData(GLProfile.getDefault(),stream, false, type); this.texture = TextureIO.newTexture(data); this.loaded = true; } public boolean hasTexture() { return loaded; } public void apply2Object(GL gl) { texture.enable(gl); texture.bind(gl); } } |
|
|
|
|
|
10
|
Game Development / Newbie & Debugging Questions / Texturing problem
|
on: 2011-12-29 18:06:35
|
I am trying to bake texture in 3DS Max and use it in OpenGL, but texture looks weird. I was looking on google for few hours, but cant find any solution.  Here is my code: 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
| public void RenderObject(CObject obj) { CMesh m; MFace f; MVertex v; MNormal n; MTexCords t; CTexture tx; tx = obj.GetTexture(); m = obj.GetMesh(); if(tx.hasTexture()) { tx.apply2Object(gl.getGL()); } gl.glTranslatef(obj.location.x, obj.location.y, obj.location.z); gl.glRotatef(obj.rotation.x, 1, 0, 0); gl.glRotatef(obj.rotation.y, 0, 1, 0); gl.glRotatef(obj.rotation.z, 0, 0, 1); for(int i = 0; i < m.getFaceList().size();i++) { f = m.getFaceList().get(i); gl.glColor3f(0.5f, 0.5f, 0.5f); gl.glBegin(GL2.GL_POLYGON); for(int j = 0;j < f.GetPolygonCount();j++) { v = m.getVertexList().get(f.GetPolygonByIndex(j).vertexIndex - 1); t = m.getTexCordsList().get(f.GetPolygonByIndex(j).texcordIndex - 1); n = m.getNormalList().get(f.GetPolygonByIndex(j).normalIndex - 1); gl.glNormal3f(n.x, n.y, n.z); gl.glTexCoord3f(t.u,t.v, t.w); gl.glVertex3f(v.x, v.y, v.z); }
gl.glEnd(); } |
Code is based on open source OBJ loader in c++. http://sourceforge.net/projects/objloader/What i want: http://img521.imageshack.us/img521/5181/wantp.jpgWhat i get: http://img171.imageshack.us/img171/645/getor.jpgBaked texture: http://img205.imageshack.us/img205/8562/bakedi.jpghelp!?
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Applet resize problem
|
on: 2011-09-23 18:52:56
|
Hi, i am new to java and game development. I just started creating my first java applet using JOGL library. After few tutorials i managed to draw a triangle, but have problem with GLCanvas and the reshape method. 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
| public class CMain extends Applet implements GLEventListener ....
public void init() { glu = new GLU(); canvas = new GLCanvas(new GLCapabilities(GLProfile.getDefault())); this.add(canvas); canvas.addGLEventListener(this); canvas.setPreferredSize(this.getSize()); final FPSAnimator animator = new FPSAnimator(canvas, 60); animator.start(); }
....
public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) { GL2 gl = glDrawable.getGL().getGL2(); h = (h == 0) ? 1 : h; float aspect = (float)w / h; gl.glViewport(0, 0, w, h); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0f, aspect, 0.1f, 100.0f); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); canvas.setPreferredSize(null); canvas.setPreferredSize(this.getSize()); } |
I'm using Eclipse and Java applet viewer, and when i resize window/applet sometimes the Canvas size doesn't update!!  Any suggestions?
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|