Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: BASIC app, but white lines show up blue?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    14

    BASIC app, but white lines show up blue?

    I've been working on learning opengl from the red book.. I was working on a small app that was working well when suddenly.. all of my lines went from white to blue? I rewrote a skeleton that was basically as small as I could make it... lines are still blue... I don't see anything I'm doing wrong, I've checked it against other examples, but.. I obviously must be. Can someone see an obvious problem?

    Code :
    #include <iostream>
    #include "GL/glut.h"
     
    using namespace std;
     
    void reshape(int w, int h)
    {
        glMatrixMode(GL_PROJECTION);
        glViewport(0, 0, w, h);
        glLoadIdentity();
        gluOrtho2D (0.0, w, 0.0, h);
        glMatrixMode(GL_MODELVIEW);
    }
     
     
    void draw( ) {
     
        glMatrixMode( GL_MODELVIEW );
        glLoadIdentity();
        glClear( GL_COLOR_BUFFER_BIT );
     
        // set the pen color = white
        glColor3f( 1.0, 1.0, 1.0 );
     
        glBegin( GL_LINE_STRIP );
     
            glVertex2f( 100, 100 );
            glVertex2f( 200, 200 );
     
        glEnd();
     
        // but it shows up as blue?
     
        glFinish();
    }
     
     
     
    int main( int argc, char** argv ) {
     
        glutInit( &amp;argc, argv );
     
        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
        glutInitWindowSize(300, 300);
        glutInitWindowPosition(200,200);
     
        glutCreateWindow("helloworld");
        glClearColor( 0.0, 0.0, 0.0, 1.0 );
     
        glutDisplayFunc( draw );
        glutReshapeFunc( reshape );
     
        glutMainLoop();
     
        return 0;
    }

    Any help here is super super appreciated!

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    16

    Re: BASIC app, but white lines show up blue?

    When you undo the changes you made to the code, to the lines become white again? If so, what was the original code?

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    14

    Re: BASIC app, but white lines show up blue?

    I don't even remember where this happened. I've been working / fighting with it so long. But this basic app, I can't find anything wrong with it. I did some linux updates, maybe my glut library got messed with? But I doubt it. I don't understand. =/

  4. #4
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    418

    Re: BASIC app, but white lines show up blue?

    Is the code actually compiling? Try replacing the line
    Code :
    #include "GL/glut.h"
    with
    Code :
    #include <GL/glut.h>
    The reason I ask is because the code doesn't even compile on my machine until I make the above change. But if I make that change then yes, I see a white line. And if you are thinking it compiles but it doesn't then you are possible running an old compiled version of the code that happened to have a blue line?

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    14

    Re: BASIC app, but white lines show up blue?

    It compiles. I'm currently using JUST the code above. Totally seperate side app. Still a blue line... if I change it to glColor3f(1.0, 0.0, 0.0) the line disappears completely?

    EDIT: It compiles with "" or <> I meant. This started happening about the same time a bunch of linux updates got pulled.. might it be related? If so.. any idea how I could fix it? I've cleaned and rebuilt a million times..

  6. #6
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    16

    Re: BASIC app, but white lines show up blue?

    Well, you can always try glcolor4f just to see if anything happens.

  7. #7
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    14

    Re: BASIC app, but white lines show up blue?

    Tried that... no difference... =/ Are you seeing a white line too AGL?

  8. #8
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    418

    Re: BASIC app, but white lines show up blue?

    I would be surprised if an update caused this -- but what system are you on? I am on Ubuntu 9.10 and just did some updates without any problems like you describe.

    If you suspect a library problem do the following
    Code :
    g++ main.c -lglut (or whatever your compile command is)
    ldd a.out (or whatever your executable name is)
    This gives me a listing of all the libraries linked as
    Code :
    > ldd a.out 
    	linux-gate.so.1 =>  (0x00b24000)
    	libglut.so.3 => /usr/lib/libglut.so.3 (0x00599000)
    	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00629000)
    	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00110000)
    	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x004d1000)
    	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00136000)
    	libGL.so.1 => /usr/lib/libGL.so.1 (0x00e58000)
    	libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00bd0000)
    	libXext.so.6 => /usr/lib/libXext.so.6 (0x0027b000)
    	libX11.so.6 => /usr/lib/libX11.so.6 (0x0028b000)
    	/lib/ld-linux.so.2 (0x00cec000)
    	libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x00f1c000)
    	libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0x003f6000)
    	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00b55000)
    	libXau.so.6 => /usr/lib/libXau.so.6 (0x00603000)
    	libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00a20000)
    	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00b01000)
    What do you get when you run ldd on your compiled executable? It may help me if you post the result.

    Now you can manually go through and check the date on each library for instance picking on /usr/lib/libglut.so.3 yields
    Code :
    ls -alF /usr/lib/libglut.so.3
    lrwxrwxrwx 1 root root 16 2009-05-19 20:38 /usr/lib/libglut.so.3 -> libglut.so.3.8.0
     
    ls -alF /usr/lib/libglut.so.3.8.0 
    -rw-r--r-- 1 root root 204656 2008-11-19 04:33 /usr/lib/libglut.so.3.8.0

    From there let us know if there are any changes in dates after your suspected update date ... For me I keep my system up do date (Ubuntu 9.10) and you see the installed GLUT hasn't changed for over a year.

  9. #9
    Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Los Angeles
    Posts
    386

    Re: BASIC app, but white lines show up blue?

    Quote Originally Posted by vertex3f
    Tried that... no difference... =/ Are you seeing a white line too AGL?
    I just compiled this on a Windows platform and it worked fine. Got a white line. Is it possible that the red and green components in you glColor command are being ignored? If you try using (0,0,0.5) instead of (0,0,1), do you get a darker blue line?
    Am I doing your homework for you?

  10. #10
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    14

    Re: BASIC app, but white lines show up blue?

    marshats: I'm on Fedora 12 x86_64. I have libglut.so.3.9.0, and the modification date is:

    Code :
    -rwxr-xr-x. 1 root root 290920 2009-11-28 05:44 /usr/lib64/libglut.so.3.9.0*

    Running on ldd turned up interesting results...
    Code :
    	linux-vdso.so.1 =>  (0x00007fff0d5d4000)
    	libglut.so.3 => /usr/lib64/libglut.so.3 (0x00007ff99f90e000)
    	libGLU.so.1 => /usr/lib64/libGLU.so.1 (0x00007ff99f6af000)
    	libc.so.6 => /lib64/libc.so.6 (0x0000003e30000000)
    	libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007ff99f431000)
    	libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003e37c00000)
    	libm.so.6 => /lib64/libm.so.6 (0x0000003e30c00000)
    	libXext.so.6 => /usr/lib64/libXext.so.6 (0x0000003e32c00000)
    	libX11.so.6 => /usr/lib64/libX11.so.6 (0x0000003e31800000)
    	libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x0000003e42e00000)
    	libXi.so.6 => /usr/lib64/libXi.so.6 (0x0000003e36000000)
    	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003e37800000)
    	/lib64/ld-linux-x86-64.so.2 (0x0000003e2fc00000)
    	libXdamage.so.1 => /usr/lib64/libXdamage.so.1 (0x0000003e38800000)
    	libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x0000003e33c00000)
    	libdrm.so.2 => /usr/lib64/libdrm.so.2 (0x00007ff99f223000)
    	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003e30800000)
    	libdl.so.2 => /lib64/libdl.so.2 (0x0000003e30400000)
    	libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x0000003e32000000)
    	librt.so.1 => /lib64/librt.so.1 (0x0000003e31000000)
    	libXau.so.6 => /usr/lib64/libXau.so.6 (0x0000003e32400000)

    I've NEVER seen a glut app on any of my machines linking against "linux-vdso.so.1" or "libXxf86vm.so.1"... and that was from just compiling using "gcc main.cpp -lglut -lGLU".. there's a LOT of others there I don't recognize, or at least haven't seen there before..


    Quote Originally Posted by MaxH
    I just compiled this on a Windows platform and it worked fine. Got a white line. Is it possible that the red and green components in you glColor command are being ignored? If you try using (0,0,0.5) instead of (0,0,1), do you get a darker blue line?
    That does work, yes. Evidently the red and green are being discarded somehow...

    This HAS to be some sort of update related to SOMETHING. I can compile it via command line or Codeblocks and get the same result, and it works on Ubuntu and Windows as it should..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •