Basic rendering tutorial on RC1

Started by chrizo, July 02, 2008, 13:50:55

Previous topic - Next topic

chrizo

Hi guys, its been a while. I was busy...  ;D

I've been trying out http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicopengl with LWJGL2 RC1

I cant seem to find the rotating quad anymore. (Black screen)

I commented out //GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);

Replacing it with GL11.glLoadIdentity to focus back on 0,0,0, I find the quad again. but when I move it with GL11.glTranslate, it disappears beyond Z -1 to +1

It used to work even by copy pasting, last time I used 1.1.4.

Matzon

The test fails, because it assumes some initialization/setup code in Display, which was removed. I have added it to the tests in SVN trunk.

QuoteLog Message:
-----------
added opengl init code, previously assumed from Diplay

Modified Paths:
--------------
    trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
    trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java

Modified: trunk/LWJGL/src/java/org/lwjgl/examples/Game.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/Game.java   2008-06-28 07:29:33 UTC (rev 3107)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/Game.java   2008-07-02 20:00:49 UTC (rev 3108)
@@ -101,6 +101,16 @@
      AL.create();
      
      // TODO: Load in your textures etc here
+      
+      // Put the window into orthographic projection mode with 1:1 pixel ratio.
+      // We haven't used GLU here to do this to avoid an unnecessary dependency.
+      GL11.glMatrixMode(GL11.GL_PROJECTION);
+      GL11.glLoadIdentity();
+      GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
+      GL11.glMatrixMode(GL11.GL_MODELVIEW);
+      GL11.glLoadIdentity();
+      GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
+      
   }
   
   /**

Modified: trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java   2008-06-28 07:29:33 UTC (rev 3107)
+++ trunk/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java   2008-07-02 20:00:49 UTC (rev 3108)
@@ -92,6 +92,14 @@
   
   private void initializeOpenGL() {
     GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+   // Put the window into orthographic projection mode with 1:1 pixel ratio.
+   // We haven't used GLU here to do this to avoid an unnecessary dependency.
+   GL11.glMatrixMode(GL11.GL_PROJECTION);
+   GL11.glLoadIdentity();
+   GL11.glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
+   GL11.glMatrixMode(GL11.GL_MODELVIEW);
+   GL11.glLoadIdentity();
+   GL11.glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());   
   }

   public void executeTest() {

chrizo

Thanks Matzon,

Btw, where can I learn about the changes that I need to make from 1.1.4 to 2.0?