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 ...
5
votes
1answer
459 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
2k 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
2answers
953 views
3D primitive rendering library
I am looking for a library which would easily allow me to render shapes (cubes, spheres, lines, circles, etc.) in 3D3 and OpenGL if possible. I want to be able to rapidly design visual debugging tools ...
5
votes
1answer
527 views
OpenGL: Resizing Display and glOrtho/glViewport
I have researched this question from several sources and have yet to find a firm answer saying that "yes that is correct thinking" or "no, here is how it's done."
I am trying to ensure resolution ...
5
votes
1answer
211 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
234 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
309 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
509 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
393 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
800 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
3answers
2k views
Object-Oriented OpenGL
I have been using OpenGL for a while and have read a large number of tutorials. Aside from the fact that a lot of them still use the fixed pipeline, they usually throw all the initialisation, state ...
5
votes
2answers
303 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
4answers
8k views
Wavefront *.obj loader in C++
I'm creating a game using OpenGL (via SDL) and C++ (via Visual Studios 2010 Professional). During the game, I will be using 3D character animation. I'd like to use wavefront *.obj files for all the 3D ...
5
votes
3answers
2k 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
370 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
3k views
Making a camera in a 2D game (glOrtho)
I'm trying to make a camera that follows my character and it seems I've managed. However, I don't know how to limit that my camera don't follow me when my character reachs the boundaries of the ...
5
votes
1answer
4k 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
657 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
63 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
743 views
GLSL, all in one or many shader programs?
I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, ...
5
votes
1answer
229 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
112 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
725 views
Sorting objects before rendering
I'm trying to implement a scene graph and in all the articles i've come across there is talk about object sorting. So you'd sort your objects by "material" for example. Now untill i sat down and ...
5
votes
3answers
633 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
2answers
2k views
Using a GLSL fragment shader to draw a texture in the middle of a quad
I'm not sure how possible this is, but I'm trying to use a fragment shader to draw a portion of a texture in the middle of a quad. This is all 2D. The quads consist of four vertices from (0, 0) to ...
5
votes
3answers
578 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
How to manage shaders?
I've done some shader programming some time ago but only simple stuff. I'm especially interested in how do you manage shaders? Do you just write one of each kind, or do you need more of them? If so, ...
5
votes
1answer
2k views
How to use multi-thread OpenGL application to update VBO and use it at the same time?
I have simple application. It has two threads. Each thread has it's own rendering context, but they share one VBO (this is working, I tested it).
Now what I want: One thread is rendering some data ...
5
votes
1answer
975 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
991 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
97 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
279 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
521 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
342 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
2answers
752 views
Getting the number of fragments which passed the depth test
In "modern" environments, the "NV Occlusion Query" extension provides a method to get the number of fragments which passed the depth test. However, on the iPad / iPhone using OpenGL ES, the extension ...
5
votes
1answer
263 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
2k views
gl_PointCoord always zero
I am trying to draw point sprites in OpenGL with a shader but gl_PointCoord is always zero.
Here is my code
Setup:
//Shader creation..(includes glBindAttribLocation(program, ATTRIB_P, "p");)
...
4
votes
5answers
5k views
OpenGL vs OGRE : Which is the best for beginner? [closed]
I am interested in getting into game development and posses good C/C++ programming skills. I have tried OGRE before, and I am curious whether I should learn either OGRE or OpenGL as a starting point.
...
4
votes
2answers
524 views
What is the order-less rendering technique that allows partial transparency?
I've seen somewhere rendering technique that allows order-less rendering of partially transparent sprites/objects.
Though I can't remember what the technique is called, so I'm having trouble Googling ...
4
votes
4answers
400 views
Why do most game devs prefer OGL for OS X and D3D for Windows? [closed]
Today I decided to check what Diablo 3 developers used to do graphics: OpenGL or Direct3D? My mind was completely blown: For Windows, they've used D3D and for OS X they've used OGL.
I did some ...
4
votes
3answers
639 views
game models that stand in grass
The open source game Glest has models that feel detached from the ground that they sit on because of the hard edges. In real life, grass is not flat!
What are the options and recommendations for ...
4
votes
3answers
3k views
Should I use Game Engines to learn to make 3D games?
HI i am a software engineering student in his second-last year.
I am proficient with C,C++,C# and java programming languages, and being a student of engineering I have studied calculus, vectors etc ...
4
votes
4answers
3k views
GLM: Euler Angles to Quaternion
I hope you know GL Mathematics (GLM) because I've got a problem, I can not break:
I have a set of Eular Angles and I need to perform smooth interpolation between them. The best way is converting them ...
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 ...
4
votes
1answer
1k views
How do I pass vertex and color positions to OpenGL shaders?
I've been trying to get this to work for the past two days, telling myself I wouldn't ask for help. I think you can see where that got me...
I thought I'd try my hand at a little OpenGL, because ...
4
votes
2answers
459 views
What is a reasonable OpenGL version baseline for a mid-range 3D game?
I decided recently write a 3D game in my spare time, as I was tired of my daily "corporate programming". If I expect to be done in 6 months/1 year, which version of OpenGL should I use as baseline? ...
4
votes
2answers
610 views
Optimising the modelview transformation in GLSL for 2D
So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this:
uniform mat4 u_modelview;
attribute vec4 a_position;
void main() {
gl_Position = ...
4
votes
1answer
2k views
Rendering 2d sprites into a 3d world?
In opengl how do I render 2d sprites in opengl given that I have a png of the sprite? See images as an example of the effect I'd like to achieve. Also I would like to overlay weapons on the screen ...
4
votes
3answers
2k views
What is the purpose of glScissor?
I know that it is more efficient than stencil test, but am I right assuming that the same functionality could be achieved using projection transformations with viewport?
4
votes
2answers
389 views
Sprite batching in OpenGL
I've got a JAVA based game with an OpenGL rendering front that is drawing a large amount of sprites every frame (during testing it peaked at 700). Now this game is completely unoptimized. There is no ...

