Results 1 to 3 of 3

Thread: newbie openGL question

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Location
    Manchester, UK
    Posts
    2

    newbie openGL question

    Hi there. Iím trying to get back to doing some openGL programming but have come across a rather annoying and confusing problem

    After I compile a program Iíve written (Borland bcc32 if thatís important) and try to run the .exe, I get a ' test1.exe has encountered a problem and needs to close. We are sorry for the inconvenience' error with windows asking if I want to send an error report (to whoÖ me?). I assumed it was my programming ineptitude so I tired opening a simple exe (just opens a blank window) and the same error pops up. I donít know what to do.

    Any help you guys could give would be great.

    Hereís the code. Itís as simple as I could make it to test that opengl works

    #include <windows.h>
    #include <GL/glut.h>
    #include <stdio.h>
    #include <stdlib.h>

    void init ( void ) {
    glEnable ( GL_DEPTH_TEST );
    glClearColor ( 0.0, 0.0, 0.0, 0.0 );
    }

    void display ( void ) {
    glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glutSwapBuffers ( );
    }

    void reshape(int w, int h) {
    glViewport ( 0, 0, w, h );
    glMatrixMode ( GL_PROJECTION );
    glLoadIdentity ( );
    if ( h==0 )
    gluPerspective ( 80, ( float ) w, 1.0, 5000.0 );
    else
    gluPerspective ( 80, ( float ) w / ( float ) h, 1.0, 5000.0 );
    glMatrixMode ( GL_MODELVIEW );
    glLoadIdentity ( );
    }

    void keyboard ( unsigned char key, int x, int y ) {
    switch ( key ) {
    case 27: /* Escape key */
    exit ( 0 );
    break;
    case 'f':
    glutFullScreen ( );
    break;
    case 'w':
    glutReshapeWindow ( 250,250 );
    break;
    default:
    break;
    }
    }

    int main ( int argc, char** argv ) {
    glutInit ( &argc, argv );
    glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE );
    glutInitWindowSize ( 250, 250 );
    glutCreateWindow ( argv[0] );
    init ( );
    glutReshapeFunc ( reshape );
    glutKeyboardFunc ( keyboard );
    glutDisplayFunc ( display );
    glutMainLoop ( );
    return 0;
    }

    Cheers.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2005
    Posts
    145

    Re: newbie openGL question

    I don't use borland, so I can't speculate on problem areas in your environment. But the code you posted shouldn't generate any runtime exceptions.

    It seems there are others that are having trouble with borland and opengl...
    http://www.gantless.com/borland.html

    P.S. You need to specify a depth buffer if you want to use the depth test (GLUT_DEPTH).

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2005
    Location
    Manchester, UK
    Posts
    2

    Re: newbie openGL question

    Thanks for that. Sorted it out myself yesterday. I stupidly put the *.dll's in c:\windows\system when they should have been in c:\windows\system32, so borland couldnt find them i guess.

Similar Threads

  1. newbie question about OpenGL
    By xargon in forum OpenCL
    Replies: 2
    Last Post: 05-15-2012, 03:49 AM
  2. Newbie question :Updating openGL?
    By mysockshurt in forum OpenGL: Windows
    Replies: 4
    Last Post: 05-06-2008, 04:08 PM
  3. Newbie question on OpenGL
    By in forum OpenGL: macOS
    Replies: 4
    Last Post: 07-10-2004, 07:40 PM
  4. newbie question on Mac OS X/OpenGL updates
    By G-Force in forum OpenGL: macOS
    Replies: 1
    Last Post: 03-19-2003, 02:51 PM
  5. Text in Opengl .. question from newbie
    By RBC9 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-08-2000, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean