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 ...
0
votes
1answer
37 views
Calculate distance from the centre to the edge of a cube in OpenGL
I'm trying to calculate the distance between a central point on a cube and anywhere on the surface of the cube, depending on the location of a second 3D point.
I have two vertices in 3D; Q and P. Q ...
0
votes
0answers
22 views
How to render many times the same mesh efficiently in WebGL without instancing?
I'm using WebGL and I want to render the same mesh many times at different locations. I know that there is the drawArrayInstanced and drawElementsInstanced in WebGL 2 but I think only Firefox supports ...
0
votes
1answer
18 views
Open_GL Camera somehow not centered
I setup my OpenGL viewport via
ViewPort( 0,0,WindowW, WindowH )
MatrixMode( Projection )
LoadIdentity()
MaxY = ClipNear * Tan(FieldOfView * 0.00872664626)
MaxX = MaxY * Ratio
...
0
votes
1answer
63 views
Apply shading to Solid Sphere? OpenGL C++
To Apply shading to an object. Let's say earth (which was textured using an image). So how to apply smooth shading to that? What are the steps I need to write? Using which functions? Thank you.
Code
...
0
votes
0answers
35 views
Rotate viewpoint or Earth? OpenGL C++
I'm making an animation of earth rotates around sun. I've made earth and sun objects and their revolve. But what I'm not being able to make is rotation of earth around sun using perspective projection....
0
votes
0answers
26 views
Use FFP and shaders with RTShader system
I'm using some materials that need translation of RTSS and some that has their own shaders.
Does RTShader system know to handle both FFP and shaders at the same time?
1
vote
0answers
36 views
Getting world coordinates from mouse position
I am drawing a 2D mesh imported from CAD. The mesh vertex coordinates are in feet from some arbitrary origin and Z is always 0. I am supplying the coordinates to my shader program and using projection ...
0
votes
1answer
40 views
OpenGL Textures not sitting right on model
I have been trying to get textures loading properly onto my models but to no avail. I'm using picopng to load my images.
Here is my code.
[Texture code]
std::vector<unsigned char> buffer, ...
0
votes
0answers
25 views
GLSL Texture 2D Array indexing does not work as ecpected
For some reason i can only ever get either the first or the last texture in my texture Array to render. But if i hardcode an index Value in the shader like texture(sampler, vec3(u, v, 2); i get the ...
2
votes
2answers
59 views
Why is OpenGL point (0,0) in bottom-left?
Most of computer graphics systems use screen's top-left corner as staring point, but OpenGL uses bottom-right, why?
0
votes
2answers
36 views
LibGDX: Max number of textures?
I've been developing a game targeted at android. I know not to think about program optimization until the project is finished, but I have to wonder how many textures most phones can handle safely ...
0
votes
1answer
56 views
Trying to abstract OpenGL model loading but can't draw triangle… (C++)
Recently, I have been trying to learn modern OpenGL and I think I've grasped it (or the basics, at the very least.) but I have been having issues trying to make a triangle display on the screen but it ...
0
votes
0answers
22 views
Can see triangles in translucent/transparent object OpenGL
I added a sphere to my scene in OpenGL and tried modifying the alpha values of its vertices in the fragment shader. However, the result is that I can now see through half the triangles on the object ...
-1
votes
1answer
64 views
Why bind only first attribute?
I'm create OpenGL renderer, but when I bind vertex attributes I can attribute only first attributes. Where I got error?
My code:
Mesh::Mesh(Shader &shader, int size, GLuint *indices) {
...
5
votes
1answer
74 views
Difference in glDrawArrays and glDrawElements
While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements.
I understand how they are used and sort of understand why they are different.
What I do not seem to understand ...
0
votes
1answer
36 views
Issue with tangents/bitangents generation for normal maps
I'm generating tangents and bitangents for a normal mapping effect and while using the same method as several tutorials, I get tangents that are not very continuous.
Here, we can see on the sphere ...
1
vote
1answer
124 views
Simplest way of skeletal animation in openGL
I am not interested in using easy libraries like assimp which will import collada files with ease to get skeleton animation done.
I wanna know what is the minimal requirement to get the animation ...
0
votes
1answer
30 views
Modifying UV's origin on shader (OpenGL)
Is there a way to change the UV's origin (bottom-left) on shader?
1
vote
1answer
85 views
How costly is an OpenGL draw call, and how do I optimise them?
How costly is a draw call in OpenGL?
What are the ways to reduce the number of draw calls? I have seen people using glMapBufferRange, but I can't figure out how it improves the performance.
How much ...
1
vote
2answers
26 views
Gldraw call asynchronous or not
When i call gldrawarrays with a large set of data will the function return only after drawing all the vertices or will it happen asynchronously b/w cpu and gpu?
Also how does vsync work. Aren't they ...
1
vote
1answer
48 views
OpenGL tesselation doesn't change geometry shape
I implemented tessellation control and evaluation shaders in OpenGL, but the effect it has on my terrain was not what I expected.
I expected that the low poly-count curves and shapes on the terrain ...
0
votes
1answer
42 views
Multithreading problem in openGL?
Let's say that I have two threads.
Both of them generates and binds to a vbo separately.
If I join and run these threads the behavior will be undefined obviously.
Because one may generate the vbo ...
1
vote
1answer
23 views
alpha test shader 'discard' operation not working - GLES2
I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6).
I think is not working at all cause I don't see any change with or without it.
Is there anything Im missing?
Any syntax error?
...
0
votes
1answer
27 views
How to draw textured tile map in opengl
I am trying to create a textured hexagonal tile map in opengl. I have the VBO and respective index buffer. Additionally I have a texture atlas for texturing individual tiles. I'm attempting to create ...
0
votes
0answers
15 views
Game Dev in Xcode, How do I make a bundle
So I'm making a 2d game as a school project using c++, openGL and GLFW.
My team only has MacBooks, so we're using Xcode which none of us have used before.
Later on down the road we'd like to be ...
0
votes
2answers
27 views
GL how to look at the center of the viewport
I'm using GLFW3 and OpenGL to visualize measurements from an IMU that I have. I've gotten the simple cube example working and I can rotate it successfully with quaternions that I've input.
However ...
0
votes
1answer
43 views
glUniformBlockBinding doesn't work
I try use uniform blocks in OpenGL, but doesn't work. First, see my vertex shader:
#version 400
uniform Buffer0
{
mat4 worldMatrix;
mat4 viewMatrix;
mat4 projectionMatrix;
};
in vec3 ...
0
votes
0answers
23 views
FFP Alpha Test shader - function decleration
I'm trying to use FFP_Alpha_Test RTSS from ogre on GLES2 platform.
I added the relevant files and built everything but got an error:
No matching function for call to 'FFP_Alpha_Test'
Fragment Program ...
1
vote
1answer
36 views
OpenGL Cubemap skybox edge issue
I implemented a skybox into my program using a tutorial, and using the provided 6 textures from that tutorial to make a cube map texture, my skybox looked fine. However, ever since then every other ...
0
votes
0answers
50 views
glTexImage2D not making texture
i'm loading an email into openGL with soil. I can print out the height I get from the soil function and the char array, but the texture just shows up as a beige colour.
GLuint texture;
glGenTextures(...
1
vote
1answer
76 views
how to make a fast fragment shader that converts intensity to saturation?
I have a simple fragment shader that looks like this:
#ifdef GL_ES
precision lowp float;
#endif
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform vec4 u_desiredColor;
uniform sampler2D ...
0
votes
0answers
18 views
OpenGL/Frustum Culling - Drawing part of a buffer in 1 call
Im learning OpenGL. I tested frustum culling for terrain (cells consisting of 2 triangles, 6 verts, xyz/normal/uv), worked fine, but every frame im recreating VBO / VAO to draw visible part of terrain ...
3
votes
1answer
122 views
Procedural Hatching
I know that it is possible to make a shader that uses procedural hatching instead of pre-designed tonal art maps. But is it possible to make that procedural hatching in the fragment shader? I would ...
0
votes
1answer
16 views
Aggregation of value in GLSL loop results in 0
I'm banging my head against a wall trying to understand why this code is giving me some reasonable results with some visible colors on parts of the screen...
#version 130
in vec2 vTex; // must match ...
1
vote
1answer
55 views
OpenGL diffuse texture mapping
I am working on a small game engine and having some troubles when figuring out how to properly map more complex textures to their meshes. I am loading models using the .OBJ format and as far as I can ...
0
votes
1answer
38 views
Deferred Shading and material ID
I am implementing a deferred rendering framework, and I wanted to allow programmers to write custom materials.
However, I did not find yet how to handle different materials.
For now, a material is ...
0
votes
1answer
32 views
OpenGL typedefs
How far up do I have to push openGLs typedefs?
If I have GLfloat everywhere in my code, I have to include openGL libraries pretty much everywhere. Should I use glm:tmat4x4 or will regular glm::mat4x4 ...
0
votes
1answer
50 views
SDL2 and OpenGL: flickering with double buffering, what am I doing wrong?
I'm currently fiddling with SDL2 and OpenGL to get an understanding on how they work and, moreover, how shaders are done and work.
Right now, I'm following this tutorial, using SDL instead of glfw; ...
0
votes
0answers
26 views
swapbuffer is slow, and even i don't use any render code
Even i delete all the main loop code, only use swapbuffer function the FPS didn't change any more。 there is my render code
for (int i = 0; i < 6; ++i)
{
glBindFramebuffer(GL_FRAMEBUFFER, ...
0
votes
1answer
51 views
Drawing the same object multiple times in OpenGL
I am writing little game on C++ using OpenGL. I have various number of enemies (say, from two to twenty) - they are identical objects, each one uses the same mesh which is animated (skinning is ...
0
votes
0answers
30 views
Implementing Phong Shader whith 8 lighting
Reference: Phong Shader
I want to use 8 lights (4 red, and 4 green) but my object always has no color . I want to get this result:
but my result is like this:
For frag code, I have:
#version 120
...
0
votes
1answer
31 views
Wierd behaviour upon limiting rotation on Y-axis
Okay, this is the code that works for a FPS camera, except it allows the player to flip it over by going under/over -/+90° rotation on Y-axis:
transformation->rotateObjectFromRight(glm::radians(...
0
votes
2answers
34 views
Difference in Shading Using Eye Space or Model Space Coordinates
While reading on shading, I came across a section in which the artist provides 2 different kinds of fragment shading:
Coloring using model space and eye space.
The result is as illustrated in the ...
-1
votes
1answer
49 views
Detect camera collision in OpenGL without using bounding box
Is there any way to detect collisions in OpenGL without using any kind of bounding box?
I have created a maze/labyrinth and I want to move the camera/player inside the maze, such that the movement of ...
0
votes
0answers
40 views
World-space position from logarithmic depth
After changing my current deferred renderer to use a logarithmic depth buffer I can not work out, for the life of me, how to reconstruct world-space depth from the depth buffer values.
When I had the ...
0
votes
0answers
32 views
Merging multiple vertices into one (OpenGL)
I have a class where it crates a cube, load a shader, and render it, but i would like to know, how do I create two cubes, with two different vertices, two different matrices, and then merge these ...
0
votes
0answers
34 views
OpenGL raycasting and Intersection with triangles issues
This is my previous question which has bothered me for a while and I still haven't figured out (also no-one answered), so I am posting again on a related-issue which I have been working on hoping to ...
0
votes
1answer
104 views
3D sphere generation
I have found a 3D sphere in a closed-source game engine that I really like the look of and would like to have something similar in my own 3D engine.
This is how the sphere looks like when it is ...
1
vote
1answer
67 views
Texture coordinates projection
I have some classic texture coordinates and as a normal behaviour they follow the mesh's transformations.
I am trying to use the same texture coordinates behaviour but without being affected by the ...
0
votes
1answer
40 views
How to remove fragment from VAO?
I have the OpenGL VAO object (~40K) to draw the 3D scene
glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 4, GL_UNSIGNED_BYTE, nullptr);
glBindVertexArray(0);
To add some data I can use ...