opengl

OpenGL GLSL interpolation

Hi I try to implement point lights in OpenGL with GLSL. I send all the required data to the shaders. For simplicity I only use the diffuse light here. My example shows a huge triangle which I want to illuminate with a single light source. The light source is shown as a small blue triangle. For diffuse light I need to know the angle be...

Obtaining the camera rotation in radians on the X, Y, and Z axis in OpenGL?

Hi, I'm trying to obtain the camera rotation on various axis in OpenGL (but using Java, LWJGL, and jME specifically). The camera object allows me to get the direction as a Vector3f, but this doesn't seem to work to get the componentised rotation; each axis appears tied to another axis. I found that toAngleAxis with the angle component wi...

What is the best way to change the color "pixel by pixel" on iPhone?

Hi, I have a game which is an iPhone adaptation of this game. Here my ship makes paths and then the enclosed path gets filled if there is no enemy present in that enclosed area. I have taken the playField as a 2D array (int playField[300][300]). When the color of the enclosed path needs to be changed to show that it is filled, the p...

Interpolating two textures by a third texture (factor is in lightness, not alpha)

How can I efficently interpolate per-pixel two textures A and B by a dynamic texture C and draw them on a simple quad? Multi-pass algorithms accepted. I've had moderate success calculating the C texture per-frame on the CPU and uploading it with glTexImage2D into an alpha-only texture. While this worked, performance was lacking and I h...

How are depth values resolved in OpenGL textures when multisampling?

I'm using an FBO to render my scene to a depth texture (GL_DEPTH_COMPONENT). When I enable multisampling in my application, those samples are resolved to a single texel, but how are they combined? Is the depth of the nearest sample stored to the texture, or the average of the samples? Is this behavior vendor-dependent? ...

How to remove black background from textures in OpenGL

Hi, I'm looking for a way to remove the background of a 24bit bitmap, while keeping the main image totally opaque, up until now blending has served the purpose but now I need to keep the main bit opaque. I've searched on Google but found nothing helpful, I think I'm probably searching for the wrong terms though, so any help would be gre...

permission denied running my own program (ubuntu)

Not exactly programming related... I've built the program, some basic opengl, then run it and sh: /blabla permission denied. How can I make that dissaper? the program just makes a rotating square and I have ubuntu 9.4 just found out that even int main(){} doesn't work ...

C++/OpenGL - Rotating a rectangle

Hi, For my project i needed to rotate a rectangle. I thought, that would be easy but i'm getting an unpredictable behavior when running it.. Here is the code: glPushMatrix(); glRotatef(30.0f, 0.0f, 0.0f, 1.0f); glTranslatef(vec_vehicle_position_.x, vec_vehicle_position_.y, 0); glEnable(GL_TEXTURE_2D); glEnable(GL_B...

Using GDB in xcode 3.1.2 - what does 'error while running hook_stop:' mean?

Pretty much a total newbie here, using xcode to write a c++ program. I don't know how to use gdb yet and I'm not sure how you can turn it off..(if you can?) Just added some openGL texture loading code and when I call it I get this error message in my console and the program freezes... what is happening? Here's the code that throws the...

Scientific Visualization with OpenGL and QT

I am trying to write an OpenGL visualization program for some scientific data using qt. I would like to be able to use my existing program unchanged and simply be able to call the glwidget and tell it to update the data at the end of each time step. However in order to run a qt program it appears you have to use QApplication and then qt...

NSArray to C array

can we convert NSArray to c array. if not what alternatives are there.[suppose i need to feed the c array in opengl functions where the c array contains vertex pointer read from plist files] ...

OpenGL v2.0 Shaders with Dev-C++ and SDL?

I was about to rebuild my library in Dev-C++, under Windows; however, the shader functionality I've added in the meantime is not supported, the compiler could not find the related functions (::glCreateShader(), ::glCreateProgram(), etc.) Digging around the internet and the Dev-C++ folder, I've found that the OpenGL implementation (gl.h)...

Build errors w/ GLee (GL Easy Extension Library)

Using Code::Blocks w/ mingw, and trying to use GLee for some OpenGL on windows. I'm getting the following build errors: GLee.c|60|undefined reference to `_wglGetProcAddress@4' GLee.c|10748|undefined reference to `_wglGetProcAddress@4' GLee.c|10751|undefined reference to `_wglGetCurrentDC@0' GLee.c|10797|undefined reference to `_glGetStr...

OpenGL L-System Rendering

Hey guys, i have gotten my basic L-System working and i decided to try and optimize the rendering of the application. Previous i was looping through the whole string of the L-System with a switch case and drawing...better yet i will show you what i was doing. for(unsigned int stringLoop = 0; stringLoop < _buildString.length(); stringLoo...

Can this type of wiggle image deformation be done on iPhone without using openGL

I have a straight image and I want to deform it in a wave-like manner. Original image: and I want it to look like this (except animated): I haven't tackled the learning curve of openGL yet so if I can do this with Core Animation it would be great. Is this possible? ...

Displaying SVG in OpenGL without intermediate raster

I have some simple SVG artwork (icon and glyph kind of things) which I want to display in an OpenGL app (developing in C++ on Debian, using Qt). The obvious solution is to use the ImageMagick libs to convert the SVGs to raster images and texture map them onto some suitable polygons (or just use good old glDrawPixels). However, I'm wond...

Drawing hermite curves in OpenGL

Hi, I am a beginner, started learning openGL from the Red book since last week. i have a question regarding Hermite curves, how can I draw Hermite curves using OpenGL, are there any built in functions? I saw some examples on line that show how to use evaluators to draw bezier curves but could not find any information for Hermite curves....

Opengl Selection Buffer

Hi, I'm using opengl's selection buffer, but i'm experiencing a trouble, the "picking" works perfectly if you hit the element for the first time, but the second time you hit it, it won't get selected, instead the element selected is an arbitrary one on the model. Any hints on this? Is it a bug or am I doing something wrong? ...

I need to calculate the edges of visible space from current OpenGL state

In OpenGL in Delphi, I am attempting to calculate how much of a scene is viewable by finding the left, right, top and bottom extents of the viewing area in an orthographic projection. This will make some mouse interactions seem to be 1-to-1. I don't have much access to the code that sets up the orthographic projection matrix, but I kno...

OpenGL light flickering when I update its position each frame

I am learning OpenGL and just started getting into lighting. I enable lighting and light 0, set its ambient/diffuse/specular to default values in my init method, and then each frame I do something like this: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // do my 3rd-person camera transforms and rotations glLightfv(GL_LIGHT0, GL_POSITION...