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]
1  Java Game APIs & Engines / JOGL Development / Re: Model Loader with Jogl1.1 on: 2011-04-17 17:50:57
have a look on this 3ds-model loader:
http://www.xup.in/dl,54298290/model.rar/

its not from me, but works good and saved me much time in building an own one Cheesy
"JD3dsModel" is the 3DS model loader class.
2  Java Game APIs & Engines / JOGL Development / shadows with textures on: 2011-04-17 17:46:10
Hi,
its me again!
I tried to setup a simple shadow. I used the code from this tutorial: http://fabiensanglard.net/shadowmapping/index.php
Well, its working good (not the best shadow creation but its ok for me) but I am not able to use textures.
I tried it with multitexturing, since the shadow map is a TEXTURE_2D but it doesnt work.
All I got is this:



(yes, there also should be a skybox)

Does anyone know how to solve this?
Or, also a better/other shadow tutorial would also be useful, especially if i can use textures with it Tongue


greets
3  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-16 10:21:36
Wow!
That was really it!
I used IntBuffers for fboId and depthTextureId but it seems that this was wrong. changing them to int arrays solved the problem!!
VERY MUCH THANKS!! Smiley
4  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-14 22:53:52
Mhm, Im running on windows 7 x64 and a Radeon HD 6970 + Geforce 250 GT....

The error is FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT (code: 36055)
5  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-14 22:36:24
Mhm, i checked your code, and also tried your tips, but nothing helped.
Then I tried to call this lines:


1  
2  
System.out.println(glCapabilities.getPbufferRenderToTexture());
System.out.println(glCapabilities.getPbufferRenderToTextureRectangle());


And I got two times false. Could it be that my drivers dont support framebuffers / render to texture? or is this something other?
6  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-14 19:20:03
Very much THANKS!
Now it works correctly! Sorry for my noobishness!

Well, if its ok for you i have one last question, i tried to make a Framebuffer object, but always when i check the framebuffer with glCheckFramebufferStatus i get an error code, so that i cant use the frambuffer Sad
I set it up like this:
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  
    void generateShadowFBO(GL2 gl)
    {
       int shadowMapWidth = RENDER_WIDTH * SHADOW_MAP_RATIO;
       int shadowMapHeight = RENDER_HEIGHT * SHADOW_MAP_RATIO;
       
       //GLfloat borderColor[4] = {0,0,0,0};
       
       int FBOstatus;
       
       // Try to use a texture depth component
       gl.glGenTextures(1, depthTextureId);
       gl.glBindTexture(GL2.GL_TEXTURE_2D, depthTextureId);
       
       // GL_LINEAR does not make sense for depth texture. However, next tutorial shows usage of GL_LINEAR and PCF. Using GL_NEAREST
       gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
       gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
       
       // Remove artefact on the edges of the shadowmap
       gl.glTexParameterf( GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP );
       gl.glTexParameterf( GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP );
       
       // This is to allow usage of shadow2DProj function in the shader
       gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_COMPARE_MODE, GL2.GL_COMPARE_R_TO_TEXTURE);
       gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_COMPARE_FUNC, GL2.GL_LEQUAL);
       gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_DEPTH_TEXTURE_MODE, GL2.GL_INTENSITY);
       
       
       
       // No need to force GL_DEPTH_COMPONENT24, drivers usually give you the max precision if available
       gl.glTexImage2D( GL2.GL_TEXTURE_2D, 0, GL2.GL_DEPTH_COMPONENT, shadowMapWidth, shadowMapHeight, 0, GL2.GL_DEPTH_COMPONENT, GL2.GL_UNSIGNED_BYTE, 0);
       gl.glBindTexture(GL2.GL_TEXTURE_2D, 0);
       
       // create a framebuffer object
       gl.glGenFramebuffers(1, fboId);
       gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboId);
       
       // Instruct openGL that we won't bind a color texture with the currently binded FBO
       gl.glDrawBuffer(GL2.GL_NONE);
       gl.glReadBuffer(GL2.GL_NONE);
       
       // attach the texture to FBO depth attachment point
       gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT,GL2.GL_TEXTURE_2D, depthTextureId, 0);
       
       // check FBO status
       FBOstatus = gl.glCheckFramebufferStatusEXT(GL2.GL_FRAMEBUFFER);
       if(FBOstatus != GL2.GL_FRAMEBUFFER_COMPLETE)
          System.out.println("GL_FRAMEBUFFER_COMPLETE_EXT failed, CANNOT use FBO\n");
       
       // switch back to window-system-provided framebuffer
       gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
    }


I need it for a simple shadow. Would it also be possible to render the screen simply to a texture?
Thank you! and it would be ok if you dont want to help me anymore Cheesy
7  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-14 17:07:45
yes you are right..anyways thats for you help!

Well, I tried a complete new project and simply put this in:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
    public void init(GLAutoDrawable arg0)
    {
        GL2 gl = arg0.getGL().getGL2();
        GLU glu = new GLU();
       
       
        gl.glViewport(0, 0, arg0.getWidth(), arg0.getHeight());
        glu.gluPerspective(45.0f, (float)arg0.getWidth()/(float)arg0.getHeight(), 1.0f, 2000.0f);
   
     

    }


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int width,
         int height) {
      // TODO Auto-generated method stub
      GL2 gl = arg0.getGL().getGL2();
        GLU glu = new GLU();
       
       
       
        gl.glViewport(0, 0, width, height);
        glu.gluPerspective(90.0f,(float)width/(float)height), 1.0f, 2000.0f);
             
   }


and put a sphere in the render routine. If i set the screen size for example to 600x600, everything looks normal. But if I set it on 1280x720 for example, everything is streched horizontally. I tried everything on the viewports and it seems that gluPerspective does NOTHING. No matter what i type in as parameters the view is always the same. I guess this is not normal and maybe the problem??

thank you in advance!
8  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-13 20:10:06
thanks for your help
i checked all your advices and changed the hardcoded w and h with the GLAutoDrawable getHeight and getWidth. But nothing changed. It is still distorted Sad
I also activated the lighting but now I just get this:



it seems that just the skybox is lightened up. But also not really correct. I dont know whats going on x_x
9  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-07 22:57:24
Mh, the adding of matrix.put(15,1f) didnt anything....

but here is my projection setup:

1  
2  
3  
4  
5  
6  
7  
8  
if (height <= 0) { height = 1; }
   final float h=(float)width/(float)height;
   gl.glViewport(0, 0, width, height);
   gl.glMatrixMode(gl.GL_PROJECTION);
   gl.glLoadIdentity();
   glu.gluPerspective(45.0f, h, 1.0, 10000.0);
   gl.glMatrixMode(gl.GL_MODELVIEW);
   gl.glLoadIdentity();


or if its still too few, here is my complete source: http://www.xup.in/dl,80364351/src.zip/
I hope its not too complicated  persecutioncomplex

//Edit: It seems I also have some other problems. I'm also not able to render to texture.
I use this function to render to texture:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
 
private void renderToTexture(GL gl, GLU glu) // Renders To A Texture
    {
        gl.glViewport(0, 0, 128, 128);    // Set Our Viewport (Match Texture Size)

        renderScene();      //renders the scene

        // Bind To The Blur Texture
        gl.glBindTexture(GL.GL_TEXTURE_2D, renderTexture);  

        // Copy Our ViewPort To The Blur Texture (From 0,0 To 128,128... No Border)
        gl.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_LUMINANCE, 0, 0, 128, 128, 0);

        // Clear The Screen And Depth Buffer
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);      

        gl.glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);  // Set Viewport back to normal size
    }


And my lighting also seems to be wrong. If i enable a simple light, everything is same bright. There are no darker and brighter sides (for example at my box). I dont get it...i also tried to light via Shader, but its the same effect. Everything at the same brightness..
10  Java Game APIs & Engines / JOGL Development / Re: JOGL Y axis too large on: 2011-04-07 21:20:33
mhm, I cant find it.
To get a FPS like movement, I set a FloatBuffer like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public void set(){
      matrix.put(0, cosc*cosb-sinc*sina*sinb);
      matrix.put(1, sinc*cosb+cosc*sina*sinb);
      matrix.put(2, -cosa*sinb);
      matrix.put(4, -sinc*cosa);
      matrix.put(5, cosc*cosa);
      matrix.put(6, sina);
      matrix.put(8, cosc*sinb+sinc*sina*cosb);
      matrix.put(9, sinc*sinb-cosc*sina*cosb);
      matrix.put(10, cosa*cosb);
     
      matrix.put(12, matrix.get(0)*x+matrix.get(4)*y+matrix.get(8)*z);
      matrix.put(13, matrix.get(1)*x+matrix.get(5)*y+matrix.get(9)*z);
      matrix.put(14, matrix.get(2)*x+matrix.get(6)*y+matrix.get(10)*z);
   
   }


and while rendering i load the matrix with this commands:

1  
2  
matrix.rewind();      
gl.glLoadMatrixf(matrix);



These are the movement functions:

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  
public void setHeading(float amount){
      heading+=amount;
      cosb=(float)Math.toRadians(Math.cos(heading));
      sinb=(float)Math.toRadians(Math.sin(heading));
      cosz=(float)Math.toRadians(Math.cos(heading+_90));
      sinz=(float)Math.toRadians(Math.sin(heading+_90));
   
   }
   public void setPitch(float amount){
      pitch-=amount;
      if(pitch>_maxPitch)pitch=_maxPitch;
      if(pitch<-_maxPitch)pitch=-_maxPitch;
      cosa=(float)Math.cos(pitch);
      sina=(float)Math.sin(pitch);
   }
   public void setFord(float amount){
      x+=cosz*amount;
      z+=sinz*amount;
   }
   public void setBack(float amount){
      x-=cosz*amount;
      z-=sinz*amount;
   }
   public void setStrafel(float amount){
      x+=cosb*amount;
      z+=sinb*amount;
   }
   public void setStrafer(float amount){
      x-=cosb*amount;
      z-=sinb*amount;
   }
   public void setHeight(float amount){
      y=amount;
   }



Maybe here is something wrong with the matrix calculation? Because my viewPort etc are initialized like you said...
Please help me, I dont geht the error  Cry
11  Java Game APIs & Engines / JOGL Development / JOGL Y axis too large on: 2011-04-07 16:31:44
Hi!

first off, I'm german, so sorry for bad language Smiley


I have a problem with my JOGL code. The Y axis is much bigger than the other ones. If I try to create a circle with gluSphere it is distorted vertically. Also if I build a "box" with vertexes, i have to hold the y values very small.
I tried everything  (gluPerspective, glViewport, etc etc) but nothing seemes to be the correct solution.

I hope you understand my problem.. :/


greetings
Pages: [1]
 

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!