Questions tagged [opengl-compat]

This tag is for questions about the Compatibility profile of desktop OpenGL. Questions using fixed-function, immediate-mode rendering, texture environment fragment processing, and other features removed from core OpenGL in 3.2.

Related to drawing by glBegin/glEnd sequences, the fixed function matrix stack and Blinn-Phong per vertex (Gouraud) light model.

338 questions
3
votes
1 answer

how to get vertical rotation in 3D space with OpenGL?

I have a field of cubes created in OpenGL and I have walking around working as expected, and part of rotating the "camera" is working until I try to look up or down. I have a snippet of code that kind of works: if pressed[pygame.K_UP] or…
Astrocow
  • 75
  • 4
3
votes
1 answer

How to rotate a 2D line in PyOpenGL?

I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) …
3
votes
1 answer

Rotate object like a real wind turbine

#include #include #include "glut.h" void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(0.0, 400, 0.0, 300.0); } void drawTurbine() { // draw the tower glBegin(GL_LINES); …
Muddy
  • 382
  • 3
  • 14
3
votes
1 answer

ray intersection misses the target

I'm trying to pick a 3d point. I read various sites but my code doesn't work. on right mouse click: glGetFloatv(GL_MODELVIEW_MATRIX,mv_mat) glGetFloatv(GL_PROJECTION_MATRIX,p_mat) ip_mat = np.linalg.inv(mat4(p_mat)) # clip = array[ #…
walle
  • 59
  • 5
2
votes
2 answers

OpenGL: glColor3f() and glVertex3f() with shader

Can I use glColor3f(), glVertex3f() or other API functions with shader? I wrote a shader for draw a colorful cube and it works fine. My vertex shader and fragment shader look like this #vertext shader #version 330 core layout (location = 0) in vec3…
Josh Chiu
  • 832
  • 2
  • 7
  • 14
2
votes
1 answer

Drawing 3d and 2d in the same window not working correctly openGl

I am trying to draw some 3d ( a sun) and 2d (ground, cloud, ...) shapes in the same window, it actually worked! But the problem is when I when I run the program, it does not show smooth screen, it shows one shape then the other (while the first…
Azazil
  • 77
  • 6
2
votes
1 answer

how set light and materials to obtain an emerald object

When I set the material in opengl for an object (glutSolidSphere(2.,10.,8.);), let for example the emerald parameters: float[] mat_ambient ={ 0.0215f, 0.1745f, 0.0215f, 0.55f }; float[] mat_diffuse ={0.07568f, 0.61424f, 0.07568f, 0.55f }; float[]…
Nik
  • 123
  • 4
2
votes
2 answers

How to draw a 4 pointed star using glut openGL

I want to draw a 4pointed star using GLUT and openGL in C++. Here is my code glBegin(GL_TRIANGLE_FAN); glVertex3f(0.0f,6.0f,0.0f); glVertex3f(1.0f,4.0f,0.0f); glVertex3f(3.0f,3.0f,0.0f); glVertex3f(1.0f,2.0f,0.0f); …
shoccho
  • 45
  • 1
  • 7
2
votes
1 answer

OpenGL PyQt object not scaling

I have just translated my old glBegin and glEnd code into one using VBOs and VAOs. As framework, I am using Pyqt. I did managed to load a 3D object and to display it on the screen, but I can not scale it. I tried after glLoadIdentity in paintGL…
user14182222
2
votes
1 answer

I'm having a problem with movement in opengl 3D

I'm having a problem in OpenGL, when I press W, A, S, D everything works normal, but when I press space or shift it happens: The cube disappears before the end of the screen. Depending on the value of xrot and yrot another axis gets this…
CGCM
  • 35
  • 3
2
votes
1 answer

Tkinter frame with opengl

I am trying to draw a square with opengl using tkinter frame but the square didn't render. Here is my code: import tkinter as tk from opengl.gl import * from pyopengltk import OpenGLFrame class frame(OpenGLFrame): def initgl(self): …
2
votes
1 answer

Moving an auto rotating 3d polygons in OpenGL with C++

I'm trying to move these tow auto-rotating polygons to the Right-Left , Up-Down and Front-Back using these keys : for the pyramid its the keys ('a','w','s','d','+','-') for the cube its the keys ('←','↑','→','↓','PAGE UP','PAGE DOWN') the polygons…
MrXQ
  • 465
  • 8
  • 25
2
votes
2 answers

Moving 3d shapes with keyboard in OpenGL with C++

I'm trying to move the pyramid and cubic "separately" to front-back , up-down and right-left using arrows and page-up, page-down keys but I couldn't make it yet , none of the tow shape are moving my 2 questions are : how can i chose witch one of…
MrXQ
  • 465
  • 8
  • 25
2
votes
1 answer

How to use openGL draw the point?(c++)

I want to use openGL draw a Coordinate System,and the code has draw the x-axis and y-axis. However the origin point cannot be draw. How to solve the problem? I think the code is correct and search the resource in the internet. There are no solution…
2
votes
1 answer

Drawing a linestrip with opengl1 by looping through a linked list of vectors

i have previously asked a question about appending coordinates of clicks to a singly linked list, in order to loop through the linked list ,put vertices at the positions of the clicks and connect them The answer given solved my issues with overflow…
john
  • 89
  • 6
1 2
3
22 23