0

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!

3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by zhelih
0

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

0

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

0

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?

0

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

/*

 * (c) Copyright 1993, Silicon Graphics, Inc.
 *               1993, 1994 Microsoft Corporation
 *
 * ALL RIGHTS RESERVED
 *
 * 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)
{
    glClear(GL_COLOR_BUFFER_BIT);
    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   */
    glFlush();
}

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);
    auxMainLoop(display);
    return(0);
}

In this case you use

auxKeyFunc(int Key, AUXKEYPROC);
/*e.g.*/
void Key_up(void) {
//TODO

}
auxKeyFunc(AUX_UP, Key_up);
0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.