Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (690)
Games in Android Showcase (201)
games submitted by our members
Games in WIP (764)
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: JOGL2 TextureIO missing newTextureData method??? on: 2009-10-13 14:05:29
much thx @gouessej

it works

2  Java Game APIs & Engines / JOGL Development / Re: JOGL2 TextureIO missing newTextureData method??? on: 2009-10-13 13:27:41
i got the same problem with the missing texuredata.

what did you use/import to get it to work?

import java.awt.textureio ?!?


3  Java Game APIs & Engines / JOGL Development / Re: FBO (convert to jogl2 problem) (update:solution found) on: 2009-10-11 11: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 16: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
   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 Smiley

5  Java Game APIs & Engines / JOGL Development / Fragment Shader with Standart Fog on: 2009-08-03 07:41:49

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

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 13: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;

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 11: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 20:26:29
thank you very much,

at this time i got an vertex/fragment water done by myself Smiley

there are some litte questions open:

i load via

int to  = gl.glGetUniformLocationARB(program, "tex1");
gl.glUniform1iARB(t0, 0);

//fragment shader...
"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 07:31:26
it makes really fun working with the fragment shader Smiley

i got only with water an simple/nice bump mapping water to work Smiley

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);

what code did i need to use in the frag code
that the alpha values will be used?

greetings Smiley


   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" +
            " vec4 texel2      = texture2D(texUnit2 , texCoord);\n" +
            " gl_FragColor = texel2;\n" +  // texel2*texel
10  Java Game APIs & Engines / JOGL Development / Re: Shaders start on: 2009-03-05 20:09:26
thank you very very much Smiley

that code works perfect und its a great base to learn
the shader stuff on an living object Wink

much thanks again Smiley

11  Java Game APIs & Engines / JOGL Development / Shaders start on: 2009-03-05 09: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 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 Smiley

  private String[] loadShader ( void ) {

    int t = 5;
    String shader[] = new String[t];

//i dont know that this is doing!

    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.glVertex3f( -1000,0,-1000);
      gl.glVertex3f(  1000,0,-1000);
      gl.glVertex3f(  1000,0, 1000);
      gl.glVertex3f( -1000,0, 1000);



12  Java Game APIs & Engines / JOGL Development / Re: Translate Texture u/v on: 2009-03-02 06:38:58
ahhh, i understand...

thats perfect and easy Smiley

much much thanks to you for your help

13  Java Game APIs & Engines / JOGL Development / Translate Texture u/v on: 2009-03-01 18:28:51

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 12: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 10: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?

16  Game Development / Newbie & Debugging Questions / Re: landscape data in files on: 2008-11-16 21:32:30
much thanks Smiley
17  Game Development / Newbie & Debugging Questions / Re: landscape data in files on: 2008-11-16 21:21:54
RandomAccessFile sounds like for what i search for.

is there any online tutorial for that?

18  Game Development / Newbie & Debugging Questions / Re: landscape data in files on: 2008-11-16 20:40:41
hello moogie Smiley

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 19:45:27

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++)

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 Smiley
20  Java Game APIs & Engines / JOGL Development / Re: animator.stop problem on: 2008-11-13 20: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 Smiley
21  Java Game APIs & Engines / JOGL Development / animator.stop problem on: 2008-11-12 15:59:13
hello, i have a question about the animator.stop

how can i reach a clean quit in jogl application

 public void keyReleased(KeyEvent key) {
          switch (key.getKeyCode()) {
                case KeyEvent.VK_ESCAPE:

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 );
        frame.addWindowListener(new WindowAdapter() {
        public void windowClosing() {

private static void runExit(final FPSAnimator animator) {
       new Thread(new Runnable() {
        public void run() {

22  Java Game APIs & Engines / JOGL Development / cubemap gl.glTexImage2D texture on: 2008-11-06 08:05:13

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:

                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 Smiley

23  Java Game APIs & Engines / JOGL Development / Re: Pixel Shader example for jogl wanted... on: 2008-10-29 09:01:56
the shader designer tool from looks very cool

i am also like to see how to implement the

envmap.vert & envmap.frag files for example  to an simple

netbeans/opengl/jogl sample to see and learn

in the netbeans plugins there are the jogl shader examples
but in a very complicate structure

24  Java Game APIs & Engines / JOGL Development / displacement mapping? on: 2008-10-26 13: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


25  Java Game APIs & Engines / JOGL Development / Re: light question on: 2008-10-12 17:50:59
i got an answer.

the problem was inside the color arguments , rgb over 1.0f was producing this situation.

26  Java Game APIs & Engines / JOGL Development / light question on: 2008-10-12 12: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.glClearColor(0.0f,0.0f, 0.0f, 0.0f);//Blue

    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.glEnable (GL.GL_POLYGON_SMOOTH);


//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;
             gl.glLightModelfv( GL.GL_LIGHT_MODEL_AMBIENT, ambient );
       gl.glShadeModel(GL.GL_SMOOTH);           // Enables Smooth Color Shading


    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?

27  Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error on: 2008-09-25 17:16:51
much much much thanks to you all


all work perfect now Smiley

Smiley Smiley Smiley Smiley Smiley
28  Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error on: 2008-09-25 06: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 Wink

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

29  Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error on: 2008-09-23 06:19:51

Manifest-Version: 1.0
Main-Class: fso
Class-Path: jogl.jar gluegen-rt.jar

the jogl.jar and the gluegen.jar are in the root to the fso.jar

result: could not find main class . program will exit
30  Game Development / Newbie & Debugging Questions / Re: Eclipse Jar creating ? main-class error on: 2008-09-22 19:39:55
complicated stuff Wink

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


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

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


Pages: [1] 2 3
xTheGamerPlayz (111 views)
2016-09-26 21:26:27

Wave Propagation (308 views)
2016-09-20 13:29:55

steveyg90 (418 views)
2016-09-15 20:41:23

steveyg90 (419 views)
2016-09-15 20:13:52

steveyg90 (460 views)
2016-09-14 14:44:42

steveyg90 (483 views)
2016-09-14 14:42:13

theagentd (480 views)
2016-09-12 16:57:14

theagentd (413 views)
2016-09-12 14:18:31

theagentd (303 views)
2016-09-12 14:14:46

Nihilhis (737 views)
2016-09-01 13:36:54
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!