Show Posts
|
|
Pages: [1] 2 3
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: FBO (convert to jogl2 problem) (update:solution found)
|
on: 2009-10-11 13:58:12
|
|
The FrameBufferEXT functions was the Problem.
i convert all existing Code direct like: GL gl = drawable.getGL(); -> GL2 gl = drawable.getGL().getGL2();
...Init FBO (new)
gl.glGenFramebuffers(1, fbo); gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fbo.get(0)); gl.glGenRenderbuffers(1, depth); gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, depth.get(0)); gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, fbo_width, fbo_height); gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, depth.get(0)); gl.glGenTextures(1, fbo_texture); ....
...Draw to FBO Jogl1: gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo.get(0)); -> Jogl2: gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fbo.get(0));
...the solution was to remove the "EXT" and "_EXT"
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / FBO (convert to jogl2 problem) (update:solution found)
|
on: 2009-10-10 18:40:11
|
hello @all, i work a long time with jogl1 and fbo and all works fine. now i switched to jogl2 and the FrameBufferObjects will not work anymore. some parts of my jogl1 init code 1 2 3 4 5 6 7 8 9 10
| GL gl = drawable.getGL();
gl.glGenFramebuffersEXT(1, fbo); gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo.get(0)); gl.glGenRenderbuffersEXT(1, depth); gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, depth.get(0)); gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, GL.GL_DEPTH_COMPONENT24, fbo_width, fbo_height); gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0); gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, depth.get(0)); gl.glGenTextures(1, fbo_texture); |
in jogl2 (GL2 gl = drawable.getGL().getGL2(); // GL->GL2) it will not work,break with unknown commands(can not find symbol) is there any basic FrameBufferObject JOGL2 tutorial? (google only find jogl1 tutorials) thx for any help 
|
|
|
|
|
5
|
Java Game APIs & Engines / JOGL Development / Fragment Shader with Standart Fog
|
on: 2009-08-03 09:41:49
|
hello, i have a little question about the fragmentshader with jogl (i only use frag shader without vertex shader(thats another story)) the frag shader works well, but i miss the build-in Fog function i try something like this ...but it looks not very good 1 2 3 4
| ... float fog_amount = gl_FogFragCoord*-0.004; vec3 farbe= mix( texel.rgb , vec3(fog_color_r,fog_color_g,fog_color_b) , fog_amount ) ; gl_FragColor = vec4 (farbe,1.0)*gl_Color; |
got anybody an idea? much thx
|
|
|
|
|
6
|
Java Game APIs & Engines / JOGL Development / Re: Shaders start
|
on: 2009-03-15 14:03:42
|
 my only problem that is did not undertand is the handles of simple variables in the fragment shader that slows me down, the combination of uniform(external variables) and vars in the fragment make problems //java source int eec1 = gl.glGetUniformLocationARB(program, "eec1"); int eec2 = gl.glGetUniformLocationARB(program, "eec2"); int eec3 = gl.glGetUniformLocationARB(program, "eec3"); int eec4 = gl.glGetUniformLocationARB(program, "eec4"); gl.glUniform1iARB(eec1, 0); gl.glUniform1iARB(eec2, 1); gl.glUniform1iARB(eec3, 2); gl.glUniform1iARB(eec4, 3); //fragment shader ... uniform int eec1,eec2,eec3,eec4; //this vars come from the java source (not from vertex shader) //test example int ec1=1; int ec2=1; int ec3=1; int ec4=1; .. Main ... ec1=int (eec1); <-this stops the shader...(simple int+ external int) ... vec4 texel_av=0; texel_av += texture2D(tex[ec1] , texCoord)*pow1; texel_av += texture2D(tex[ec2] , texCoord)*pow4; texel_av += texture2D(tex[ec3] , texCoord)*pow2; texel_av += texture2D(tex[ec4] , texCoord)*pow3; is there something i did forgot or are there some restrictions of handling variables in the fragment shader?
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / Re: Shaders start
|
on: 2009-03-15 12:48:50
|
should work, but are you sure, that you need 20 texture units in your shader??? yes, its an crazy idea.. the idea is simple: its a kind of multitexturing for an ground landscape without changing the textures all the time.. my first experiments with the vertex/fragment shader working perfect and it speeds up the whole project like i never seen bevor. (from 15fps (without shader) up to 150fps(with that shader) on an notebook with an geforce GO7300 (shared memory) its unbelievable.. the vertex shader sends the edge information (e1-e4) to the fragment shader this e1-e4 holds the texture number of the sampler2d.. (thats why i need the sample2d in an array,) the fragment shader itself calculates the frag_color by a mix of the 4 edges with the texturecoords.. i am very happy with that stuff i use texture stage(sampler2d) 1-15..that is supported by most of the graphic cards (8,16,32) 14 elements (like gras,stone,sand..etc) and the 15 is the Height/Color Map Texture later i will add an gras function to the fragment shader that will create gras on the surface (like an 3d effect without using extra vertices)..i dont use first person view.
|
|
|
|
|
8
|
Java Game APIs & Engines / JOGL Development / Re: Shaders start
|
on: 2009-03-14 21:26:29
|
thank you very much, at this time i got an vertex/fragment water done by myself  there are some litte questions open: i load via 1 2 3 4 5
| int to = gl.glGetUniformLocationARB(program, "tex1"); gl.glUniform1iARB(t0, 0);
"uniform sampler2D tex1" |
Texture Handles to the fragment shader , my question how can i use and access an array of sampler2d "uniform sampler2D tex[20]" ... gl.glUniform1ivARB is not working and i didnt find any examples how to copy an array to the frament shader programm
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Re: Shaders start
|
on: 2009-03-10 08:31:26
|
it makes really fun working with the fragment shader  i got only with water an simple/nice bump mapping water to work  there is a litte question i am working on: when using gl.glEnable( GL.GL_BLEND ); and the fragment shader the blending is complete deaktivated (without frag shader it works) gl.glColor4f(1,1,1, 0.4f); gl.glNormal3f(0,1,0); what code did i need to use in the frag code that the alpha values will be used? greetings  example: String[] shader2 = { "uniform sampler2D texUnit,texUnit2;\n" + "uniform float v1,v2;\n" + "float vi =1.0;\n" + "float vii=1.0;\n" + "void main(void)\n" + "{\n" + " vec2 texCoord = gl_TexCoord[0].xy;\n" + " vec4 texel = texture2D(texUnit , texCoord);\n" + "texCoord[0]=texCoord[0]*5.0;\n"+ "texCoord[1]=texCoord[1]*5.0;\n"+ " vec4 texel2 = texture2D(texUnit2 , texCoord);\n" + " gl_FragColor = texel2;\n" + // texel2*texel "}\n" };
|
|
|
|
|
11
|
Java Game APIs & Engines / JOGL Development / Shaders start
|
on: 2009-03-05 10:16:15
|
hello to all, i came to an point at my engine where i really need something like an shader for some graphic effects that i cannot do with the fixed pipe functions. the jogl/net beans examples with shaders are very very complicated to understand my goal is simple, a textured quad with an texture and this texture should be distorted a bit like an chaos...my english is not the best : when you divide the quad in hundrets of quads and then make an random on the u/v positions (just a litte bit around the original uv) so that the texture on the whole quad looks like an chaos (or a bad water) i now i need vertex/fragment shader and started to try to understand some code i found the code below did not do anything, the quad is rendered without any effect and the loadShader Code i found in the forum here without knowing what it is doing, its simple something to check is anything happen. i hope there is somebody who can help me thanks  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 53 54 55 56 57 58 59 60 61 62 63
| private String[] loadShader ( void ) {
int t = 5; String shader[] = new String[t];
shader[0]="uniform samplerRect BaseImage;"; shader[1]="void main(void) {"; shader[2]="vec4 tmp = textureRect(BaseImage,gl_TexCoord[0].st);"; shader[3]="tmp += 0.5;"; shader[4]="gl_FragColor = tmp;";
return shader;
}
private void init_shader(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
programm = gl.glCreateProgramObjectARB (); int frag = gl.glCreateShaderObjectARB ( GL.GL_FRAGMENT_SHADER_ARB );
gl.glAttachObjectARB ( programm, frag );
gl.glShaderSourceARB ( frag, 1, loadShader , null );
gl.glCompileShaderARB ( frag ); gl.glLinkProgramARB ( programm );
int texImage = gl.glGetUniformLocationARB ( programm, "test" ); gl.glUseProgramObjectARB ( programm ); gl.glUniform1iARB ( texImage, 0 );
}
private void render_quad(GLAutoDrawable drawable) { GL gl = drawable.getGL();
gl.glUseProgram(program);
gl.glBegin(GL.GL_QUADS); gl.glColor4f(1f,1f,1f,1.0f); gl.glVertex3f( -1000,0,-1000); gl.glColor4f(fr,fg,fb,1.0f); gl.glVertex3f( 1000,0,-1000); gl.glColor4f(fr,fg,fb,1.0f); gl.glVertex3f( 1000,0, 1000); gl.glColor4f(fr,fg,fb,1.0f); gl.glVertex3f( -1000,0, 1000); gl.glEnd();
gl.glUseProgram(0);
} |
|
|
|
|
|
13
|
Java Game APIs & Engines / JOGL Development / Translate Texture u/v
|
on: 2009-03-01 19:28:51
|
|
hello,
i would like to know if its possible to translate u/v positions of textures.
for simple example i call an complied object(triangle) that got uv's: 0.5f,0.0f 0.0f,1.0f 1.0f,1.0f
and i want to translate the u ord v coordinate for example: u +0.1f and v +0.0
so that i get : 0.6f,0.0f 0.1f,1.0f 1.1f,1.0f without create and compile the object again
is it possible and what did i need to do?
|
|
|
|
|
14
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator CPU Issues
|
on: 2009-01-14 13:05:59
|
|
Its the same on PC'S with:
ATI Xpress 200M , Notebook XP Geforce GO 7300 , Notebook XP Geforce 8000er series ,PC Vista
(all with latest drivers)
Yes i use vertex arrays and FramebufferObjects. i do not use any shaders
i will change the fpsanimator to animator later and tell you
much thx
|
|
|
|
|
15
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator CPU Issues
|
on: 2009-01-14 11:42:10
|
|
very interresting threat and hello to all,
i work with jogl since about april 08 and i also fall over the strange problem with the framerates and the CPU issues.
My application runs on Mobile Pentium (1,6ghz and shared ATI Graphics) with framerate 20-32 (FPSAnimator set to 60) , on an PC Athlon X2 (2x 2,0Ghz gamer pc) the same . But both get the Problem of the 100% CPU ... after changing the FPSAnimator down to 30 the CPU usages sinks to a normal level(max 15% CPU).
i Work with Netbeans (6.1 and now with 6.5) and there i got the problem that after 5-8minutes of using my program when i do nothing (no mousemove or something) the complete hardware freezes for minutes.
did anybody have some help or ideas?
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / Re: landscape data in files
|
on: 2008-11-16 21:40:41
|
hello moogie  i got no performance problem at moment, i only reload 5 cluster files when camera is leaving inner part.. the rest is moved in memory. but the question is, is it good to use so much files (40000 files with each 4-8k size) or are there better ways
|
|
|
|
|
19
|
Game Development / Newbie & Debugging Questions / landscape data in files
|
on: 2008-11-16 20:45:27
|
hello i work on an adventure game and i am now on an complicate point. i got my map in clusters int (20x20x3(height,ground,special ) 5x5 clusters are in memory (100x100) my first (very bad idea) was to save each cluster as seperate file (i produce 40000 files, very bad idea) my idea was, when the char/camera leaves the inner space the next 5 clusters are reloaded (north,south,east,west), the files are working..but 40000 files is tooo much. did anybody got an idea how i can fix this problem? i think about one large file and adress direct the data (read/save) that i need open the file... for (int z=0;z<100;z++) { for (int x=0;x<100;x++) { file_position=((cluster_z+z)*20000)+cluster_x+x read/write } } is it possible, is it good or bad idea and what is todo, i am not very experienced with file io stuff? thanks for any answer 
|
|
|
|
|
20
|
Java Game APIs & Engines / JOGL Development / Re: animator.stop problem
|
on: 2008-11-13 21:47:35
|
Spawn a new thread to call System.exit(). We've found that calling exit() from the Event Dispatch Thread doesn't work on all platforms. There are examples of this in the source code for the JOGL demos. ahhh, okay .. i understand much thanks 
|
|
|
|
|
21
|
Java Game APIs & Engines / JOGL Development / animator.stop problem
|
on: 2008-11-12 16:59:13
|
|
hello, i have a question about the animator.stop function:
how can i reach a clean quit in jogl application
public void keyReleased(KeyEvent key) { switch (key.getKeyCode()) { case KeyEvent.VK_ESCAPE: system.exit(0); break;
this exit didnt call the windowclosing and i have no idea how to do it! (after 3-5 time i run my application,the pc slows completly down,i think the exit didnt work good)
what can i do?
public static void main(String[] args) { ...
final FPSAnimator animator = new FPSAnimator(canvas,60 ); animator.setRunAsFastAsPossible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing() { runExit(animator); } }); ...
... private static void runExit(final FPSAnimator animator) { new Thread(new Runnable() { public void run() { animator.stop(); System.exit(0); } }).start(); }
|
|
|
|
|
22
|
Java Game APIs & Engines / JOGL Development / cubemap gl.glTexImage2D texture
|
on: 2008-11-06 09:05:13
|
hi its a little thing i am looking for . i play with cubemapping for some litte effects, i load my textures and nowi want to copy them into: ... gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL.GL_RGBA, imageSize, imageSize, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, texture[nr]<-error ); ... how do i bind my textures (texture[nr]) into the glTextImage2d to use them with cubemapping? thanks 
|
|
|
|
|
24
|
Java Game APIs & Engines / JOGL Development / displacement mapping?
|
on: 2008-10-26 14:20:54
|
|
hello, i try to create some water effects and i dont know how to start with shaders.
in flash8pro for websites i got the displacment mapping to creating cool water effects and i search for a way to bring it to opengl/jogl.
i got an FBO that is filled with the mirrow image and at moment its a flat water in the landscape with that mirror fbo texture. (looks ok,but boring) now i want to bring some life in it.
my idea is to access the fbo texture and add some perlin noise/displacement mapping to get the water wave effect like in all games.
did anybody got an idea on what can i do?
greetings theri
|
|
|
|
|
26
|
Java Game APIs & Engines / JOGL Development / light question
|
on: 2008-10-12 14:54:20
|
|
hello, i got a litte question where my error with lightning is.
my landscape getting the light form the sun_x,y,z position only when i tun off ambient complete, when using ambient the whole landscape is 100% light
here some parts of my code:
// used every frame public void initor(GLAutoDrawable arg0) { GL gl = arg0.getGL();
gl.glColor3f(0.0f, 0.0f, 0.0f); gl.glCullFace(GL.GL_FRONT); gl.glClearColor(0.0f,0.0f, 0.0f, 0.0f);//Blue gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {.1f, .1f, .1f, 0}, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {.5f, .5f, .5f, 0}, 0); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {.1f, .1f, .1f, 0}, 0); gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 1.f); gl.glColor4f(0,0,0,0); gl.glEdgeFlag(false);
gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); gl.glEnable (GL.GL_POLYGON_SMOOTH); gl.glEnable(GL.GL_AUTO_NORMAL); gl.glEnable(GL.GL_NORMALIZE); gl.glEnable(GL.GL_MULTISAMPLE); gl.glEnable(GL.GL_AUTO_NORMAL);
...
//the light is called every frame public void licht(GLAutoDrawable arg0) { GL gl = arg0.getGL();
float gray1[] = { 0.1f, 0.1f, 0.1f, 0.1f }; float gray2[] = { 0.4f, 0.4f, 0.4f, 0.0f }; float gray3[] = { 0.3f, 0.3f, 0.3f, 0.0f }; //Licht 1 float l_position[] = { sun_x,sun_y,sun_z, 1.0f}; gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, l_position, 0); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, gray2, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, gray1, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_SPECULAR, gray3, 0 ); FloatBuffer ambient = BufferUtil.newFloatBuffer(4); float hell=0.0f; ambient.put(hell); ambient.put(hell); ambient.put(hell); ambient.put(0); ambient.rewind(); gl.glLightModelfv( GL.GL_LIGHT_MODEL_AMBIENT, ambient ); gl.glShadeModel(GL.GL_SMOOTH); // Enables Smooth Color Shading gl.glEnable(GL.GL_LIGHTING); gl.glEnable(GL.GL_LIGHT0); gl.glEnable(GL.GL_COLOR_MATERIAL); }
...
... gl.glColor4f(r1,g1,b1,al1); gl.glTexCoord2d(tx1,ty1); gl.glNormal3f(lx1,1.0f,lz1); gl.glVertex3f( x+t,h1,z+tt ); ...
the ambient color is also not changing the density ambient color 0.1f,0.1f,0.1f,0.0f look same like 1.0f,1.0f,1.0f,0.0f
when turning ambient off or when only using red ambient the color looks strange and rough but works.
i think there must be anything missing, a command,i dont know i look at other samples but cant find what it is.
what can be my error?
|
|
|
|
|
28
|
Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error
|
on: 2008-09-25 08:50:46
|
ok. i work on the problem the last days and now i fall over something much better.. instead using eclipse i use now netbeans this ide do the job perfect ok, only a litte thing in netbeans is with the heapspace, when import my large float vars it gets on netbeans the heap space error (in eclipse it was okay) float [] heighter = new float[2000000]; //yes i need something large like this  but my application runs now direct (without the landscpace float error var) and its direct build for 8 other sytems (mac,solaris,linux etc) thats more i dream of
|
|
|
|
|
30
|
Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error
|
on: 2008-09-22 21:39:55
|
complicated stuff  i tryed jsmooth but the problem stays.. the main-class error at moment it dosnt matter to me on what system it runs.. the only thing that i want that it runs ..no matter on what.. only one time that it start without eclipse i come from c++ and there i only need to add the libs inside the visual studio.. the compiler do the job.. in java/eclipse is everything complicated only for understanding: the problem seems the jogl libs i add them inside eclipse editor at buildpath/libarys ..and there they work (jogl.jar gluegen-rt.jar) and i have left the .libs in my jogl installation folder (jogl.lib jogl-awt.lib jogl-cg. gluegen-rt.lib) ok: what lib or what jar did i have to put where in the workspace or in the final jar or something else and what did i have to add inside the manifest.mf in the final jar are my folders and the Meta-inf ,should i create there an folder libs and copy all inside (libs and jars)? thanks for help.. i am very confused
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|