Questions tagged [glut]
The [Open]GL Utility Toolkit (GLUT) is a utility library for OpenGL applications to put the platform-dependent details (e.g. creating windows and responding to mouse events and key presses) under one hood, in an easy and portable way.
2,192
questions
-2
votes
0
answers
23
views
Need your help making a digital kaleidoscope using OpenGL [closed]
Can someone help me make something similar to "cool kaleidoscope OpenGL screensaver"?
-1
votes
0
answers
54
views
Render function not updating values
I am trying to write a simple player controller.
The problem is that when I press "w" playerY increases as expected but the location of the square does not change.
The whole code that I have ...
0
votes
1
answer
39
views
Animate bouncing box using?
I need to make an animation where the box starts from (-15, 0) then going up to (-8, 15) and when it reach that, then it came down. and so on, just like a DVD screen saver, but i can't seem to find ...
0
votes
1
answer
48
views
pyopengl How to render text
I use this function to render text, but the first parameter will report an error. I don't know how to use it
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, "text to render")
ctypes....
-1
votes
1
answer
39
views
bject disappearing while rotating in openGL
I have this weird problem in which the object that I'm trying to rotate just suddenly disappears. The way I am looking to rotate the object is with a keypress, which turns a global variable ...
1
vote
1
answer
56
views
Texture does not appear in OpenGl [closed]
main Function:
int main(int argc, char* argv[])
{
_mesh1 = new Mesh("obj\\Earth_2K.obj", "obj\\Diffuse_2K_Earth.png");
_mesh2 = new Mesh("obj\\Moon 2K.obj", "...
0
votes
1
answer
38
views
Problems with obj not moving properly in OpenGl
In this way, outputting one obj file each works well.
But if I try to represent these two objs revolving around the center sun at the same time, I get an error.
It looks like it's working well at ...
0
votes
0
answers
29
views
create a simple motion in glut project
So I've got a project in OpenGl and due to my lack of knowledge of GLUT and OpenGl concepts and difficulty of finding specific articles or someone with the wisdom of this concepts I was unable to make ...
1
vote
1
answer
38
views
opengl glut rotation keyboard directions
i wanna make a small app that allow me to move the triangle to top/bottm left/right.
and when i press w -> rotate above and move above , s => rotate bottom and move bottom ,, d -> rotate ...
0
votes
1
answer
40
views
Not able to to move two objects in opposite directions simultaneously in openGl
I am trying to make a project where we can move one tank in one direction ,other in the opposite direction by using translatef function I am able to move tank 1 ,when I try moving tank2 both the tanks ...
-1
votes
1
answer
36
views
While using Vertex/Fragment Shader, using glRotatef, glPushMatrix... Problem
I programmed Vertex Shader, Fragment Shader.
I want to use glPushMatrix/glPopMatrix, glRotatef/glTranslatef... But, It's not working.
i make 'class' with Coordinates, Color, Indices.
and I try to draw ...
0
votes
0
answers
48
views
Translate a 3d pyramid on openGl?
I have this code right here which makes a pyramid 3d. Also it displays a scale and rotation on x,y,z. My main problem is the translation, like it walking in y from -180 to 180 coordinates and doing ...
0
votes
0
answers
19
views
GLUT window refreshes on mouse click, resize, ect
#include <GL/glut.h>
#define rows 1200
#define cols 600
void display()
{
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColor3ub(255,0,255);
glBegin(...
1
vote
1
answer
37
views
Not able to draw a rectangle in openGl
I am trying to draw a sqaure . I have given the co ordinates rightly. But I am
not getting a sqaure but a 5 sided polygon as shown in this figure.
I have given the following vertices
glVertex2f(-249,...
1
vote
1
answer
66
views
How to clear my BezierCurve vector to stop writing coordinates on top of each other?
I have built a Bezier Curve tool and each time the coordinates for each curve segment are calculated they are stored in a vector. Every single frame I am adding the entire curve's points on it over ...
1
vote
0
answers
11
views
Trouble compiling freeglut on Linux with g++ [duplicate]
I’m using Linux Mint 20.1. I have installed freeglut3 and freeglut3-dev and I’m trying to compile code which uses freeglut. I’m compiling like this:
g++ -lGL -lGLU -lglut main.cpp -o out
I’m ...
-1
votes
1
answer
41
views
GLUT program crashes without any exception
I'm learning GLSL and trying write my own Ray Tracing shader. I'm using Python with PyOpenGL + GLUT. This is perfect works usually, but when I increase amount of rays to be trace program crashes on ...
-1
votes
1
answer
37
views
glutPostRedisplay() causing extreme lag when drawing in GLUT
I am using GLUT to draw a sequence of lines and my glutPassiveMotionFunc(passiveMotion); (no button press mouse motion) draws a line from the end of the line sequence to wherever the cursor is. This ...
0
votes
0
answers
39
views
rotate the camera around an object in spherical coordinates glulookat
so i'm trying to rotate the camera around a cube object , using the keyboard arrows to change the y angle and the x angle , i want a result like this : this video
Well now I want to move the camera in ...
0
votes
0
answers
28
views
C language, cannot find -lglut32 [duplicate]
I am trying to run this code:
#include <GL/gl.h>
#include <GL/glut.h>
But I got error:
ld.exe||cannot find -lglut32|
I am using Windows 10.
I am using codeblocks 20.03.
I tried ...
-1
votes
1
answer
72
views
How do i hide the bug image once its hit by a bullet in opengl and c++
I am working on defender/space invaders game.
I have drawn bug sprite and a bullet sprite. I shoot at the bug with a bullet but when the bullet hits the bug it draws a collision sprite which stays on ...
0
votes
1
answer
40
views
OpenGL black screen(GL_PERSPECTIVE, GL_MODELVIEW problem)
I'm trying to move the perspective view, so I can see that the sun, earth, and moon is moving around on a screen.
I'm keep searching and trying to fix this but there's nothing on a screen.
I really ...
-2
votes
1
answer
54
views
How do I fix my current openGL error, my cmakelist may be my issue [closed]
I have included the library <GLUT/glut.h> and all my syntax is correct, yet I am receiving this error.
Undefined symbols for architecture arm64:
"_glBegin", referenced from:
...
1
vote
1
answer
26
views
Line Not Showing
I have written this code for displaying the line segment but I am not able to understand why the line is not getting displayed. Can someone please help?
#include<GL/glut.h>
#include<iostream&...
0
votes
0
answers
22
views
Detect keyboard key holds/releases with GLUT? [duplicate]
How do I detect if a key is being held down, and when the key is released?
if(key=='w') {does stuff;}
if(key != 'w') {does stuff;}
Currently the second if only activates if I press a key other than ...
2
votes
1
answer
37
views
Visual Studio Express 2017 Output not displaying for stroke text function
I've been trying to run this program in visual studio express 2017. Using opengl.
I found the rendering code and stroke code in a pdf and was trying it out but first it showed many errors, once taken ...
0
votes
0
answers
60
views
Rotation in X axis for object OpenGL
I need help for X axis rotation of this object.
Currently if I press the mouse left/right button, then it will rotate only y axis. 1st
2nd
3rd
4th & so on... I am currently using Codeblockson ...
0
votes
1
answer
70
views
Drawing line with mouse movement
I'm trying to make OpenGL to draw the line. When I click the left button of my mouse, it will get the first coordinate. Then when I move my mouse, the second coordinate is the coordinates of my ...
0
votes
1
answer
16
views
GLut in C - Collision isn't working all the time
I'm currently working on a side scroller, my player can shoot, as do the enemies. If I hit an enemy,it should disappear. Unfortunately, it doesn't work all the time. Sometime it does, sometime not. ...
2
votes
1
answer
83
views
OpenGL draw transparent sphere over solid sphere
I have a small sphere with an Earth texture and I want to have a slightly bigger sphere with clouds texture over it, that is transparent.
I draw my objects like this.
glClear(GL_COLOR_BUFFER_BIT | ...
0
votes
0
answers
33
views
Loaded textures are only black and white
I'm using CImg to load images that I then use as textures in openGL. I've tried different image formats (tiff, jpg, bmp) and they all only display as black and white textures.
This is how I generate ...
0
votes
0
answers
21
views
Running a C++ method on GPU using GLUT
I am new to C++ and would like to run a few basic hashing functions on my GPU using GLUT. Now I have my function ready but due to the lack of tutorials online I cannot figure out how I could run my ...
0
votes
0
answers
48
views
How to resolve GLUT error message "Unable to load font: ..." (macOS)
I am trying to run a toolkit (shoelaces, link here) on macOS. I have installed it, but when I run the command
shoelaces
to start the program, I get the error message
Unable to load font: ...
0
votes
0
answers
38
views
vector subscript out of range error in c++ opengl
I am trying to draw a red translated square.
I have to translate four points(literally points of square) of vector points(vector<vec4> points) by using for loop.
But it doesn't work and there's ...
0
votes
0
answers
76
views
Glut/OpenGL always renders black window
I am changing the window background color using the Glut library, which isn't working. The code works perfectly on my peer's computers but not on mine. I am using Visual Studio on Windows 10, with ...
1
vote
1
answer
54
views
How to use Vertex Array Object?
I am trying to simulate a cube bouncing between walls. For this purpose, I have constructed 2 vertex array objects, one of them representing the cube and the other representing walls. Firstly, I ...
0
votes
1
answer
42
views
OpenGL Alpha Channel not affective
Trying to make objects that fade over time in openGL.
I am doing this by decreasing the value of the Alpha in the color I am using to draw the object. But this does not seem to have any effect on the ...
0
votes
0
answers
43
views
How do I move a polygon's vertices in the direction of the front face based on its present rotation?
I want the user to have the ability to use the arrow keys to manipulate the polygon. The top arrow key is supposed to move all of the vertices in the direction of the top face.
The left arrow key does ...
0
votes
0
answers
79
views
Generate an object on mouse click OpenGL GLUT
I have created this code where a plane follow the mouse position.
#include <GL/freeglut_std.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>
float objX = 100;
...
1
vote
1
answer
194
views
GLUT not drawing shapes when ImGUI in use
I'm using Windows 10, visual studio 2022.
Backends: imgui_impl_glut.cpp and imgui_impl_opengl3.cpp
For now, i'm simply trying to get freeGLUT and ImGUI to work together properly. The problem is that ...
0
votes
0
answers
25
views
Replicating 2.5d y-shearing in GLUT/FreeGLUT
I am using FreeGLUT to make a 3D engine for my future games, purely because it is easier to deal with than modern OpenGL, the intention is to be a simple engine that has similar features to the ...
0
votes
0
answers
36
views
OpenGL Sphere not showing
The screenshot below shows the desired result.
below is the actual result
I used the glutWireSphere API for drawing my sphere, however, it is not showing.
#include <GL/glut.h>
const int ...
0
votes
0
answers
28
views
OpenGL- glFrustum, glLoadIdentity and glLookAt Confusion
I am trying to achieve a perspective view for a rectangular plane in the X-Z axis like below.
The code below almost achieves that.
What am i doing wrong? I find the documentation to be lacking/...
0
votes
0
answers
53
views
How to change Camera Angle FreeGLUT
I drew a rectangle in the X-Z play of a 3D, XYZ, plane using the code below.
#include <GL/glut.h>
void drawPlane() {
GLfloat A[3] = { 0, 0, 0};
GLfloat B[3] = { 1, 0, 0};
GLfloat ...
0
votes
1
answer
84
views
Use of undeclared identifier 'glutBitmapString' in Xcode
I am using Xcode. I have already linked OpenGL.framework and GLUT.framework.
Here is my code btw
#ifdef __APPLE__
#define GL_SILENCE_DEPRECATION
#include <OpenGL/gl.h>
#include <GLUT/glut.h&...
0
votes
0
answers
150
views
opengl automatically move object for x times
My main loop is working fine, but the problem I'm encountering is when I click the "esc" button on my keyboard, the shape that I have should move to the right every 1 second for five times ...
-2
votes
1
answer
69
views
Malloc Issue : Double free or corruption (out) / Segmentation (core dumped) with Glut OpenGL
i am currently learning C++ and Glut / OPENGL.
(I don't have the choice I must use Glut even if it's old)
I keep getting errors like :
-Double free or corruption (out)
-Segmentation error (core ...
0
votes
1
answer
68
views
two triangles, line, and border in OpenGL
I'm quite confused on how I can make two triangles that are not beside each other (they have a gap between them) along with a line and a border. I have a code done already, but for some reason the ...
1
vote
1
answer
116
views
Can it be possible rendering multiple objects in one screen without creating shader in OpenGL?
My course teacher taught me how to draw a figure e.g. square, triangle, circle. He did it using glBegin and glEnd. But when I try to draw multiple object for example circle within a square, I can't. ...
0
votes
2
answers
88
views
Set color for a 3d Cone in OpenGL
I'm learning about OpenGL and I use C# for it.
I want to have a red cone and an opportunity to change its transparency.
This is what I do:
Gl.glColor4f(255, 0, 0, alpha);
Glut.glutSolidCone(cone....