freeglut

Can't get Freeglut to work with Haskell on Windows

时光怂恿深爱的人放手 提交于 2019-12-01 21:23:43
Here is my source code I'm trying to get to work: In Main.hs: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Bindings import Data.IORef main = do (progname,_) <- getArgsAndInitialize createWindow "Hello World" reshapeCallback $= Just reshape keyboardMouseCallback $= Just keyboardMouse angle <- newIORef 0.0 displayCallback $= display idleCallback $= Just idle mouseWheelCallback $= Just mouseWheel mainLoop In Bindings.hs: module Bindings where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT display :: IO () display = return () overlayDisplay :: IO () overlayDisplay =

Where is the documentation for glutInitContextVersion?

余生长醉 提交于 2019-12-01 18:04:00
问题 The FreeGLUT API documentation does not include an entry for glutInitContextVersion and when I google for it, all I find are a list of questions which don't directly address its usage or effects. Is it documented anywhere? 回答1: glutInitContextVersion is not part of the official GLUT API (which is btw. completely outdated), but an unofficial extension added by freeglut. However, its usage is quite straight-forwadd as soon as one knows about how OpenGL's context versions work, which was defined

Linking against NuGet Libraries in Visual Studio 2013

佐手、 提交于 2019-12-01 17:51:20
问题 Hi: In Visual Studio 2012 Professional, Update 4, I can create a new OpenGL project pretty easily by creating a new Visual C++ project (using the blank template) and going into the NuGet Package Manager Console and typing: Install-Package freeglut Install-Package glew Install-Package glm To grab the libraries for freeglut, glew, and glm (a header-only math library.) I can then create a simple example utilizing these libraries: (full example) #include <GL/freeglut.h> #include <GL/glew.h>

FreeGLUT linking Issues in Linux

本秂侑毒 提交于 2019-12-01 04:31:33
I am running Linux Mint 14.1 64-bit I have installed the following libs: mesa-common-dev, freeglut3-dev, libglew-dev through the apt-get tool. Here are my includes, located in my Main.h file: #include <cmath> #include <cstdlib> #include <iostream> #include <stdio.h> #include <GL/glew.h> #include <GL/glut.h> #include <time.h> I checked that the libs installed correctly, they seem to be located in /usr/lib/x86_64-linux-gnu and the headers in /usr/include/GL I proceed to compile my Main.C file with the following flags: g++ -Wall -Wextra -Weffc++ -Winit-self -Wmissing-include-dirs -Wswitch-default

To pass a pointer to a member function

家住魔仙堡 提交于 2019-12-01 03:43:12
问题 I have an class with instance functions (or methods?). From within an instance, I try to pass pointers to those functions to a library. The library expects static functions. When I pass my pointers to the callback functions, the compiler complains that my functions are not static. I tried to put make them static, but if I do so, then I can't access the instance fields from within the functions. How could I go around this? Similar question is : Using a C++ class member function as a C callback

FreeGLUT linking Issues in Linux

邮差的信 提交于 2019-12-01 02:25:43
问题 I am running Linux Mint 14.1 64-bit I have installed the following libs: mesa-common-dev, freeglut3-dev, libglew-dev through the apt-get tool. Here are my includes, located in my Main.h file: #include <cmath> #include <cstdlib> #include <iostream> #include <stdio.h> #include <GL/glew.h> #include <GL/glut.h> #include <time.h> I checked that the libs installed correctly, they seem to be located in /usr/lib/x86_64-linux-gnu and the headers in /usr/include/GL I proceed to compile my Main.C file

What is the nicest way to close FreeGLUT?

Deadly 提交于 2019-11-30 12:17:32
I'm really having trouble closing my console application with FreeGLUT. I would like to know what the best way is to take every possible closing, because I don't want any memory leaks (I'm pretty afraid of those). So I already tried the following, which is giving me an exception like this: First-chance exception at 0x754e6a6f in myProject.exe: 0x40010005: Control-C. int main(int argc, char **argv) { if( SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, true) ) { // more code here as well .... glutCloseFunc(close); // set the window closing function of opengl glutMainLoop(); close(); //

gluPerspective was removed in OpenGL 3.1, any replacements?

浪子不回头ぞ 提交于 2019-11-29 20:26:36
I'm trying to read some OpenGL tutorials on the net. the problem is that I found some old ones that use gluPerspective() . gluPerspective was deprecated in OpenGL 3.0 and removed in 3.1. What function can I use instead? I'm using C++ with latest FreeGlut installed. Dan You have to compute the matrix manually and then pass it to OpenGL. Computing the matrix This snippet of code is based on the gluPerspective documentation . void BuildPerspProjMat(float *m, float fov, float aspect, float znear, float zfar) { float f = 1/tan(fov * PI_OVER_360); m[0] = f/aspect; m[1] = 0; m[2] = 0; m[3] = 0; m[4]

How can I make OpenGL draw something using VBOs in XCODE?

流过昼夜 提交于 2019-11-29 16:46:10
Good evening, Right now I'm trying to run the following code using Xcode, but it has been impossible so far. The code is a from a simple tutorial I found online, and the code is supposed to simply draw a triangle using OpenGL and VBOs. If I try the code using Visual Studio, I actually get the expected result with no problems at all. However, when I try to run the code using Xcode, I only get a black screen. To setup the project in Xcode, I installed GLEW and FreeGlut using MacPorts and then I installed XQuartz 2.7.5. Then I created a new project in xcode as a command line tool, and in the

How do I draw a rainbow in Freeglut?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 14:05:38
I'm trying to draw a rainbow-coloured plot legend in openGL. Here is what I've got so far: glBegin(GL_QUADS); for (int i = 0; i != legendElements; ++i) { GLfloat const cellColorIntensity = (GLfloat) i / (GLfloat) legendElements; OpenGL::pSetHSV(cellColorIntensity*360.0f, 1.0f, 1.0f); // draw the ith legend element GLdouble const xLeft = xBeginRight - legendWidth; GLdouble const xRight = xBeginRight; GLdouble const yBottom = (GLdouble)i * legendHeight / (GLdouble)legendElements + legendHeight; GLdouble const yTop = yBottom + legendHeight; glVertex2d(xLeft, yTop); // top-left glVertex2d(xRight,