glut

Attempt to call an undefined function glutInit

那年仲夏 提交于 2019-11-28 05:51:07
问题 I need a glut window in python. I have the following exception using Python 3.5 and PyOpenGL.GLUT Traceback (most recent call last): File "D:\...\Test.py", line 47, in <module> if __name__ == '__main__': main() File "D:\...\Test.py", line 9, in main glutInit(sys.argv) File "C:\...\OpenGL\GLUT\special.py", line 333, in glutInit _base_glutInit( ctypes.byref(count), holder ) File "C:\...\OpenGL\platform\baseplatform.py", line 407, in __call__ self.__name__, self.__name__, OpenGL.error

Getting smooth, big points in OpenGL

冷暖自知 提交于 2019-11-28 03:58:47
I started playing around with OpenGL and GLUT. I would like to draw some points, but the problem is that they turn out to be squares, and I would like them to be round dots (filled circles). This is what I do: void onInitialization( ) { glEnable( GL_POINT_SMOOTH ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glPointSize( 6.0 ); } void onDisplay() { glClearColor( 1.0f, 1.0f, 1.0f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glBegin( GL_POINTS ); glColor3f( 0.95f, 0.207, 0.031f ); for ( int i = 0; i < g_numPoints; ++i ) { glVertex2f( g_points[i].X

How to pass a class method as an argument for another function in C++ and openGL?

删除回忆录丶 提交于 2019-11-28 03:03:25
问题 I know this thing works: void myDisplay() { ... } int main() { ... glutDisplayFunc(myDisplay) ... } so I tried to include myDisplay() function to a class that I made. Because I want to overload it in the future with a different class. However, the compiler complains that argument of type 'void (ClassBlah::)()' does not match 'void(*)()' . Here is the what I try to make: class ClassBlah { .... void myDisplay() .... } ...... int main() { ... ClassBlah blah glutDisplayFunc(blah.myDisplay) ... }

How to create a class to wrap GLUT?

﹥>﹥吖頭↗ 提交于 2019-11-28 02:07:55
I'm writing a game for school in OpenGL. Since there will be several more similar assignments I want to make a small framework for doing common things in OpenGL. I have made a few simple games before and I usually break it down into an IO class to handle input and drawing to the screen, Game class for the main game loop/logic, and classes for whatever objects there are in the game. Before I was using SDL, so my question is, is this the right way of going about this in OpenGL? I've already ran into some trouble. I want my IO class to handle initializing the window, drawing the scene, and mouse

How to update glut window continuously?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 23:58:17
问题 I have a real robot that is ordering my virtual robot in open gl. I want show every movement of my master robot(real robot) in slave (virtual one in open gl) online, so i need to update my glut window continuously, actually as long as real robot moves my virtual one moves too, and all these movement should be online. I get data from master always with get data function, but I dont know how I should update the window. Here is my code: * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * **

Using GLUT bitmap fonts

白昼怎懂夜的黑 提交于 2019-11-27 20:36:20
I'm writing a simple OpenGL application that uses GLUT . I don't want to roll my own font rendering code, instead I want to use the simple bitmap fonts that ship with GLUT . What are the steps to get them working? Simple text display is easy to do in OpenGL using GLUT bitmap fonts. These are simple 2D fonts and are not suitable for display inside your 3D environment. However, they're perfect for text that needs to be overlayed on the display window. Here are the sample steps to display Eric Cartman's favorite quote colored in green on a GLUT window: We'll be setting the raster position in

Segmentation Fault before main() when using glut, and std::string?

三世轮回 提交于 2019-11-27 20:35:58
On 64-bit Ubuntu 14.04 LTS, I am trying to compile a simple OpenGL program that uses glut. I am getting a Segmentation Fault (SIGSEV) before any line of code is executed in main; even on a very stripped down test program. What could cause this? My command line: g++ -Wall -g main.cpp -lglut -lGL -lGLU -o main My simple test case: #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <string> #include <cstdio> int main(int argc, char** argv){ printf("Started\n"); std::string dummy = "hello"; glutInit(&argc, argv); return 0; } When I run the program, the printf at the beginning of

Opengl drawing a 2d overlay on a 3d scene problem

拈花ヽ惹草 提交于 2019-11-27 19:54:37
I have a moving 3d scene set up, and I want to make a stationary 2d GUI overlay that is always on top, when I try making 2d shapes I don't see anything. When I call: glMatrixMode(GL_PROJECTION); my 3d scene disappears and I'm left with a blank window... here is the code I'm using for the overlay EDIT: updated code glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-100, 100, -100, 100); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glColor3f(1, 1, 1); glPushMatrix(); glBegin(GL_QUADS);

PyOpenGL glutInit NullFunctionError

浪尽此生 提交于 2019-11-27 19:25:35
I am running Anaconda Python 2.7 on a Win7 x64 machine and used pip install PyOpenGL PyOpenGL_accelerate at the Anaconda command line to install PyOpenGL. I have some code (not my own I must confess) that makes use of glutInit import sys import math import numpy import OpenGL from OpenGL.GL import * from OpenGL.GLUT import * import Image import linkage # ... a whole load of definitions etc ... glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) glutInitWindowSize(600, 600) glutCreateWindow('linkage') init() initWindow() glutIdleFunc(idle) glutMainLoop() I run by entering the

Scan-line fill OpenGL/GLUT algorithm in C++

倾然丶 夕夏残阳落幕 提交于 2019-11-27 18:37:52
问题 I am trying to learn the scan-line fill algorithm implemented in OpenGL/GLUT. I cannot wrap my mind around the concept. Could anybody explain to me the algorithm in a reasonably simple fashion? The algo is below: #include<GL/glut.h> float x1,x2,x3,x4,y1,y2,y3,y4; void draw_pixel(int x,int y) { glColor3f(0.0,1.0,1.0); glPointSize(1.0); glBegin(GL_POINTS); glVertex2i(x,y); glEnd(); } void edgedetect(float x1,float y1,float x2,float y2,int *le,int *re) { float temp,x,mx; int i; if(y1>y2) { temp