I cannot link GL Utility Toolkit (lack know-how), so I need a way using only gl/gl.h and windows.h to get keyboard input. Help please!

Recommended Answers

All 7 Replies

IF you writing on Windows API(Application Programming Interface) just use standart wnd proc.

Explain please...I am two or three steps above n00b in C++.
I don't know that stuff so well.

Wouldn't it be easier just to learn how to link glut?

That I would also like to do...I need to draw spheres for the game I'm working on...hell, I need a lot of glu stuff. How do you do that?

Here is a simpel programme with OpenGL graphics. It is for noobs.


 * (c) Copyright 1993, Silicon Graphics, Inc.
 *               1993, 1994 Microsoft Corporation
 * Please refer to OpenGL/readme.txt for additional information

 *  cube.c
 *  Draws a 3-D cube, viewed with perspective, stretched 
 *  along the y-axis.
//#include "glos.h"

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

void myinit(void);
void CALLBACK myReshape(GLsizei w, GLsizei h);
void CALLBACK display(void);

/*  Clear the screen.  Set the current color to white.
 *  Draw the wire frame cube.
void CALLBACK display (void)
    glColor3f (1.0, 1.0, 1.0);
    glLoadIdentity ();  /*  clear the matrix    */
    glTranslatef (0.0, 0.0, -5.0);  /*  viewing transformation  */
    glScalef (1.0, 2.0, 1.0);   /*  modeling transformation */
    auxWireCube(1.0);   /*  draw the cube   */

void myinit (void) {
    glShadeModel (GL_FLAT);


/*  Called when the window is first opened and whenever 
 *  the window is reconfigured (moved or resized).
void CALLBACK myReshape(GLsizei w, GLsizei h)
    glMatrixMode (GL_PROJECTION);   /*  prepare for and then  */ 
    glLoadIdentity ();  /*  define the projection  */
    glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);    /*  transformation  */
    glMatrixMode (GL_MODELVIEW);    /*  back to modelview matrix    */
    glViewport (0, 0, w, h);    /*  define the viewport */


/*  Main Loop
 *  Open window with initial window size, title bar, 
 *  RGBA display mode, and handle input events.
int main(int argc, char** argv)
    auxInitDisplayMode (AUX_SINGLE | AUX_RGB);
    auxInitPosition (0, 0, 500, 500);
    auxInitWindow ("Perspective 3-D Cube");
    myinit ();
    auxReshapeFunc (myReshape);

In this case you use

auxKeyFunc(int Key, AUXKEYPROC);
void Key_up(void) {

auxKeyFunc(AUX_UP, Key_up);

Um...my compiler (Bloodshed Dev-C++) doesn't like it. Can you give me just the specific lines of code to link a library (for example, glu.h or glut.h) so that I can use it?

Donwload Glaux Library from Inet. Do you use Windows Apllication Interface?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.