Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (702)
Games in Android Showcase (203)
games submitted by our members
Games in WIP (774)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [LWJGL] Problem with Viewport and Windows Aero vs. Basic  (Read 1702 times)
0 Members and 1 Guest are viewing this topic.
Offline greenOwl

Junior Devvie


Medals: 1


from Germany


« Posted 2013-03-10 13:26:09 »

Hello,

today I used a different PC than I'm usually using for my OpenGL development. On my standard PC I run Win7 with Windows Aero ... everything works just fine. But on this new maschine I get a different result using Viewports:

Normal PC / different PC with basic (intended):


different PC with Aero (problem):


It appears that for same reason the glViewport(5, 5, widht, height) gets transformed to glViewport(10, 0, width, height) ... or something like that. I checked the glViewport call and the values are correct but the result stays flawed.
Also interesting: as soon as I change the displayMode or manually resize the window the viewport gets applyed correctly.

Can someone explain why this problem occurs?
Thanks!

elfeck
Offline ra4king

JGO Kernel


Medals: 467
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2013-03-10 19:58:14 »

Ooof....this might be an LWJGL bug. Are you using the latest version?

Offline greenOwl

Junior Devvie


Medals: 1


from Germany


« Reply #2 - Posted 2013-03-11 08:55:16 »

I'm using 2.8.5 which should be the latest version. If someone has an idea feel free to post here. I think I might post it in the lwjgl forums as well an see if I get an answer there.

elfeck
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
Administrator

« JGO Overlord »


Medals: 1243
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2013-03-11 09:14:33 »

Give us code, so we can actually make some informed suggestions.  Pointing

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline greenOwl

Junior Devvie


Medals: 1


from Germany


« Reply #4 - Posted 2013-03-13 17:47:07 »

Sorry this comes two days late, had lots of work to do. Here some code:

glInit (Display)
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  
   private void glInitContext() {
      DisplayMode displayMode = new DisplayMode(main.getWidth(), main.getHeight());
      windowDimensions = new int[] { 0, 0, main.getWidth(), main.getHeight() };
      PixelFormat pixelFormat = new PixelFormat().withSamples(8);
      try {
         Display.setDisplayMode(displayMode);
         Display.create(pixelFormat);
         Display.setTitle(title);
         Display.setResizable(resizable);
      } catch (LWJGLException e) {
         e.printStackTrace();
      }
      glEnable(GL_DEPTH_TEST);
      glDepthFunc(GL_LEQUAL);
      glDepthMask(true);
      glDepthRange(0.0f, 1.0f);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_MULTISAMPLE);
      glEnable(GL_SCISSOR_TEST);
      glViewport(0, 0, Display.getWidth(), Display.getHeight());
      glScissor(0, 0, Display.getWidth(), Display.getHeight());
      EPHVertexArrayObject.glInitShaderProgramPool(shaderParentPath);
      glInitialized = true;
      synchronized (glInitMonitor) {
         glInitMonitor.notifyAll();
      }
   }


glDraw (VAO)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public synchronized void glRender() {
      if (handle < 0 || !updated) glInit();
      if (size > 0 && hasVisibleEntries()) {
         glBindVertexArray(handle);
         glViewport(viewPortRect[0], viewPortRect[1], viewPortRect[2], viewPortRect[3]); // viewportRect is set correctly
         glScissor(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]); // scissorRect is also set correctly
                        // Binding the Program
                        // upload the uniforms
                        // glDrawElements(...)
                        // unbind the Program
         glBindVertexArray(0);
      }
   }


I'm not too sure what kind of code you'd like to see ... I thought this are the parts where the viewport is important .

elfeck
Offline greenOwl

Junior Devvie


Medals: 1


from Germany


« Reply #5 - Posted 2013-03-30 21:13:11 »

I know this comes late, but I finally managed to resolve the problem and for further reference here the solution (that worked for me):
For some reason the LWJGL Display bugs out if you issue Display.create(...) before the Display.setResizable(true). So the solution for me was changing
1  
2  
3  
4  
5  
//...
Display.setDisplayMode(displayMode);
Display.create(pixelFormat);
Display.setResizable(resizable); // true
// ...

to
1  
2  
3  
4  
5  
// ...
Display.setDisplayMode(displayMode);
Display.setResizable(resizable); // true
Display.create(pixelFormat);
// ...

elfeck
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Lunch (33 views)
2016-12-06 16:01:40

ral0r2 (259 views)
2016-11-23 16:08:26

ClaasJG (394 views)
2016-11-10 17:36:32

CoffeeChemist (489 views)
2016-11-05 00:46:53

jay4842 (536 views)
2016-11-01 19:04:52

theagentd (548 views)
2016-10-24 17:51:53

theagentd (542 views)
2016-10-24 17:50:08

theagentd (493 views)
2016-10-24 17:43:15

CommanderKeith (489 views)
2016-10-22 15:22:05

Roquen (456 views)
2016-10-22 01:57:43
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
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!