Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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 1042 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: 356
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
« League of Dukes »

« JGO Overlord »


Medals: 840
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
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.

 

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 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (46 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 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!