glut

order of functions in opengl

can somebody explain please, what exactly glutMainLoop does? and is the order of the functions in main important or not? int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitWindowSize(400, 300); glutInitWindowPosition(100, 100); glutInitDisplayMode(GLUT_RGB); glutCreateWindow("First Game"...

opengl: question about glutMainLoop()

can somebody explain how does glutMainLoop work? and second question, why glClearColor(0.0f, 0.0f, 1.0f, 1.0f); defined after glutDisplayFunc(RenderScene); cause firstly we call glClear(GL_COLOR_BUFFER_BIT); and only then define glClearColor(0.0f, 0.0f, 1.0f, 1.0f); int main(int argc, char* argv[]) { glutInit(&argc, argv); ...

background colour in opengl

I want to change background color of the window after pressing the button, but my program doesn't work, can somebody tell me why, thanks in advance int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(800, 600); glutInitWindowPosition(30...

Portable way to hide console window in GLUT application?

Hey, I'm creating a little GLUT application and need help with hiding/removing the console window. I am developing on windows and I already know of the various methods to hide the console window on a windows system, however is there no portable method of hiding it? Thanks... ...

freeGLUT keyboard input

I'm using GLUT (freeglut3) (via the Haskell GLUT bindings). import Graphics.UI.GLUT handleKBMouse :: KeyboardMouseCallback handleKBMouse key keyState mods mousePos = do print (key, keyState, mods, mousePos) main :: IO () main = do getArgsAndInitialize createWindow "testTitle" keyboardMouseCallback $= Just handleKBMous...

OpenGL pausing problems.

Hi, I have the following function that is used as the glutKeyboardFunc function parameter: void handleKeypress(unsigned char key, //The key that was pressed int x, int y) { //The current mouse coordinates switch (key) { case 27: //Escape key exit(0); //Exit the program } if (key ...

No keyboard input from GLUT while mouse is moving (In OS X)

So I just built an OpenGL application on a Mac for the first time. I'm using GLUT to get keyboard input. The trouble is, I've discovered that if I'm moving the mouse at the same time I push a button on the keyboard, my keyboard function doesn't get called! If I push a button when the mouse isn't moving, it gets called just fine. The same...

How to use GLUT/OpenGL to render to a file?

I have a program which simulates a physical system that changes over time. I want to, at predetermined intervals (say every 10 seconds) output a visualization of the state of the simulation to a file. I want to do it in such a way that it is easy to "turn the visualization off" and not output the visualization at all. I am looking at O...

Installing OpenGL/GLUT & running C program?

I'm new to OpenGL and GLUT and need help installing them and running hello.c (see below) in Visual C++ 2010 Express Edition. I'm using Windows XP and was reading on the OpenGL wiki that the OpenGL Library is already installed on my computer. As a result, I only downloaded GLUT for Win32 dll, lib and header file and extracted it. I hav...

OpenGL: retrieve raw vertex and index buffer from displayed objects in OpenGL

My apologies for the long code sample. Here is my sample code: #include <iostream> #include <cstdlib> #include <GL/glut.h> using namespace std; //#include "glutint.h" /* Rim, body, lid, and bottom data must be reflected in x and y; handle and spout data across the y axis only. */ static int patchdata[][16] = { /* rim */ {1...

openGL rotating with Lighting problem

I want to draw car in my world. but i have problem with lighting when my car rotate ,it seems light position change when car is rotating; but when i draw simple cube with glut function it work correctly. void mydisplay(){ glLoadIdentity() glDisable(GL_LIGHT0); glColorMaterial ( GL_FRONT_AND_BACK, GL_DIFFUSE) ; glColor3f(1.0,1.0,1.0); g...

OpenGL polygon z buffer problem

Here is a quick and dirty GLUT based C++ program for windows that draws two rectangles, blue and green on a flat red background. Pressing 'a' or 'z' makes them orbit along the X axis in either direction. My problem is that if I enable GL_DEPTH_TEST, it sometimes draws one rectangle, sometimes two or sometimes just the background but ne...

How to create static background image in OpenGL(GLUT) scene?

I create some scene, and i would like to display some static background image, which would not change from how and what I am doing with the scene. ...

How can i do perspective transformation in OpenGL?

If i have common style perspective transformation matrix like this / focus 0 cx \ | 0 focus cy | \ 0 0 1 / how can setup parameters for glFrustum or gluPerspective to get correct transformation for example: glFrustum ( -cx, screenWidth - cx, -cy, screenHeight - cy, focus, focus + 1000) gluLookAt( 0.0, 0.0, -...

OpenGL and GLUT uncomprehension

i'm completely don't understanding opengl+glut works.... PLEASE explain why he does that? =( I have simple code void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); ChessboardSurrogate.Draw(6,8,50, 0,0); // draw chessboard(6x8) in (0,0,0) edge per cell 50 glPopM...

Ruby, OpenGL, and multiple windows?

Is there a sane way to create and destroy multiple OpenGL windows in ruby-opengl? I have code that is working wonderfully using GLUT, that comes with the ruby-opengl package, but it seems to suffer from the (well known?) problem of GLUT not allowing you to trap the window close events without major hacking of the library. Some googling...

opengl programming on MSVS C++ express 2010 on Windows 7

Hi, I have tried all the solutions floating around the net that i could find.. but still no sucess in compiling a simple nehe tutorial on Windows 7 with MSVS C++ 2010 express edition. If anyone can give me clues on how to proceed i would be thankful. Thanks. Edit:errors ------ Build started: Project: Polyons, Configuration: Debug Wi...

Antialiasing an entire scene after resterization

I ran into an issue while compiling an openGl code. The thing is that i want to achieve full scene anti-aliasing and i don't know how. I turned on force-antialiasing from the Nvidia control-panel and that was what i really meant to gain. I do it now with GL_POLYGON_SMOOTH. Obviously it is not efficient and good-looking. Here are the ques...

Lighting inside of a sphere?

I have this question in mind: I need to make a scene that looks like a real sky. My first idea was to make a cube and texturize it. It wasn't that good looking. I came up with the idea of using a sphere. But I couldn't light it from inside. I've put the camera on the origin watching (0,0,-100). Ambient and specular light source also at t...

g++ linker: /usr/lib/libGL.so.1: could not read symbols: Invalid operation

Hello, I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a 32 bit system). When I'm trying to compile the file, I get the error message: g++ -L/usr/lib simple.cpp -lglut /usr/bin/ld: /tmp/ccoPczAo.o: undefined reference to symbol 'glEnd' /usr/bin/ld: note: 'glEnd' is defined in DSO //usr/lib/libGL.so.1 so try add...