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

5
votes
1answer
426 views

Cheap ways to do scaling ops in shader?

I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about ...
5
votes
2answers
1k views

Should the modelview and projection matrices be calculated in the shader or on the CPU?

At minimum I would have a camera with rotation and world position; projections parameters such as angle of view and perspective vs. orthographic; and meshes with scale, angle, and world position. ...
5
votes
1answer
1k views

How do engines like Unreal relate to OpenGL or D3D?

Well I'm completely completely new to computer graphics and even more to game development. I am searching info and all that stuff to have the basics quickly. But there's a big question mark in my ...
5
votes
2answers
743 views

How can I make the switch from immediate mode to VBOs?

I've been using OpenGL for a short time now- and I'd like some clarification on VBOs. As I understand it, a VBO is an object stored on VRAM. In immediate mode, to apply a texture we simply bind it and ...
5
votes
2answers
416 views

Should I batch up debug primitives for rendering in modern OpenGL?

I've recently started porting some old rendering demos I did to modern OpenGL. I had a debug drawing class in my old code which used immediate mode glBegin(), glEnd() etc. for rendering debug objects ...
5
votes
1answer
527 views

How to insert and remove blocks quickly in a Minecraftian world?

I currently have volume data for the world stored as an array of booleans. I then check each empty block and if it has non-empty neighbors the faces get drawn. This prevents me from sending a bunch ...
5
votes
4answers
3k views

Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0)

Hey, hello guys, I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder. I opened the exported file and copied the vertices ...
5
votes
3answers
4k views

how to add water effect to an image

This is what I am trying to achieve: A given image would occupy say 3/4th height of the screen. The remaining 1/4th area would be a reflection of it with some waves (water effect) on it. I'm not sure ...
5
votes
1answer
197 views

How can glass breaking effect from Smash Hit be achieved? [duplicate]

I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect: I've read other posts about this subject but I still feel that they don't share enough ...
5
votes
1answer
166 views

Spherical harmonics lighting interpolation

I want to use hardware filtering to smooth out colors in texels of a texture when I'm accessing texels at coordinates that are not directly at the center of the texel, the catch being that the texels ...
5
votes
1answer
471 views

What are the rest of the blending functions used for?

In general, I know of five ways to make use of blending functions (these are for OpenGL, but replace glBlendFunc() with SetRenderState(D3DRS_SRCBLEND) and SetRenderState(D3DRS_DESTBLEND) for DirectX): ...
5
votes
1answer
898 views

What is actually drawn when glDrawArrays and glDrawElements are called?

In my journey out of immediate mode I've come across a snag that I haven't been able to find a decent answer for in any tutorial or API, namely: Which data structures are actually invoked when I make ...
5
votes
2answers
787 views

Geometry shader for multiple primitives

How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so: layout(triangles) in; ...
5
votes
1answer
877 views

VBO and gl*Pointer management practises?

I'm aware it's not a simple yes/no question and for the moment I can't tell if it can be simply answered, or is it topic for a long discussion which is not suitable for our Q&A format. I want to ...
5
votes
1answer
722 views

Difference between the terms Material & Effect

I'm making an effect system right now (I think, because it may be a material system... or both!). The effects system follows the common (e.g. COLLADA, DirectX) effect framework abstraction of Effects ...
5
votes
1answer
1k views

Problem with Assimp 3D model loader

In my game I have model loading functions for Assimp model loading library. I can load the model and render it, but the model displays incorrectly. The models load in as if they were using a seperate ...
5
votes
2answers
353 views

How does this snippet of code create a ray direction vector?

In the Minecraft source code, this code is used to create a direction vector for a ray from pitch and yaw:' float f1 = MathHelper.cos(-rotationYaw * 0.01745329F - 3.141593F); float f3 = ...
5
votes
1answer
1k views

How does one get adjacency information in a geometry shader?

If you use triangle_adjacency as the input type of a geometry shader, do you need to do something on the client side besides make the primitive mode triangle_adjacency? Basically what I'm asking do ...
5
votes
2answers
8k views

Does Unity for PC use Direct3D or OpenGL?

I am a mac developer using Unity and I hardly use a PC. When you build a Unity game for Windows, does it use Direct3D or OpenGL? P.S. I'm not sure if it's called Direct3D or DirectX
5
votes
1answer
740 views

GLSL shader without a vertex array

Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without ...
5
votes
1answer
523 views

OpenGL ES 2.0 obscured texture is visible

Hi, I am using LibGDX and OpenGL 2.0 to create a game. So far I have created two meshes. The front mesh is the one with the brown circle texture and another mesh on the top with a green to white ...
5
votes
1answer
2k views

How to do simple bump mapping

I'm trying to do bump mapping, and I'm getting fairly close at achieving my goal. I miss one crucial piece of my puzzle to have bump mapped effect in my scene; I need to transform the normals from my ...
5
votes
1answer
800 views

OpenGL textures loaded with SDL_Image display with no alpha

I am making a game using OpenGL, with SDL_Image employed to load the textures. When drawn on screen, there's no alpha -- in an exact square around the opaque contents of the texture, black is drawn; ...
5
votes
1answer
6k views

OpenGL ES 2.0: Understanding Perspective Projection Matrix

Setting the Perspective projection matrix in Open GL (including OpenGL ES 2.0) has the following general format: glm::mat4 perspective(float fovy, float aspect, float zNear, float zFar); Notice the ...
5
votes
2answers
833 views

Drawing a set of VBOs with one draw command in OpenGL. Is there a glMultiDrawElements for VBOs?

I have a few hundred VBOs, and I want to only draw a subset of the VBOs each frame. Is there anything faster than binding and drawing each VBO? Is there a batched draw command for multiple VBOs? ...
5
votes
1answer
140 views

“Normal” Blend Mode with OpenGL Trouble

I've been having a lot of trouble trying to get a OpenGL blend function to work as I'd expect it to with like what I'd expect (or from any sensible image editing program). As an example, I'll use ...
5
votes
2answers
295 views

Are display lists faster than VBOs?

I'm making a voxel rendering engine. My "chunks" are 32 * 32 * 256 blocks and I can render a 16 * 16 square of them (which corresponds to Minecraft's maximal render distance). I'm using VBOs holding ...
5
votes
1answer
939 views

Exponential Variance Shadow Mapping - implementation

I use a variance shadow mapping with a "standard" light bleeding fix in my graphics engine which is based on deferred rendering.. I have a single shadow map for a directional light beacause a test ...
5
votes
1answer
147 views

GLImpl.gldrawelements longer than usual

I'm developing a little game engine for the Android platform and I'm trying to improve the performance of this one. (I'm not an OpenGL expert) I can see a framerate drop sometimes, when using DDMS ...
5
votes
1answer
510 views

How to flip a BC6/BC7 texture?

I have some code to load DDS image files into OpenGL textures, and I'd like to extend it to support the BC6 and BC7 compressed formats introduced in D3D11. Since DirectX and OpenGL disagree about ...
5
votes
1answer
2k views

GLSL default shaders

I've been arming my engine with error checking code. I'll try to describe this situation to my best abilities. Whenever i load a shader and there's an error (file doesn't exist, compilation error, ...
5
votes
1answer
279 views

Can I leverage the fact that my scene is often static to improve OpenGL (JOGL) performance?

My scene is drawn based on the location of several (often several million) vertices (kept in VBO's) and a camera. I can easily tell in my code when my scene has changed and when it hasn't. There are ...
5
votes
1answer
155 views

How can I implement real-time mutual object reflection?

So, given a scene like this (cubemap skybox with "real" spheres) Everything looks great, except for the fact that the spheres don't reflect each other. What's a good way to go about this? The ...
5
votes
1answer
945 views

What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330)

I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming. I'm currently trying to implement deferred ...
5
votes
1answer
187 views

Blend multiple regions from same texture atlas

I'm representing terrain in my game as a grid with at each node a composition, for example 100% rock, or 50% grass, 50% soil. I'd like to use this composition vector to blend textures together. I'm ...
5
votes
2answers
2k views

How to rotate camera centered around the camera's position?

Currently I am using gluLook at like so: gluLookAt(position.x, position.y, position.z, viewPoint.x, viewPoint.y, viewPoint.z, upVector.x, upVector.y, upVector.z); with the ...
5
votes
3answers
747 views

Rotate a particle system

Languages / Libraries in use: C++, OpenGL, GLUT Okay, here's the deal. I've got a particle system which shoots out alpha blended textures to produce a flame. The system only keeps track of very ...
5
votes
3answers
742 views

Can anyone recommend a 3D model viewer with shading?

I am looking for a simple real-time OpenGL based render engine to show a 3D model on screen. I prefer using 3DS Max's 'shader' materials (real-time materials) for editing. Do you know any good ...
5
votes
1answer
1k views

What's the best way of drawing a glowing 3d line using LWJGL?

Sort of like a strip-light effect; not actually a light source, but just a polygon with glowing edges. Can this be done easily? Right now I'm contemplating drawing a line more than once with varying ...
5
votes
2answers
1k views

OpenGL equivalent of .fx files in GLSL or Cg?

There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max What do larger ...
5
votes
1answer
122 views

How to implement translation, scale, rotation gizmos for manipulating 3D object's transforms?

I am in the process of developing a basic 3D editor. It uses OpenGL for rendering a 3D world. Right now my scene is just a few boxes of different sizes and I am at the stage where I want to be able to ...
5
votes
3answers
429 views

How do I send multiple matrices to a vertex shader?

I'm practising animations using bones/skinning. I am trying to send the shader one matrix per vertex. I can think of these two approaches. Method 1 I have one uniform handle for each bone matrix ...
5
votes
1answer
248 views

Animation of moving circle by square's outer surface

I want to make this animation in OpenGL, here I attached a simple gif how I want it to looks like: Main problem is that I can not figure out how to move by corner - circle should smoothly move by ...
5
votes
1answer
223 views

How to pass depth buffer from OGRE to CUDA?

I am using OGRE for rendering some objects. At every frame, I would like to pass the resulting depth buffer to CUDA for running some kernels on it and computing a result. How can I achieve this? How ...
5
votes
1answer
691 views

Slow glReadPixels

I have implemented a lense flare for my game, and it looks great. The first draft used individual sprites each with its own draw call. This was very slow, so I reengineered it to use a single draw ...
5
votes
1answer
895 views

OpenGL blending (masking)

I need some help with OpenGL textures masking. I have it working but need to find some other blending function parameters to work in other way. Now I have: //Background ...code... ...
5
votes
1answer
416 views

Raymarching artifacts

I was playing with raymarching using distance fields in GLSL sandbox and got stuck with a strange problem with artifacts. Click here and take a look at the spheres generated in corners, they have ...
5
votes
1answer
301 views

How can I test shaders for nVidia on an ATi system?

I and our other devs have ATi graphics cards. However we have encountered that some shaders that compile without warnings on ATi don't compile at all on nVidia. The problems are trivial to fix, but ...
5
votes
1answer
699 views

Bullet Physics implementing custom MotionState class [closed]

I'm trying to make my engine's camera a kinematic rigid body that can collide into other rigid bodies. I've overridden the btMotionState class and implemented setKinematicPos which updates the motion ...
4
votes
2answers
2k views

Lost on OpenGL versions, which to start?

I was reading about OpenGL, and found out the Red Book is a great book for me to read to learn. I then read that even though they have 3.x and 4.x versions, I should still stick to 2.x so I don't ...