Questions tagged [opengl]

OpenGL is a graphics standard and API which targets the desktop and workstation markets. It is designed to be easy to accelerate with dedicated computer hardware, and hence most implementations give greatly improved performance over traditional software rendering. Currently, OpenGL is used for applications like CAD software and computer games. It is also cross-platform. The OpenGL standard is controlled by the Khronos group, which also controls OpenGL ES.

Filter by
Sorted by
Tagged with
6
votes
1answer
686 views

Draw Edges in OpenGL

I use blender game engine and blender uses OpenGL for graphics. How can I draw lines around all 3D objects? Would this be a job for a filter? Mainly, I want my end result to look drawn. I found this: <...
2
votes
2answers
86 views

How to make player seem bigger / world smaller, without changing world coordinates

I am making a voxel game with OpenGl, I've got the major parts working, except the camera seems small compared to the the blocks. How do I make the camera bigger? Do I do a scaling on the model ...
0
votes
1answer
308 views

Opengl the light position always on the origin point therefore the diffuse and specular does not work

I am newbie of opengl, so I did the tutorial by learnopengl. I have a strange problem when I was trying to do the light effect (ambient, diffuse and specular). For the diffuse, the effect appears on ...
0
votes
1answer
226 views

making special blocks in a voxel game OpenGL

I'm making a voxel game and it looks quite good but then i thought of special blocks like minecrafts grass leaf blocks, and translucent water. I had the idea for the grass blocks to put them in a ...
1
vote
2answers
133 views

Getting Model View Matrix by hand

Right now I'm trying to calculate the model view matrix by hand... The App is 2D. I have something like this: ...
0
votes
1answer
33 views

OpenGL GLSL ES 3.10 - Referencing a uniform variable, causes the vertex shader to not draw anything

I have this project, that has a default shader, that just draws models and textures. Recently I decided to add a second shader that does a fancy effect, and is used only on some of the objects drawn. ...
0
votes
2answers
642 views

Switched from immediate mode to VBOs, game runs slower

I'm trying to improve the draw performance on my c++, OpenGL, SDL game. Back in school we ...
1
vote
0answers
38 views

What is the best way to bake my own environment maps?

My engine has support for IBL by using pre-obtained HDRIs. It looks fine, but... I want the environment map to match the scene that is currently being rendered I want the environment map to take the ...
0
votes
0answers
99 views

How to update vertices and indices in OpenGL

I want to change and update the vertices and indices of the 3D object. I am new to openGL and I do not know if this the right place to ask this question. I searched and read about that, and I found ...
1
vote
2answers
98 views
0
votes
1answer
111 views

glfw resizing causing image scaling

I have a quad rendered that extends from the top left of the window to with width of the window that is also 64 pixels high. When I resize the window, from its initial size, the quad and text scales ...
0
votes
0answers
74 views

How to implement PCSS properly?

I'm trying to implement PCSS in OpenGL/GLSL, but I have problems understanding the details especially the conversions between the coordinate spaces. The existing implementations are so different from ...
1
vote
1answer
91 views

How does glm::lookAt produce a View Matrix?

Say we do this: glm::mat4 View = glm::lookAt(glm::vec3(4,3,-3), glm::vec3(0,0,0),glm::vec3(0,1,0)); And after printing to the console with glm tostring (column ...
0
votes
1answer
92 views

How to position/transform vertices for 2D UI in shaders?

I am building a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have gl_Position output like: ...
2
votes
1answer
58 views

2D shadow from polar coordinates has hard cut-off at a certain radius

I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to ...
0
votes
1answer
174 views

Understanding how to use Quaternion to rotate object

I m having hard time to understand Quaternions and to use them in my engine for rotating object. I m looking for step by step explanation, actually a correction of my view of Quaternions. Here is how ...
0
votes
1answer
87 views

Attempt to fix sprite sheet pixel bleeding in OpenGL 2D causing sprite distortion

While working on a project, I encountered the common problem of pixel bleeding when trying to draw subregions of my sprite sheet. This caused sort of "seams" to appear at the edges of my ...
1
vote
1answer
168 views

What should the Z coordinate be after transformed by the projection matrix?

I'm working on an OpenGL 1.x implementation for the Sega Dreamcast. Because the Dreamcast didn't have any hardware T&L the entire vertex transformation pipeline has to be done in software. What ...
0
votes
0answers
26 views

Rendering overlapping normal map textures to a 2d scene efficiently

I am using modern OpenGL to render a 2D non grid/tiled world map. I've generated some simple normal map textures to render over the base world map to provide terrain elevation/detail shading. ...
0
votes
1answer
87 views

how to move a 2d shape in opengl 4.6 (glfw)

Class Button So from my understanding in order to move a 2d shape you need manipulate the vertices and then update???? If i do need to update the buffer how i would go by doing that? float xpos = 150 ...
0
votes
1answer
118 views

when to unbind vao in drawing loops

I am very new to open gl and am struggling to understand relation between vaos vbos and ibos like how is currently bound vao related to currently bound ibo? now i am trying to render 4 triangles with ...
0
votes
0answers
10 views

using glew glviewport cannot get the correct proportion of a window

the generated window resolution is (1334, 750) when i call glViewport(0, 0, 1334, 750); the whole window is filled, but when i ...
0
votes
1answer
35 views

set model to transparent where texture is transparent

I finally got around to applying textures to my game, and I noticed that the areas that are transparent on the .png of the texture are not transparent on the actual model.It is illustrated in the ...
0
votes
1answer
211 views

Graphic render speed in libgdx using many sprite sheets

I am currently working on a customizable Player-character for my top down view 2D pixel game. I am using libgdx and aiming for android devices as well as desktop applications. I am wondering about an ...
1
vote
1answer
281 views

How can I render a font in C with OpenGL?

What I tried: I was testing some things in order to render text with stb_truetype.h and OpenGL in C. I took as a reference the example that appears here. Basically, this example, loads a .ttf file and ...
3
votes
2answers
807 views

glUniformMatrix4fv OpenTK equivalent

Very simple and quick question which surprisingly I couldn't find an answer to over the internet: what is the equivalent of glUniformMatrixfv for opentk? I've browsed all the 7 overloads of GL....
2
votes
2answers
8k views

Calculating vertex normals in OpenGL C++

Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this: ...
0
votes
0answers
46 views

How do I make the 3rd person camera follow the space ship in my Space Shooter game?

https://youtu.be/13HgaeZWlIA I am making a 3D space shooter game using OpenGL and Bullet Physics. I am having a hard time with the 3rd person Camera though. If you take a look at the video above you ...
0
votes
0answers
58 views

Speeding up map rendering

My map loading and rendering process is slow when using very large maps, so I'm looking for ways to make it more efficient. My current solution works like this: My map loader uses for loops for ...
0
votes
2answers
53 views

What rotation needs to be applied to align mesh with expected axis of target?

I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus. I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to ...
0
votes
0answers
22 views

Having problems with making a button class (checkIfClick) opengl

Just basing how sfml does it, I get the globalbound of the object and then check if the mouseposition is within the object. I ...
0
votes
1answer
57 views

Get black bars with framebuffer and glViewport

I have read several tutorials and answers regarding framebuffers and glViewport, but I can't seem to resolve this issue I have. I want to take a low resolution framebuffer (400x225) and place it in a ...
0
votes
0answers
37 views

Having trouble with 2d projection (Opengl)

I need to change the normalize coords from -1 to 1 to the width and height of my application. The reason why I want to change the normalize coords is because i think it would be a easier set position ...
4
votes
3answers
672 views

What resources are available to read and share pyglet code? [closed]

I am a Python programmer (I know the ins and outs decently well), and I have dabbled with Pygame. I want to make 3D applications and games, and so naturally I've been looking at OpenGL. pyglet uses ...
12
votes
1answer
2k views

OpenGL - white edges on cubes

In a minecraft-like game I'm making, I get white edges on my cubes: It is much more noticeable in darker textures. The textures are being setup like this: ...
0
votes
1answer
215 views

Animate some tiles of tile map

I have a game where each "tile" of the terrain is a triangle (Settlers 2). Those are placed next to each other and in way creating an infinite world (right/bottom jumps back to left/top). There is a ...
0
votes
1answer
213 views

How to update indices for dynamic mesh in OpenGL?

So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using <...
8
votes
4answers
29k views

How to draw 2D images using OpenGL, in SDL?

After everything, I managed to find a simple piece of code that shows how to draw a 2D image with openGL: ...
0
votes
1answer
45 views

Memory Usage Issue with declared variables (when swapping between states)

So my problem is that When I make a Shader variable and I swap between mainmenustate and gamestate really fast I notice my memory usage increase alot but as soon I switch my Shader varaible into a ...
1
vote
3answers
4k views

What does a perspective projection matrix look like in OpenGL?

I've been trying to construct a perspective projection matrix myself and finding it extremely difficult. I realize that a perspective projection matrix is by default a frustum in OpenGL 3.3+ that is ...
1
vote
0answers
513 views

How to change mac opengl version back to mesa

A while ago I wanted to use the functionality of opengl 4.5+ on my mac, so I installed mesa with macports, and it worked. Recently, however, I tried to use my code again and it said that these ...
-1
votes
1answer
99 views

What is the best way to approach a multi pass rendering system?

I am trying to code a new feature in my engine but I can't find a way to implement my idea, which is the next one. I am trying to get multi pass rendering with more than two passes. I know how to do a ...
0
votes
0answers
48 views

Problem with bullet movement

I'm trying to draw "bullets" in my game, but I think something is wrong with velocity computation. Sometimes the "bullets" are going in the right way, but sometimes they won't. The ...
0
votes
2answers
3k views

Using an array of 3d points to construct point cloud or surface in OpenGL

I have an array of 3 dimensional point objects, I can manipulate the input into this array into any configuration I want, for example, it could be a vector of floating point numbers, a vector of ints, ...
4
votes
2answers
6k views

Where and how to smooth a voxel-based terrain surface?

I want to smooth the blocky terrain in a Minecraft-like world. The smoothing affects visual appearance and physics but not the logic of placing and picking blocks. I have my mathematical formula to ...
0
votes
1answer
763 views

How to render in a imGui Window

I am learning OpenGL by glfw3 lib and I am using imgui to make a interesting application. However, I can not render what I want in a imgui window. I searched google and get below link: Render in a ...
0
votes
0answers
36 views

Parsing OBJ file having multiple objects

I am very new to game development and have been following the youtube channel ThinMatrix for its GameEngine tutorials https://www.youtube.com/playlist?list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP In one of ...
0
votes
0answers
31 views

camera relative movement with GL.Translate

I'm using the OpenTK library, an OpenGL library, for C#. I'm trying to do camera-relative movement and though I'd use GL.Translate for moving and ...
0
votes
0answers
17 views

reflecting objects by rendering them to the cubemap

I have 2 sphere objects and it isn't reflecting the other one. The picture is when it simply reflects the cube map but when I try to render to the cube map the spheres turn out black. In camera class: ...

1 2
3
4 5
82