opengl

How do you do nonlinear shading in OpenGL?

I am developing a visualization tool in OpenGL to visualize the output of a 3d finite element modeling application. The application uses a tetrahedral mesh (but I am only viewing the exterior facets, which are triangles). The output is a scalar variable, which I want to map to a color map (I already know how to do that). The tricky part ...

Trouble sharing textures with OpenGL/Cocoa

I am a bit of an openGL novice and I am trying to get texture sharing to work between two openGL views. I created two NSOpenGL view classes and then in the interface builder I created a window that had one of each openGL view. The first view has code in its prepareOpenGl that sets up the texture and assigns it to a global variable, the...

Pre Z buffer pass with OpenGL?

How exactly can I do a Z buffer prepass with openGL. I'v tried this: glcolormask(0,0,0,0); //disable color buffer //draw scene glcolormask(1,1,1,1); //reenable color buffer //draw scene //flip buffers But it doesn't work. after doing this I do not see anything. What is the better way to do this? Thanks ...

How do I make a 3D game in my spare time?

I'm looking for a new project to fill the evenings and I wish to make a 3d game. I have mediocre experience in Pascal,and VB but realise that neither of these may be best for the job. I realize I may have to spend some time reading some books and maybe learning a new language but I don't actually know what would be needed? Would learnin...

OpenGL DevIL c++ source code

After spending hours searching for a simple way to to add an image to an openGL application written in C++, i failed, miserably. It is also apparent that many others have too. I am fairly new to OpenGL, I have written my own win32 app with OpenGL using DevIL and you guessed it, i failed. The only way i could get DevIL to work was using ...

OpenGL 2D game question

I want to make a game with Worms-like destructible terrain in 2D, using OpenGL. What is the best approach for this? Draw pixel per pixel? (Uh, not good?) Have the world as a texture and manipulate it (is that possible?) Thanks in advance ...

Screen Projection and Culling united

Hi everyone! I am currently dealing with several thousand boxes that i'd like to project onto the screen to determinate their sizes and distances to the camera. My current approach is to get a sphere representing the box and project that using view and projection matrices and the viewport values. // PSEUDOCODE // project box center f...

OpenGl box fullscreen

I'd like to draw the inside of a box fullscreen (i.e. it should completely fill the viewport) using OpenGL. The box should have perspective. I presume I'll have to change the dimensions of the box depending on the viewport size but I'm not sure how to go about this. I'm trying to achieve something like the room in this image My questi...

OpenGL desktop application to iPhone

I want to develop OpenGL application for iPhone. However I don't like using iPhone simulator. Is it possible to create Cocoa desktop application and then just copy-paste drawing code to iPhone application? How different is coding OpenGL for iPhone and Cocoa? ...

Radius of projected Sphere

Hi again, i want to refine a previous question: How do i project a sphere onto the screen? (2) gives a simple solution: approximate radius on screen = world radius * cot(fov / 2) / Z with: fov = field of view angle Z = z distance from camera to sphere result is in clipspace, apply viewport to get size in pixels Now my problem ...

Sum image intensities in GPU

I have an application where I need take the average intensity of an image for around 1 million images. It "feels" like a job for a GPU fragment shader, but fragment shaders are for per-pixel local computations, while image averaging is a global operation. An image sum will suffice, since it only differs from the average by a constant...

OpenGL texture blending and translation

I've got two textures mapping to a surface, one is a checkerboard (the pattern on the floor) and one is a lightmap, both of which are blending and presenting just fine. What I'm having trouble with is making the lightmap texture translate prior to blending. I need to do this so I can simulate a flashlight scanning across the floor.... C...

how to do 2D animations in OpenGL?

how to move 2d objects around in opengl? what is the mechanism, e.g, do we need to control frames or what? some code segment is welcomed :) thanks in advance! ...

How to manage textures

Hello, I'm writing a simple 3D engine based on OpenGL (I know there are plenty of them out there but for some reasons I want to learn how to do this myself). I am pretty happy with my current approach of a scene graph and stuff like that but I'm very unhappy with texture handling. So I wonder how to do this properly. When I look at exa...

Does opengl render objects that are not in view?

For example if I draw a cube and turn my character around so as to face away from the cube does it use CPU/gpu processing to draw it even though it is not on screen? Do I as a programmer need to be smart enough to not make opengl draw calls if an object is not on screen or very far away? ...

QtOpenGL and MacOS X -- Software rendering?

I'm developing a cross-platform application and am not very familiar with the Mac platform. I use Qt for the GUI. I use a QGLWidget to make sure the drawing (with QPainter) is done in OpenGL. My project built fine in XCode and runs. However, drawing is slow as hell, in situations where on Windows and Linux machines speed is not an issue...

How do I change the Projection so it shows my object?

Hello, I have an 2D object (GL_QUAD) with size (W,H) and sitting at (-W*0.5, -H*0.5). I'd rather not resize the object, because I need to be able to select points on that object relative to the texture. (i.e. (x,y) in openGL translates to (x,y) on the texture - no scaling needed). What I want to do is change the camera properties (pro...

How do I get a precompiled binary for glu?

I have MinGW and MSys set up on a windows 7 machine, but the glu libraries that came with it are old, and dont support gluBuild3DMipmaps. I have searched everywhere for a precompiled glu library for MinGW that I can use, but I can't find anything... I can't even find documentation on how to build one. So where do I get the newest versio...

OpenGL CubeMap rendering from desktop instead of environment

This is weird, and I can't find anything like it online. I am rendering a reflective sphere in OpenGL, and I'm trying to reposition the camera and use glCopytexImage2D to render directly to the Cube Map textures. Problem is, my reflective sphere ends up reflecting everything on my desktop EXCEPT the OpenGL environment! How does something...

gl_LightSource[0].position.xyz in modern OpenGL

I'm a beginner. I noticed in old code // Calculate the light position for this vertex vec3 vertex_light_position = gl_LightSource[0].position.xyz; I assume that's dynamically changing and hence can't test it with simply a static vec3. How do I go with replacing the above in modern OpenGL? An example would be greatly appreciated. ...