glutMouseFunc(mouse);

Helllo…

I was checking this out:

http://www.zeuscmd.com/tutorials/glut/03-MouseInput.php

, and they start their mouseHandling-chapter
telling me to use this code

bool lbuttonDown = false;

bool init()
{
	return true;
}

void display()
{

}

And I think it just doesn’t make any sense:
Why should “display” be empty?
Why is this init thing return true always?

KR // OGforever

The answer is in the previous tutorials.

init returns a bool to indicate whether the init function succeeded or not, and an empty init function obviously can’t fail, so it returns true.

display is empty because nothing needs to be displayed.

Thanks…

Now I’m trying to make the program to react to a click on the right mousebutton. But nothing happens…Why?

KR// OG
</font><blockquote><font size=“1” face=“Verdana, Arial”>code:</font><hr /><pre style=“font-size:x-small; font-family: monospace;”>#include <stdio.h>
#include <stdlib.h>

#include <GL/gl.h>
#include <GL/glut.h>

#include “givengui.h”

using namespace std;
bool lbuttonDown = false;

bool init() ;
void mouse(int button, int state, int x, int y) ;

/******** Callbacks called by the GUI ********/
void primitiveMode(int primitive)
{
printf("Primitive %s selected
", primitive == LINE ? “line” : “circle”);
}

void antialias(int doAA)
{
printf("Anti-aliasing %s
", doAA ? “enabled” : “disabled”);
}

void clearScreen()
{
printf("Clear screen
");
}

void circleMode(int mode, int segments)
{
if(mode == MIDPOINT)
printf("Circle mode set to midpoint
");
else
printf("Circle mode set to polygon with %d segments
", segments);
}
/********* End GUI callbacks *********/

/********* GLUT callbacks **********/
void display()
{
/
Draw a grid on the screen */
int x, y, w, h;

w = glutGet(GLUT_WINDOW_WIDTH);
h = glutGet(GLUT_WINDOW_HEIGHT);

/* Clear the screen */
glClear(GL_COLOR_BUFFER_BIT);

/* Begin drawing points */
glBegin(GL_POINTS);
/* Set color to light grey */
glColor3f(0.7, 0.7, 0.7);
/* Loop over all points and set those that are on a multiple of five in
   either coordinate to grey, this will give a 5x5 grid */
for(x = 0; x &lt; w; x++)
    for(y = 0; y &lt; h; y++)
        if(x % 5 == 0

The code you posted is not complete.