opengl

convert camera position

I have a function from an external lib which takes the following camera parameters: x,y,z coordinates for "center of orbit" x,y,z vector from "center of orbit" to "camera direction" orbital radius camera roll How can I calculate these parameters from the ones I got: position vector view vector zoom min/max rotation angle decline an...

Porting an opengl app to browsers

What is the most common way to port an application so it can run on browsers? I've always thought that you need to make an ActiveX component for this, but when I saw cooliris (cooliris.com), it seems that there must be a better way to do this. Does anyone know? ...

Optimizing this OpenGL rendering algorithm

My game draws a series of cubes from a VBO, and just translates to the cube's position each time: ... SetCameraMatrix(); SetFrustum(); //start vbo rendering glEnableClientState(GL_VERTEX_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 1); glVertexPointer(3, GL_FLOAT, 0, 0); glColor3f(1,0.5,0); for(int i = 0...

.3ds with JOGL?

I would like to use .3ds models with JOGL. How can I do this? How can I import other file formats, like .max or .obj? Thanks. I'm new to OpenGL and JOGL. ...

draw over opengl/D3D with GDI?

I'm wondering if it's possible to draw over an opengl/direct3D surface with GDI? and if so, how might it be done? The reason I ask is because I'm writing a simple app to draw a few things in games. Such things would all be 2D or text such as framerate info, custom crosshair, clock, etc. I know the best way is to hook in and use whateve...

Is it correct to attach Frame Buffer Object to a 3D texture with 8-bit internal format

Basically, my program uses frame buffer object to render to a 3D texture. If the 3D texture which I attach to fbo is in GL_RGB8 format, which is 24 bits per texel, there is no problem. Only 8-bits of them are used. The problem happens when I try to use GL_ALPHA8 (8 bits per texel) as the internal format for the 3D texture, the rendering...

What is the point of GLSL when there is OpenCL?

Consider this the complete form of the question in the title: Since OpenCL may be the common standard for serious GPU programming in the future (among other devices programming), why not when programming for OpenGL - in a future-proof way - utilize all GPU operations on OpenCL? That way you get the advantages of GLSL, without its program...

C++: Is deleting an array stored as static local variable needed, and how?

I have a few arrays and a resource that needs deletion, the value of these variables are retained throughout the lifetime of the program and they are only used in a single function so it naturally fits into static variables: void func() { static GLfloat arrs[4] = {1, 1, 1, 1}; static GLUquadric* quad = gluNewQuadric(); // delete...

Wrapping a number?

I have this float which is a rotation angle. Camera.roty += (float) diffx * 0.2; where diff is the change in mouse position. In OpenGL it will wrap it if it exceeds 360 or is below 0, but how could I do this if I want to verify if the angle is between 0 and 180? Thanks ...

OpenGL texture tiling with texture matrix.

Hey guys, I know you can do texture tiling in OpenGL by setting the texture coordinates to something like 2.0 but is there a way I can do texture tiling with OpenGL texture matrix? ...

Z ordering geometry

I'm making a game that is entirely made of cubes. I notice that when I walk forward it runs lightening fast, but if I rotate the player in the opposite direction, its cripplingly slow. So what I did is ordered based on angle, but I still get some angles that are a bit slow. Here is how I did it: I basically reverse iterate in certain an...

Avoiding glBindTexture() calls?

My game renders lots of cubes which randomly have 1 of 12 textures. I already Z order the geometry so therefore I cant just render all the cubes with texture1 then 2 then 3 etc... because that would defeat z ordering. I already keep track of the previous texture and in they are == then I do not call glbindtexture, but its still way too m...

Does GLSL utilize SLI? Does OpenCL? What is better, GLSL or OpenCL for multiple GPUs?

To what extend does OpenGL's GLSL utilize SLI setups? Is it utilized at all at the point of execution or only for end rendering? Similarly, I know that OpenCL is alien to SLI but assuming one has several GPUs, how does it compare to GLSL in multiprocessing? Since it might depend on the application, e.g. common transformation, or ray tr...

Load a .obj file with Java3D and use it in JOGL?

I'm using Java3D and JOGL, but I'm having a hard time figuring out how to do this by looking at the javadocs. I want to load a .obj file (other formats would be nice, too) and render it using JOGL. Here's a loader class. It returns a Scene from a filename. How can I use this Scene in JOGL? Thanks. I'm new to JOGL and Java3D. ...

How to adapt DirectX-style world/view/projection matrices to OpenGL?

I have an application which uses DirectX, and hence a left-handed world-coordinate systen, a view which looks down positive z and a projection which projects into the unit cube but with z from 0..1. I'm porting this application to OpenGL, and OpenGL has a different coordinate system etc. In particular, it's right-handed, the view looks ...

What is the esaiest way to get rounded opengl cubes

Always in the context of a Rubik's cube app in Java/Opengl with lwjgl, i want to improve my drawing (http://manuelselva.files.wordpress.com/2010/09/cube.gif) in order to have rounded edges for each one of the 27 small cube ? What i would like to acheive at the end is the same as the wikipedia cube picture: http://fr.wikipedia.org/wiki/Fi...

How can I compute the picking ray with multiple model view matrixes?

I'd like to compute the intersection between a ray and the models the user sees on the screen of my app. I'm following the OpenGL guide but I have many models in the scene that I draw independently and dynamically in a push-pop context applying a translate to the current modelview matrix (ie for each model I do a glPushMatrix, glTrans...

OpenGL Smooth Polygon

I am trying to make this a smooth polygon using OpenGL, but it is not doing anything. Can someone please explain what I am doing wrong? glColor4ub(r, g, b, a); glEnable(GL_POLYGON_SMOOTH); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); glBegin(GL_QUADS); glVertex2i(x, y); glVertex2i(x1, y1); glVertex2i(x2, y2); ...

OpenGL DirectX "Abstraction Layer"

Hey guys, I was reading about creating abstraction layers to make it easy to switch between platforms. They did not go into much detail but here is what I got out if it. Is it just something like this? void pushMatrix(){ if (directx){ // do directx function }else if (opengl){ // do opengl function } } Is this how it ...

OpenGL: Model not displaying correctly. (Need to fix draw distance?)

I'm new to OpenGL. I'm playing around with JOGL. I have a .obj model that I'm drawing as polygons. It looks ok, except that most of it gets clipped. So I think that I need to increase the draw distance. I'm not really sure how to do it. Here is my render code: private void render(GLAutoDrawable drawable) { GL2 gl = drawable.ge...