opengl

Does OpenGL not support shared contexts on windows?

I am working on a cross platform OpenGL project and it seems that all of the textures that share a GLcontext have trouble when I try and load them in windows. I have been told that this was not supported in older versions of OpenGL on windows but it seems that there must be some way to share texture resources in OpenGL on Windows. If t...

What's the best way to draw a fullscreen quad in OpenGL 3.2?

I'm doing ray casting in the fragment shader. I can think of a couple ways to draw a fullscreen quad for this purpose. Either draw a quad in clip space with the projection matrix set to the identity matrix, or use the geometry shader to turn a point into a triangle strip. The former uses immediate mode, deprecated in OpenGL 3.2. The latt...

OpenGL/GLSL: What is the best algorithm to render clouds/smoke out of volumetric data?

Hello, I would like to render the 3D volume data: Density(can be mapped to Alpha channel), Temperature(can be mapped to RGB). Currently I am simulationg maximum intensity projection, eg: rendering the most dense/opaque pixel in the end.But this method looses the depth perception. I would like to imitate the effect like a fire inside the...

How to draw an Arc in OpenGL

While making a little Pong game in C++ OpenGL, I decided it'd be fun to create arcs (semi-circles) when stuff bounces. I decided to skip Bezier curves for the moment and just go with straight algebra, but I didn't get far. My algebra follows a simple quadratic function (y = +- sqrt(mx+c)). This little excerpt is just an example I've y...

[OpenGL] Interleaving Vertices and Texture Coords and Normals

My buddy read an OpenGL book that said interleaving your vertex pointers and the corresponding texture coords etc to be next to each other in a larger array gives a speed boost. How much of a speed boost? On which chip sets? ...

OpenGL index buffer object with additional data

I have a large set of lines, which I render from a vertex buffer object using glMultiDrawArrays(GL_LINE_STRIP, ...); This works perfectly well. Now I have lots of vertex pairs which I also have to visualize. Every pair consists of two vertices on two different lines, and the distance between the vertices is small. However, I like to h...

Picking objects in OpenGl ,using C#

Hi folks : i'm working with opengl using C#(using TaoFrame work ) ,the thing is that i want to draw 2 objects on screen (rectangle for example ),the main goal of my Question is, how to press the mouse button so i can select one object to make it move . Basically i just need to know how to select one object that's all : Info about ...

C++ Memory Leak, Can't find where

I'm using Visual Studio 2008, Developing an OpenGL window. I've created several classes for creating a skeleton, one for joints, one for skin, one for a Body(which is a holder for several joints and skin) and one for reading a skel/skin file. Within each of my classes, I'm using pointers for most of my data, most of which are declared u...

How to write to the OpenGL Depth Buffer

I'm trying to implement an old-school technique where a rendered background image AND preset depth information is used to occlude other objects in the scene. So for instance if you have a picture of a room with some wires hanging from the ceiling in the foreground, these are given a shallow depth value in the depthmap, and when rendered...

Internal format for 8 bit BGR texture

I'm trying to figure out how to specify a BGR 8 bit texture. I've tried the following combinations (allowed), but all render with wrong colors: Internal format: RGB; Format: RGB; Data Type: UNSIGNED_BYTE_3_3_2; Internal format: RGB; Format: RGB; Data Type: UNSIGNED_BYTE_2_3_3_REV; I've tried the following combinations, all with the ...

Repeated Scene Trees (Java3d / OpenGL)

Hello, I want to make a 3d scene that loops around on its self. That is to say, if you keep going in any direction, you will loop back to the other side. My current implementation is so bad, it's embarrassing to admit to it. I redraw the each change twenty-seven times, to make a 3x3x3 scene cube. When the user reaches the end of the...

How to draw a 3D donut chart in OpenGL?

I would like to draw a chart in OpenGL similar to the donut graph at the bottom-right of this example. I have experience with drawing 2D charts such as the main chart in the example but what confuses me about the one I want to draw is the correct type of primitive to use when drawing the 3D chart. I have considered using GL_QUAD_STRIP ...

c++ opengl: how can i combine 2 different projection types for 3d graphics and 2d menus ?

Hi! I would like to use Oblique projection for menus and perspective projection for the 3d-scene. is there a way to combine between this two projections ? In general I'm asking how can I create menus in opengl for my 3d scene. Programming using the c++ language. Thanks! ...

How do I prevent jagged edges alongside the surfaces of my 3d model?

Lets say I've implemented in openGL a crude model viewer with shading which renders a series of blocks, such that I have something that looks like this. http://i.imgur.com/TsF7K.jpg Whenever I rotate my model to the side, it causes an unwanted jagged effect along any surface with a steep viewing angle. http://i.imgur.com/Bgl9o.jpg I'...

OpenGL + cgFX Alpha Blending failure

I have a shader that needs to additively blend to its output render target. While it had been fully implemented and working, I recently refactored and have done something that is causing the alpha blending to not work anymore. I'm pretty sure that the problem is somewhere in my calls to either OpenGL or cgfx - but I'm currently at a lo...

OpenGL Video RAM Limits

I have been trying to make a Cross-platform 2D Online Game, and my maps are made of tiles. My tileset, which I render the tiles from, is quite huge. I wanted to know how can I disable hardware rendering, or at least making it more capable. Hence, I wanted to know what are the basic limits of the video ram, as far as I know, Direct3D has ...

How to position object using forward, top and center coordinates in opengl.

Hello I have a scene and an object placed in some coordinates. I can transform the object using glTranslate(center) and then glRotate... But how do I rotate an object not using angles but rather directions top and forward? Thanks What I'm looking is translation between model coordinate system and global coordinate system. ...

Tips for efficient GLSL code

Are there any guidelines for writing efficient shaders in GLSL? Does the compiler handle most of the optimization? ...

Programatically creating OpenGLView in Cocoa

My code below does not work. I don't even get an error message. I simply don't see an OpenGL window being displayed. How can I get the OpenGL window to display? Thanks! // code taken from various internet sources + safari online books #import <stdio.h> #import <AppKit/AppKit.h> #import <Foundation/Foundation.h> #define LIGHT_X_TAG...

When should a uniform be used in shader programming?

In a vertex shader, I calculate a vector using only uniforms. Therefore, the outcome of this calculation is the same for all instantiations of the vertex shader. Should I just do this calculation on the CPU and upload it as a uniform? What if I have ten such calculations? If I upload a lot of uniforms in this way, does CPU-GPU communicat...