opengl

Setting glutBitmapCharacter color?

Just wondering if someone can help me track down my issue with the following code where the text color is not being set correctly (its just rendering whatever color is in the background) void RenderText(int x, int y, const char *string) { int i, len; glUseProgram(0); glLoadIdentity(); glColor3f(1.0f, 1.0f, 1.0f); glTranslatef(0.0f, 0....

OpenGL Tearing Problem

Hi, I'm using win32 and opengl and I have a window set up with the projection at glOrtho of the window's coordinates. I have double buffering enabled, tested it with glGet as well. My program always seems to tear any primitives that I try to draw on it if it's being constantly translated. Here is my OpenGL initialization function: gl...

In OpenGL vertex shader, gl_Position doesn't get homogenized..

Hi everyone, I was expecting gl_Position to automatically get homogenized (divided by w), but it seems not working.. Why do the followings make different results? 1) void main() { vec4 p; ... omitted ... gl_Position = projectionMatrix * p; } 2) ... same as above ... p = projectionMatrix * p; gl_Position = p / p.w; I think ...

opengl invert framebuffer pixels

I was wondering was the best way to invert the color pixels in the frame buffer is. I know it's possible to do with glReadPixels() and glDrawPixels() but the performance hit of those calls is pretty big. Basically, what I'm trying to do is have an inverted color cross-hair which is always visible no matter what's behind it. For instance...

Asynchronous readback from opengl front buffer using multiple PBO's

I am developing an application that needs to read back the whole frame from the front buffer of an openGL application. I can hijack the application's opengl library and insert my code on swapbuffers. At the moment I am successfully using a simple but excruciating slow glReadPixels command without PBO's. Now I read about using multiple ...

OpenGL/GLSL checking if shader compiled fine on intel cards

hello, i am using this code to check if my glsl shader compiled fine. glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength); if (infologLength > 1) { int charsWritten = 0; char * const infoLog = new char[infologLength]; glGetInfoLogARB(obj, infologLength, &charsWritten, infoL...

Loading PNG textures to OpenGL

Hello, I'm working on a game, and all of my graphics use magenta as transparent/magic color. They are all 32-bit and the magenta is just for conveniency. Anyway, I would appreciate if someone could advice me what library should I use to load my images (I need to load them in GL_RGBA format, both internal and texture specific). ...

Why when I render a scene with a revolving camera objects that you'd expect to appear behind others don't do that? OPENGL Objective-c

Hello, I am rendering a scene in which I have two spheres. I am revolving a camera around one of them. What happens is counter-intuitive. When the camera goes around the sphere the other gets in front of it when you'd expect it to be behind. So it appears as though the spheres aren't revolving around each other and the one the should go ...

How to create a transparent glass cup in OpenGL ES/OpenGL?

Hi there! Is there a way to create a glass cup with OpenGL ES/OpenGl? And if it's possible, what can i read to start creating? Need to get the most realistic view of a glass, for example - see glass cup image For simplicity, without handles. Maybe, anybody has example with sources? Thanks. ...

How to pass non static member function into glutDisplayFunc

Hi All I know this is not a new problem and has been solved, but I still dont know about it :) I have a class which has functionality to initialise opengl and run it in separate thread. My problem is: openGL callbacks such as glutDisplayFunc, glutMotionFunc etc accepts void (*f) void, and I cannot pass class member function. ways ar...

particle system: particle generation

Hello: I have a system that generates particles from sources and updates their positions. Currently, I have written a program in OpenGL which calls my GenerateParticles(...) and UpdateParticles(...) and displays my output. One functionality that I would like my system to have is being able to generate n particles per second. In my Gener...

uniform generation of points on 3D box

Hello: I would like to generate random points on a 3D box defined by its (minx, miny, minz) and (maxx, maxy, maxz) corners. I was thinking of generating a random point inside of the box and then somehow projecting it onto one of the box sides. However, I don't have explicit plane information for the box sides and this seems like it will...

My OpenGL game switches Aero DWM Glass off.

Hi ! I wrote a free game a few years ago: http://www.walkover.org. For the lobby and menus, it uses normal dialogs like win32. When the actual game starts it uses OpenGL. Now, on Windows 7, when the actual game starts, it switches windows aero glass off and switches it back on when the game is over. Is there something I can do to pr...

How to display many SVGs in Java with high performance

What I want My goal is to be able to display a large number of SVG images on a single drawing area in Java, each with its own translation/rotation/scale values. I'm looking for the simplest solution allowing this, optionally even using OpenGL to speed things up. What I've Tried My initial naive approach was to use SVGSalamander to dra...

Visual C++ program for paint brush code using openGL

hi!I want the code/program for paint brush in Visual C++ using open gl.It must include square,rectangle,triangle,circle,pencil,eraser and it must have buttons. ...

How can I start a new glutMainLoop() after exiting one in OpenGL with Perl?

I've written a Perl script using OpenGL. It calls glutMainLoop() to let the user view some stuff, then the user closes the window but I want to let him continue using the script and reopening a new window and seeing some other stuff. Is that possible? I've found that it is possible to execute this instruction: glutSetOption(GLUT_ACTION_...

uniform generation of 3D points on cylinder/cone

Hello: I wish to randomly and uniformly generate points on a cylinder and a cone (separately). The cylinder is defined by its center, its radius and height. Same specifications for the cone. I am able to get the bounding box for each shape so I was thinking of generating points within the bounding box. However, I'm not sure how to proje...

Reading BVH file in pyopengl

Hi I am trying to animate a skeleton using a BVH file. I am doing this in pyopengl. Now I have googled and got to know that python has a generic module that can be used to read BVH file but i don't know how to use it or how to import that module. Can anyone help me with that. Any sample code or any other help would be appreciated. Tha...

PyOpenGL: glVertexPointer() offset problem

My vertices are interleaved in a numpy array (dtype = float32) like this: ... tu, tv, nx, ny, nz, vx, vy, vz, ... When rendering, I'm calling gl*Pointer() like this (I have enabled the arrays before): stride = (2 + 3 + 3) * 4 glTexCoordPointer( 2, GL_FLOAT, stride, self.vertArray ) glNormalPointer( GL_FLOAT, stride, self.vertArray + 2 ...

How to get a flat, non-interpolated color when using vertex shaders.

Hi, Is there a way to achieve this (OpenGL 2.1)? If I draw lines like this glShadeModel(GL_FLAT); glBegin(GL_LINES); glColor3f(1.0, 1.0, 0.0); glVertex3fv(bottomLeft); glVertex3fv(topRight); glColor3f(1.0, 0.0, 0.0); glVertex3fv(topRight); glVertex3fv(topLeft); . . (draw a square) . . glEnd(); I get the desired...