opengl

Compute bounding quad of a sphere with vertex shader

I'm trying to implement an algorithm from a graphics paper and part of the algorithm is rendering spheres of known radius to a buffer. They say that they render the spheres by computing the location and size in a vertex shader and then doing appropriate shading in a fragment shader. Any guesses as to how they actually did this? The po...

Modifying an image with OpenGL ?

I have a device to acquire XRay images. Due to some technical constrains, the detector is made of heterogeneous pixel size and multiple tilted and partially overlapping tiles. The image is thus distorted. The detector geometry is known precisely. I need a function converting these distorted images into a flat image with homogeneous pixe...

Optimized 2D Tile Scrolling in OpenGL

Hello, I'm developing a 2D sidescrolling game and I need to optimize my tiling code to get a better frame rate. As of right now I'm using a texture atlas and 16x16 tiles for 480x320 screen resolution. The level scrolls in both directions, and is significantly larger than 1 screen (thousands of pixels). I use glTranslate for the actua...

OpenGL texture not showing up on some computers, problem with auxDIBImageLoad?

I have a simple openGL GUI that has uses a bmp as a texture. The problem is on some computers the texture doesn't show up. But on ones with newer OpenGL drivers it works. How can I make it more compatible. I think the problem may be with auxDIBImageLoad. When I inspect the result, I see the x,y correct, but the data pointer points t...

How do I perform an HSL transform on a texture?

If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look? I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and sat...

How do I get the current color of a fragment?

I'm trying to wrap my head around shaders in GLSL, and I've found some useful resources and tutorials, but I keep running into a wall for something that ought to be fundamental and trivial: how does my fragment shader retrieve the color of the current fragment? You set the final color by saying gl_FragColor = whatever, but apparently th...

street light and shadow in opengl ?

To make a scene street illuminated, i tried, point source light, used glMaterial and used ambient light...... I get a scene fully illuminated, not exactly the way like street light, can anyone share resources or explain how exactly i can achieve this?? I went through many light resources in net, could not properly understand.... ...

Visualize the depth buffer

I'm attempting to visualize the depth buffer for debugging purposes, by drawing it on top of the actual rendering when a key is pressed. It's mostly working, but the resulting image appears to be zoomed in. (It's not just the original image, in an odd grayscale) Why is it not the same size as the color buffer? This is what I'm using the...

A library to port GDI code to DirectX/OpenGL?

I have some old MFC program using GDI heavily for drawing of texts and vectors. The program is scheduled to be rewritten in the future using DirectX/OpenGL. In the meantime, is there any library which acts as a simple wrapper that could replace GDI for one of these hardware accelerated APIs to improve performance? ...

Pyglet OpenGL drawing anti-aliasing

I've been looking around for a way to anti-alias lines in OpenGL, but none of them seem to work... here's some example code: import pyglet from pyglet.gl import * window = pyglet.window.Window(resizable=True...

Which way to go in Linux 3D programming?

I'm looking for some answers for a project I'm thinking of. I've searched and from what I understand (correct me if I'm wrong) the only way the program I want to make will work is through 3D application. Let me explain. I plan to make a studio production program but it's unique in the fact that I want to be able to make it fluid. Let me...

how to insert jpg/png into scene in opengl?

Is it possible to load an image file into opengl? We are developing a realistic scene of a robot in both linux and VC++. What libraies and methods are available to insert an image? also link good examples and references. ...

Using OpenGL in a regular window (Win32)

I want to use OpenGL in my WndProc but I'm not sure how. I also don't want GL to occupy the whole screen, just a portion of the screen. In the end I basically want to make a drawing win32 app but use OGL instead of GDI. so how can I tell GL to use my control (a panel) 's hdc for drawing? Thanks ...

Drawing NGons with OpenGL

Is OpenGL, given a series of points, able to fill in a polygon or is this only possible by creating lots of trianges? Thanks ...

OpenGL Coordinate system confusion

Maybe I set up GLUT wrong. Basically I want verticies to be reletive to their size in pixels. Ex:right now if I create a hexagon, it hakes up the whole screen even though the units are 6. #include <iostream> #include <stdlib.h> //Needed for "exit" function #include <cmath> //Include OpenGL header files, so that we can use OpenGL #ifdef ...

Polygonal gradients with OpenGL

I'm wondering how I could create a gradient wuth multiple stops and a direction if I'm making polygons. Right now I'm creating gradients by changing the color of the verticies but this is limiting. Is there another way to do this? Thanks ...

Make openGL lines connected

Right now I'v created a polygon, then I do the same thing but with line_loop to draw the outline. My issue right now is if I set the line thickness to high, the lines arn't connected. Their ends would need to be (linewidth) longer... is there a way to fix this? Thanks glMatrixMode (GL_PROJECTION); glLoadIdentity (); gl...

Generate texture from polygon (openGL)

I have a quad and I would like to use the gradient it produces as a texture for another polygon. glPushMatrix(); glTranslatef(250,250,0); glBegin(GL_POLYGON); glColor3f(255,0,0); glVertex2f(10,0); glVertex2f(100,0); glVertex2f(100,100); glVertex2f(50,50); glVertex2f(0,100); glEnd(); //End quadrilateral coordinates gl...

How to compile OpenGL with a python C++ extension using distutils on Mac OSX?

When I try it I get: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so, 2): Symbol not found: _glBindFramebufferEXT Referenced from: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so Expected in: dynamic lookup I've tried a...

Drawing connected lines with OpenGL

I'm drawing convex polygons with OpenGL. I then do the same thing but use GL_LINE_LOOP. The problem I have is the lines are not always connected. How could I ensure that the lines are always connected? In the photo below, Iv highlighted in green, the corners that are connected and in red, those that are not. I would like for them to be ...