glut

OpenGL key down and key up on CTRL key

I've found a lot of information about using GLUT to detect whether the control key is pressed using the GLUT_ACTIVE_CTRL macro. This macro only works, apparently, within a keyboard or mouse callback function. I need to know whether or not the control key is pressed at a point in my main loop, but GLUT_ACTIVE_CTRL doesn't seem to work in ...

Geometry -> OpenGL

Please help! =) I can't get the correct transformation in OpleGL. I have point3D - P(X,Y,Z), and projection matrix M, which equal to K*(R|T) where K - camera calibration matrix (R|T) - point (object) coordinate system transformation (R - rotation matrix, T - translation vector) As a result we have projected point as p = M*P I kno...

Overzealous method doing work without a call? C++ Glut initialization gone rogue

Hi everyone, rookie C++ programmer here still. I'm using VC++ VS2008 compiler and glut library. All working fine and up to date ( I know there's 2010 just cba because of XNA (C#) support reasons) Ok this time I have a question that is code related but I can make the code work. What I can not do is figure out what is happening under th...

How can i perform back projection in OpenGL?

How can i perform backprojection in OpenGL? Or how translate back projection model to forward projection model? ...

How to detect command key as a modifier in a glut program running on a mac?

I am developing a GLUT program on a mac. Mac's seem to pass modifiers through GLUT in a funny way. Alt and control keys are not captured by glutGetModifiers() instead they're translated into the button int. The command key doesn't seem to be captured by either glutGetModifiers() or the button int. Also, it doesn't show up as a key in my ...

Trapping the mouse?

I'm using GLUT and developing a FPS game. I need a way to trap the mouse so that the camera continues to move because right now when the mouse position exceeds the monitor limit, there is no way to calculate change in X or change in Y. How can I 'trap' the mouse with GLUT? Thanks ...

Creating window using glut, but program is inconsistent.

I'm just trying to make a program that displays a window with a box in it, but when I run the program I only get the window display maybe once out of 5 runs. Every time I execute the command line gives appropriate responses and i see the window's title on the gnome panel at the bottom of the screen, but the window itself is invisible mos...

Inaccurate Mouse Coordinates Returned

The issue is that the further the mouse click is from the top left origin (0,0) the greater the height inaccuracy when the vertex is plotted. Any ideas? int WindowWidth = 19; int WindowHeight = 13; int mouseClickCount = 0; int rectPlotted; GLint x1; GLint y1; GLint x2; GLint y2; //Declare our functions with prototypes: void display(voi...

Is it possible to make a window withouth a top in GLUT?

When you make a window in glut using glutCreateWindow it puts a top to the window? What if I want to do some OpenGL rendering without a window top? This probably doesn't make much sense without a picture: Essentially I want to remove this from the window. ...

potential bug openGL

I am attempting to tile an image on the screen using menus. My menu works-tiling in the appropriate way-properly until I move my mouse then the tiling design disappears? #include <GL/glut.h> #include <fstream> #include <cstdlib> #include "TUGL.h" #include <glui.h> //Global variables class GLintPoint { public: GLint x; ...

How to use OpenGL and GLUT in Cygwin

I've attempted to follow the instructions from various places [1][2][3], but I keep getting link errors when attempting to use GLUT and OpenGL in Cygwin. Everything I try gives me a link error similar to: $g++ -Wall -pedantic -c -o triangle.o triangle.cpp $g++ -o triangle *.o -lglut32 -lglu32 -lopengl32 -o triangle triangle.o:triangle....

OpenGl surface&texture

I have: 3d pointset, wich calculated from 3d reconstruction process from N frame. sample frame snapthot (for example first frame when camera in (0,0,0)) 3d to 2d corresponds I want: create triangulation of point set and put texture (frame snaphot) on it. How can i create this triangulation + texture via OpenGL? I can't find any g...

setting up opengl and glut on windows 7

I am new in opengl and glut. i have cygwin and netbeans installed on my computer working compatibly. I want to set up opengl and glur and bind those to my c/c++ projects in Netbeans? However, I couldn't find a way how to set up opengl and glut on w7. Any help ? ...

understanding this opengl code

I'm a Java programmer, learning opengl in C for the first time. I wanna dissect this simple code that my instructor gave me without much explanation: void renderScene (void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glVertex3f(-0.5,-0.5,0.0); glVertex3f(0.5,0.0,0.0); glVertex3f(0.0,0.5,0.0); ...

What's #pragma comment (lib, "lib/glut32.lib")?

I saw the code on the top of a GLUT demo and I'm curious about its functionality. Why would someone want to write a #pragma instead of just including the library? ...

How to store OpenGL Primitives in a tree data structure in C++ ?

I'm new to OpenGL and C++. Say I start with a 2D square (on the very left) like shown in the picture below. I want to make it interactive with the glutKeyboardFunc() so when I press a number a new box will draw next to the corresponding edge. Figure the best way to do this is to have a tree structure that hold all the boxes. But I'm n...

opengl off screen rendering

Hi, I am using off screen rendering using opengl FBO and glut on a MAC OS X 10.6. The program involves movement of multiple 3D objects. The program seems to be working fine except that I am required to include an option where the off screen buffer contents are not swapped to the on screen buffer. Hence you do not see anything on the sc...

Getting a Virtual Trackball to work from any viewing angle.

Hi, I am currently trying to work on getting my virtual trackball to work from any angle. When I am looking at it from the z axis, it seems to work fine. I hold my mouse down, and move the mouse up... the rotation will move accordingly. Now, if I change my viewing angle / position of my camera and try to move my mouse. The rotation will...

Resizing glut window

I'm doing 2D drawing in a glut window, and I'm having trouble making the window resize properly. My glutDisplayFunc and glutReshapeFunc are below. As it is, the drawing disappears when the window is resized. If I delete the glClear() from displayFunc(), new pixels don't "initialize" and there are clipping problems. How do I fix this?...

gl calls end in EXC_BAC_ACCESS - bad opengl context?

Hi I have the following program void allocVars(){ m_window = new GLWindow(); //glGenTexture() is called //CRASH! m_window->Init(m_cam.w, m_cam.h, "Window Name"); } void glInit() { glutReshapeFunc(reshape); glutIdleFunc(idle); glutKeyboardFunc(keyboard); glutMouseFunc(mouse); glutDisplayFunc(display); ...