Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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  Game Development / Newbie & Debugging Questions / Re: LWJGL - 0, 0 at Top Left, FBO issue on: 2013-12-17 22:00:11
To sum up, it's this I can't get to work: https://gist.github.com/pwnedary/8012530.
2  Game Development / Newbie & Debugging Questions / Re: LWJGL - 0, 0 at Top Left, FBO issue on: 2013-12-15 14:08:22
Yes I know and that is the problem, as I want the coordinate system to be the same as in normal Java2D/AWT.
3  Game Development / Newbie & Debugging Questions / LWJGL - 0, 0 at Top Left, FBO issue on: 2013-12-15 11:32:28
I've been making my own sort of 2D game engine matching my code style for fun. As a personal challenge I tried to give it the ability to swap LWJGL with Java2D by changing one line.
I am really new to LWJGL, so upon implementing off-screen rendering with FBOs I noticed they weren't working when I had 0, 0 being the top left corner of the screen as in Java2D.

EDIT: basically I can't get this to work: https://gist.github.com/pwnedary/8012530

Here it is working and drawing a blue square over the firefox logo:

but here it isn't:


I enter ortho with this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, width, height, 0, 1, -1); // 0,0 : top-left
     // glOrtho(0, width, 0, height, 1, -1); // 0,0 : bottom-left
     glMatrixMode(GL_MODELVIEW);

      glEnable(GL_TEXTURE_2D);
      glShadeModel(GL_SMOOTH);
      glDisable(GL_DEPTH_TEST);
      glDisable(GL_LIGHTING);
      glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
      glClearDepth(1);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glViewport(0, 0, width, height);


and construct FBO:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
      if (!GLContext.getCapabilities().GL_EXT_framebuffer_object) throw new Error("FBOs not supported");

      // Initialize frame buffer
     IntBuffer buffer = BufferUtils.createIntBuffer(1); // ByteBuffer.allocateDirect(1*4).order(ByteOrder.nativeOrder()).asIntBuffer(); // allocate a 1 int byte buffer
     EXTFramebufferObject.glGenFramebuffersEXT(buffer); // generate
     frameBufferID = buffer.get(0);

      image.bind();

      // Attach a texture
     bind();
      EXTFramebufferObject.glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, image.target, image.getTextureID(), 0);

      check(); // Check (from LWJGL's tutorial on FBOs)

      image.unbind();
      unbind();


and FBO.bind:
1  
2  
3  
      EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, frameBufferID);
      GL11.glPushAttrib(GL_VIEWPORT_BIT);
      GL11.glViewport(0, 0, image.getWidth(), image.getHeight());


Thanks in advance. I'm really desperate for posting this as I have had this problem for weeks.
4  Game Development / Newbie & Debugging Questions / [SOLVED] LWJGL - Draw section of texture on: 2013-05-10 10:43:59
I'm new to LWJGL, and wonder how to draw a section of an image for example a spritesheet, in a 2d game. I have been browsing the internet and only found that you can have half numbers to
1  
glTexCoord2f(0.5f, 0.5f);
.
Also does the textures dimensions need to be the power of 2, and can you draw a part 12x14 in dimensions of a texture.

Thanks in advance.
5  Games Center / Showcase / Re: Drift Soccer! on: 2013-05-09 18:52:15
Decreasing the friction would make more players move at the same time.
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.

xsi3rr4x (31 views)
2014-04-15 18:08:23

BurntPizza (28 views)
2014-04-15 03:46:01

UprightPath (43 views)
2014-04-14 17:39:50

UprightPath (26 views)
2014-04-14 17:35:47

Porlus (42 views)
2014-04-14 15:48:38

tom_mai78101 (64 views)
2014-04-10 04:04:31

BurntPizza (124 views)
2014-04-08 23:06:04

tom_mai78101 (224 views)
2014-04-05 13:34:39

trollwarrior1 (190 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!