opengl

What happens to pixels after passing them into glTexImage2D()?

If for example I create an array of pixels, like so: int *getPixels() { int *pixels = new int[10]; pixels[0] = 1; pixels[1] = 0; pixels[1] = 1; // etc... } glTexImage2D(..., getPixels()); Does glTexImage2D use that reference or copy the pixels into it's own memory? If the answer is the former, then should I do th...

Java applets with hardware accelerated 3D graphics? OpenGL and/orDirectX

I can't find a clear answer to this question with all my googling. If I want a web applet, is there a library in Java that takes advantage of the hardware accelerated graphics drivers on the client's machine, as in OpenGL and directx? I'm picturing writing some driver detection code before the applet launches to detect 3D graphics capa...

Update OpenGL libraries on windows

Hi, I'm using a 3rd party DLL which uses OpenGL. Right now that 3rd party does not work correctly as the display does not refresh correctly. I came to suspect that the OpenGL library isn't correctly installed or may be outdated. Is there a way to update the OpenGL library on windows? Is there like an official site which will hold the c...

Handle Tab key in GLUT

Hi everyone! I use OpenGL+GLUT for simple application, but I can't handle a "Tab" key press. Does anybody knows how to handle pressing of Tab key ? thanx P.S.:Mac OS 10.5.6, GCC 4.0 Solution void processNormalKeys(unsigned char key, int x, int y){ if ((int)key == 9) { //tab pressed .... } .... } .... int ma...

What is a good way to load textures dynamically in OpenGL?

Currently I am loading an image in to memory on a 2nd thread, and then during the display loop (if there is a texture load required), load the texture. I discovered that I could not load the texture on the 2nd thread because OpenGL didn't like that; perhaps this is possible but I did something wrong - so please correct me if this is act...

Marching Cube Question

i currently writing a program to implement Marching Cube using C++ and Opengl. However, my best reference is only from http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/ in the web, the provided codes are written in C. my problem here is that i don't understand the triTable and edgeTable and how they are related. can anyone h...

Xcode project setup for GLFW library reference problem.

Hi, I'm working on an assignment which is to simulate the beginning of the universe using C and OpenGL/GLFW. I'm pretty new to C and also to Xcode, which is not helping at all. I've overcome my silly compilation problems and the code is finding GL/glfw.h ok. When I compile and run I receive a "Visualisation [name of the project] has ...

OpenGL primitives too dark when multitexturing?

I'm having a problem getting accurate primitive colours when I'm using multi-texturing elsewhere in the scene. Basically, I have some lines and polygons that I am trying render over a video texture (I'm using 3 stage multitexturing to create the video texture)... Anyhow, I know the problem is not alpha related... In fact, I know that in ...

3d draw, setting perspective point, setting view point!!

I need to draw 3d projections and i am using opengl wrapper for JAVA. Problem: - how to set view point in java opengl (for examle i want to my program to draw object on screen like i am looking at that object from (0,0,0) ) - how to set perspective point(point in 3d where look is heading to, for example i want may progra...

Problem implementing Marching Cube Algorithm.

From My last question: Marching Cube Question AndreasT has explained to me how the triTable and edgeTable works. I really can't thank him enough. However, i am still unclear as in: how to create imaginary cube/voxel to check if a vertex is below the isosurface? how do i know which vertex is below the isosurface? how does each cube/vo...

How to make swoosh graphic/sound effect?

I have a UIImageView that can be dragged around with a finger. It is sized to an image in it, such as a ball or square. If the user accelerates very quicker, I'd like to trail the object with a blur of itself to give the appearance of going fast. Like what happens with warp speed. I also have a swoosh sound. I'd like the sound to l...

How can I make my mouse control the camera like a FPS using OpenGL/SDL?

I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so I can "strafe" left and right using 'a' and 's' and move forward and backward using 's' and 'w'. However, I would like to now make it so I can control the direction my camera is "looking" based off my mouse movements. Just like in a FPS shooter when...

How can I change the position of the mouse cursor in OpenGL/Glut?

I'm writing a simple game and I'm going to have the mouse control the camera (using GlutPassiveMotionFunc). I'm going to pitch and yaw based off the mouse difference between callbacks, however I think it would be a good idea to "force" the mouse back to the center of the screen every time they tried to move it. This way their cursor wo...

How could simply calling Pitch() and Yaw() cause the camera to eventually Roll()?

I'm coding a basic OpenGL game and I've got some code that handles the mouse in terms of moving the camera. I'm using the following method: int windowWidth = 640; int windowHeight = 480; int oldMouseX = -1; int oldMouseY = -1; void mousePassiveHandler(int x, int y) { int snapThreshold = 50; if (oldMouseX != -1 && oldMouseY !...

OpenGL rotate around a spot

Hi, I'm wanting to rotate a gluSphere around a fixed point in a circular motion, like a planet going around the sun. Would it be best to use glRotatef or glTranslate? Cheers! ...

Can someone explain how I can use Quanternions to use the mouse to look around like a FPS?

Yesterday I asked: How could simply calling Pitch and Yaw cause the camera to roll? Basically, I found out because of "Gimbal Lock" that if you pitch + yaw you will inevitably produce a rolling effect. For more information you can read that question. I'm trying to stop this from happening. When you look around in a normal FPS shooter ...

OpenGL Color Matrix

How do I get the OpenGL color matrix transforms working? I've modified a sample program that just draws a triangle, and added some color matrix code to see if I can change the colors of the triangle but it doesn't seem to work. static float theta = 0.0f; glClearColor( 1.0f, 1.0f, 1.0f, 1.0f ); glClearDepth(1.0); glClear( GL_COLOR_B...

Visual Studio 2008 with Vista, GLUT projects gives error on runtime

I'm sure that there is nothing wrong with my project. Because I have tried it on my ex computer with visual studio 2005 and windows xp pro, and it works error-free. I can compile my project. There is no errors on build phase.But when I try to run my project it says "*.exe has stopped working". Then I runned it on debugger mode. I saw t...

Java jogl applet paint not working?

My jogl applet screen is blank. I have this for my paint code: public void paint(Graphics g){ canvas.update(g); } if I add g.fillRect(0,0,50,50); to it it'll draw the filled rect, but still not the jogl stuff. ...

OpenGL: glTexImage2D conflicts with glGenLists & glCallList ?

Hi, I have a simple OpenGL application where I have 2 objects displayed on screen: 1) particle system, where each particle is texture mapped with glTexImage2D() call. In the drawEvent function, I draw it as a GL_TRIANGLE_STRIP with 4 glVertex3f. 2) a 3D text loaded from an object file, where each point is loaded using glNewList/glGenLi...