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 ...

learn more… | top users | synonyms

1
vote
1answer
160 views

What should I do when a VBO becomes too large in OpenGL?

Currently I have one buffer for my vertex data and one buffer for normals data. I fill them and then pass them to OpenGL for rendering. The problem is when I load too large mesh file like "Lucy" from ...
1
vote
1answer
100 views

Given face normal and vertices of a triangle, how to find the acyclic order of vertices?

I'm in the process of constructing a custom 3D triangle mesh. I found the vertices of the triangle in the 3D space and it's face normal. How do I find the acyclic order of vertices? If I draw the ...
1
vote
1answer
498 views

How can I calculate a terrain's normals?

Im trying to implement basic lighting in Opengl 3+ (a sun) with this tutorial : http://www.mbsoftworks.sk/index.php?page=tutorials&series=1&tutorial=11 Im building a basic terrain and its ...
1
vote
1answer
130 views

opengl offscreen rendering in linux is slow [duplicate]

My opengl application runs at about 110 fps. The moment I add off-screen rendering, it slows down to 15 fps. I am using frame buffer objects and glReadPixels to render off-screen. I have searched on ...
1
vote
1answer
142 views

Anisotropic filtering on gbuffer textures for shading pass?

I have a OpenGL 3.3 deferred shader. For my geometry pass I have diffuse textures and/or normal map textures from my models and here I use max anisotropic filtering. But in my shading pass, where the ...
1
vote
1answer
294 views

lighting for landscape

I've got a landscape(created in Photoshop .raw file) and a .tga texture for it. I read .raw file and read .tga file like this LoadRawFile("landscape.Raw", MapSize * MapSize, &HeightMap[0][0]); ...
1
vote
2answers
484 views

How can I create a VBO when I don't yet know how many vertices it will contain?

I'm trying to convert my 3D block work rendering from immediate mode and display lists to VBOs. I'm having trouble understanding how to properly handle creating the buffers: I really don't know how ...
1
vote
2answers
235 views

Why swapping buffers takes different amounts of time?

When my program starts, almost nothing is on screen, just couple of lights and spheres. My FPS is at ~50. The Speed measurements looks like this: UpdateFrame took 0 ms Clearing lights queue: 0 ms ...
1
vote
1answer
141 views

SFML image extension for best performance

I am using SFML library in my 2D game. The Texture Class has a method to load an image from file: Texture.loadFromFile("image.*") Which file extension should I use to achieve best performance? ...
1
vote
1answer
115 views

What is w componet [duplicate]

What is the W component on graphics programming. I read a blog about opengl that says that w must be equal to either 0 or 1 here. But the book I am currently reading has put w component to more than 1 ...
1
vote
3answers
2k views

Replace glTranslatef and glRotatef with matrixes

I'm not an opengl expert, and, as a novice, I prefer to practice a little bit with the old opengl just to be sure to understand correctly the basic concept of computer graphics before deal with ...
1
vote
1answer
150 views

Using an FBO texture and write to it

I wanted to know if it's possible to use a texture of an FBO for post-processing and using that texture again for writing or do I need at least two textures? I hope you understand what I mean.
1
vote
3answers
1k views

OpenGL tile rendering

Currently I'm trying to render a TileMap using OpenGL 2.1, GLSL 1.2. I would like to draw every tile in just one draw call. I use a single texture with all tiles, identifying each one by an index. ...
1
vote
1answer
237 views

How can I use OpenGL and D3D to render to the same window at the same time?

I have main render loop in which initial drawing is done via OpenGL to an SDL window, and after that the same window handle is passed to a Direct3D device, which does subsequent rendering. Once I ...
1
vote
1answer
140 views

OpenGL light not shining quad

I've constructed a scene using OpenGL/GLUT with a spot light but I'm getting troubles with light shining some of the walls what is going on and how to solve?
1
vote
1answer
233 views

Why does my blur shader implementation produce this strange result?

I tried to implement the blur shader shown here. Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply ...
1
vote
1answer
848 views

Drawing Sprites in Android OpenGL efficiently?

I want to basically give myself some sprite drawing functions (making use of openGL) such as; draw(Texture,x,y) I want to do this using OpenGL-ES 2.0 on Android. Since the textures can be varying ...
1
vote
2answers
267 views

How to get a texture from current point of view in OpenGL 2.0 ES?

Probably the title is confusing, but I didn't know how to ask better, sorry about that. What I would like to do is get a bitmap texture that represents exactly what's rendered at one point in time and ...
1
vote
1answer
3k views

Why does glGetString returns a NULL string

I am trying my hands at GLFW library. I have written a basic program to get OpenGL renderer and vendor string. Here is the code #include <GL/glew.h> #include <GL/glfw.h> #include ...
1
vote
1answer
342 views

Collision Detection Tips

I need collision detection for my 3D racing game but it isn't going well right now. I think I understand the concept of testing boxes and generating a response, however implementation part is a ...
1
vote
1answer
475 views

How to pick a 3D object with known mouse coordinates if the camera is rotated 60 degrees?

I am making a simple game engine for a simple RTS game and would like to be able to pick a cube and move it around with the mouse coordinates. The problem is that my camera is rotated 60 degrees just ...
1
vote
2answers
451 views

What's wrong with this turn to face algorithm?

I implement a torpedo object that chases a rotating planet. Specifically, it will turn toward the planet each update. Initially my implement was: void move() { vector3<float> to_target ...
1
vote
1answer
926 views

Creating a 3D text mesh from a 2D glyph

I have thought of three steps for doing this: Acquire the vertex coordinates which will represent the glyph's form Extrude them Render Can you suggest a better method? Can you give me an insight ...
1
vote
2answers
2k views

Which one have to use Canvas or Open GL for 2D game in Android

I am compleatly new to android gaming.I want to develop a 2D game with some physics in it.I want to know which one i have to use Open GL or Canvas and the reason for selection I want to include a ...
1
vote
2answers
739 views

LWJGL GL_QUADS texture artifact

I managed to get working LWJGL in Java, and I loaded a test image (tv test card), but I keep getting weird artifacts outside the image. Code: glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2i(10, ...
1
vote
2answers
4k views

Transparent parts of texture are opaque black instead

I render a sprite twice, one on top of the other. The sprites have transparent parts, so I should be able to see the bottom sprite under the top sprite. The transparent parts are black (the clear ...
1
vote
2answers
1k views

Render a polyline with rounded joints

I have a list of points (3D) and want to draw a line connecting all points with a specified width. The line should be rendered in OpenGL (using OSG) as triangles. The real challenge of this task is to ...
1
vote
1answer
2k views

Optimized algorithm for line-sphere intersection in GLSL

Well, hello then! I need to find intersection between line and sphere in GLSL. Right now my solution is based on Paul Bourke's page and was ported to GLSL this way: // The line passes through p1 and ...
1
vote
2answers
681 views

SAT, How Do I Find The Penetration Vector?

I've just successfully implemented Separating Axis Theorem (SAT) in my game but I was wondering how do I find the penetration vector? I heard it can be useful for collision response. e.g. The harder ...
1
vote
2answers
353 views

What do I need to know for writing code for both OpenGL and OpenGL ES 2.0

I am developing an engine that uses both OpenGL and OpenGL ES 2.0. I am well seasoned in OpenGL but not ES (although I am aware it is a subset of OpenGL). I could not find a set of differences that I ...
1
vote
3answers
2k views

Walkin on terrain - Opengl

i wanna walk to terrain... first i created the terrain void desenha_terreno(float px, float pz){ for (int z = 0; z < iwidth-1; z++) { glBegin(GL_TRIANGLE_STRIP); for (int x = 0; x < ...
1
vote
1answer
444 views

How do you create a fractal cube-map?

I want to create a map similar to how Mincraft and other related games do. I just haven't the faintest clue on how to do so. Can anyone point me to a decent tutorial or give me a decent run through? I ...
1
vote
3answers
1k views

Is it possible to batch draw sprites that use different textures without using an atlas?

I've implemented a sprite batch class that uses a sampler array so that I can select a texture to use based on the gl_PrimitiveID. The idea was to be able to draw sprites that use different textures ...
1
vote
3answers
1k views

Correct order of rotation and translation

Trying to get this right in openGL: 1) glRotate( cameraRotation ) 2) glTranslate( -cameraPosition ) 3) glRotate( objectRotation ) 4) glTranslate( objectPosition ) 5) Draw Object is that right?
1
vote
1answer
49 views

Do I have to use vertexArray in opengl

GLuint VertexArrayID; glGenVertexArrays(1, &VertexArrayID); glBindVertexArray(VertexArrayID); As you can see from the above code, some tutorials use this before using opengl. But a tutorial that ...
1
vote
2answers
130 views

How can I pass a std::vector<Vector3f> to my shader?

I have a Vector3f type which has x, y, and z properties. I have a std::vector of these vertices which describe my terrain. I would like to pass these values to a vertex shader through a uniform ...
1
vote
1answer
83 views

IBO interfering with VBO data?

I have a vertex and color VBO that render a plane (2 triangles) just fine. However, when I attempt to use an IBO to render the plane, the vertices are completely off. My nice square looks all crumpled ...
1
vote
1answer
248 views

libgdx glClearColor not setting right color?

i just new to libgdx and trying to understand the example code, the following code sets the bg color Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); Gdx.gl.glClearColor(60,181,00,0f); my ...
1
vote
1answer
119 views

GLSL Processed Image to OpenGL

I've tried wording and rewording this question in various forms of search and can't seem to find an answer to it. If I'm wording it wrong and/or just not finding the right information, feel free to ...
1
vote
2answers
138 views

GLSL to Cg: why is the effect different?

With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear. The effect can be shown here, through a GLSL shader: But when I use the ...
1
vote
1answer
321 views

LibGDX Box2DLights shadow offset problem on bodies

Hello I just started to use LibGDX, and it's awesome. I looked at the Box2DLights library, and started to learn how the lighting work here. I got something up: As you can see, it works, but the ...
1
vote
2answers
810 views

2D Outline shader in GLSL

I have a simple prototype with 2D worms-like destructible terrain. I use a trivial shader to discard pixels based on a mask. varying vec2 v_texCoords; uniform sampler2D u_texture; uniform sampler2D ...
1
vote
2answers
111 views

Bad pixels on shader when loading cached binary programs

I have been trying to cache binary shader programs in my game and load them accordingly using "glGetProgramBinaryOES" and "glProgramBinaryOES" respectively. I was successfully able to cache and load ...
1
vote
1answer
414 views

gl_VertexID values when calling glDrawElements

I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed. I have the standard modern rendering pipeline, in which after setting up ...
1
vote
1answer
131 views

Performing manual clipping in OpenGL

I'm learning OpenGL and I understand that OpenGL performs clipping as part of the pipeline, but is it a good idea to also perform manual clipping? By manual clipping, I mean not asking the GPU to draw ...
1
vote
1answer
407 views

Decoupling rendering pipeline (for UI responsiveness): Multithreading and multiple contexts?

Warning! Wall of text (see <TL;DR> paragraphs below for short version) I have been noticing something in quite many games (most recently in cutting-edge RTS games such as Uber Entertainment's ...
1
vote
1answer
251 views

I can't seem to figure out what's causing this bug with the “layout” keyword in GLSL

I have a GL shader file whose first few lines currently look like this: #version 120 layout (location = 0) in vec3 position; layout (location = 1) in vec2 vertexUV; When I try to compile this ...
1
vote
1answer
419 views

glGetUniformLocation Returns -1

I've been trying to develop shaders that would allow me to easily display text on screen using a font texture. I've previously written shaders that simply drew the text on screen and I passed the ...
1
vote
3answers
507 views

How do I efficiently use 16 bit texture coordinates?

While loading a model I get a big array of 32 bit floating point texture coordinates. I just upload that to a single vertex buffer (along with other data, such as vertices, normals, etc.) and use it ...
1
vote
1answer
119 views

glIsBuffer unexpected result

static void BindBuffer(BufferTarget target, GLuint buffer) { if(!glIsBuffer(buffer)) throw runtime_error("This is not a buffer. WTF?"); glBindBuffer((GLenum)target,buffer); ...