opengl

Can't correctly rotate cylinder in openGL to desired position

I've got a little objective-c utility program that renders a convex hull. (This is to troubleshoot a bug in another program that calculates the convex hull in preparation for spatial statistical analysis). I'm trying to render a set of triangles, each with an outward-pointing vector. I can get the triangles without problems, but the v...

WPF as OpenGL texture

Hi, I'm working on a simulator which relies on OpenGL to display symbols, maps, moving items... as layers/textures. We are investigating different options to introduce multitouch support in the simulator. WPF is one of the options, as it could provide interesting productivity factors for GUI development. A prototype has been built but...

Help with camera in OpenGL

Right now my application rotates on camera.rotationX, Y Z and does a -translation of camera.x,y,z on the modelview matrix. How could I equivocate this to a call to gluLookAt? Thanks basically how could I get this: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //starts here glRotatef(Camera.rotx,1,0,0); glRotatef(...

SDK for in-game overlays

What little information I managed to dig out on developing in-game overlays (similar to what Steam does) mentions having to intercept calls graphics API's frame swapping function, and hook my own drawing routine in it. This appears to be what Mumble (a gaming VoIP) is doing. Since I've never done anything that involves hooking, and sinc...

How to detect in glsl if fragment is multisampled?

Is there any fast(for performance) way to detect in glsl if fragment has been multisampled, but in second(light) pass using textures where been 1st pass rendered. Or how is opengl storing informations about multisampling? ...

Java OpenGL blending image colors

I'm trying to blend 2 images together in the following way: Image 1 should be drawn as the base image. Image 2 should be drawn overtop of image 1. Anywhere image 2 is non-transparent, it should replace the contents of image 1 (not blend, but overwrite what is there). Wherever image 2 is transparent, image 1 should show through. I've tri...

Optimizing SphereInFrustrum check

I have this SphereInFrustrum function here: 0.49% int FrustumG::sphereInFrustum(Vec3 &p, float radius) { int result = INSIDE; float distance; 2.40% for(int i=0; i < 6; i++) { 7.94% distance = pl[i].distance(p); 12.21% if (distance < -radius) 0.67% return OUTSIDE; 3.67% else if (distance < ...

Adding distant fog with OpenGL?

I', using GL_FOG, but it really only fogs up my geometry, I would like a way for the fog to feel like it encumbers an area, not just fog up my geometry, sort of like a box of fog... Is there a way to do this? Or possibly another way to give a smooth draw distance transition? Thanks ...

Help with this issue

Here is my issue. I'm rendering axis alligned cubes that are all the same size. I created an algorithm that rendered around the player like this: ****** ****** ***p** ****** ****** While this does work, the player does not see this whole radius. I know the player's rotation angle on the Y, so I was hoping to modify my algorithm based ...

is VertexAttribPointer needed after each BindBuffer?

I noticed that unless I re-call VertexAttribPointer, there's not input to shaders after a BindBuffer. Is that necessary? The shaders may not change in writing but only the buffers used. ...

Problem using Eigen math library with opengl

Hi everybody, I'm currently trying to use Eigen math library with Opengl. I've some typedefs for Vector3f from Eigen, say Vec3, so that I can use it as a coord for my vertices. I also have a structure for a vertex with coord (vec3), normal (vec3) and color(vec4). When I try to use vertex arrays (I'll use VBOs once I make vertex arrays wo...

Ray tracing in modern OpenGL. Where do I begin?

So I'm at a point that I should begin lighting my flatly colored models. The test application is a test case for the implementation of only latest methods so I realized that ideally it should be implementing ray tracing (since theoretically, it might be ideal for real time graphics in a few years). But where do I start? Assume I have n...

Drawing a cube with GlDrawElements()?

Is there a way to draw a cube like this and as a result, only upload 8 verticies and 24 indicies to the graphics card? If so how could this be done? Thanks I currently do it like this: boxdims.x = w; boxdims.y = h; boxdims.z = d; center = c; GLfloat vboverticies[72]; GLfloat vbonormals[18]; Vertex3f verticies[...

Object under mouse?

My little game engine basically has a 3D array Cubes[x][y][z] (its actually a big 1D array but I'v done some overloading). I know which cube in X Y Z that the player is standing on. The player will be able to shoot a cube to destroy it which is why I need to figure out how to find the Cube that the mouse is under. I found some OpenGL doc...

OpenGL repeating texture causes anomalies when rotated

I have a texture being drawn to a quad. The texture is the repeating pattern in the top-left corner of this screenshot: http://img828.imageshack.us/img828/3305/blahpv.png The opengl texture is only 3px by 9px and the texture coordinates I'm passing are very large numbers and it loops over the 3x9 texture by using GL_REPEAT. Any explanati...

Cg and OpenGL 3

Hi, I'm currently learning the differences between OpenGL 2 and 3, and I noticed that many functions like glVertex, glVertexPointer, glColor, glColorPointer, etc. have disappeared. I'm used to using Cg to handle shaders. For example I'd write this simple vertex shader: void main(in inPos : POSITION, out outPos : POSITION) { outPos...

Which has higher performance java or javascript?

Since now javascript gets compiled to machine code by browsers. I was wondering which programming language gets better performance between java and javascript. I'm thinking of writing a 3d browser FPS or MMO and am trying to decide between the two. Also what are thoughts on compatibility? It seems like with java and opengl I could ...

Bullet algorithm having trouble with rotation on the X

Here is what I'm trying to do. I'm trying to make a bullet out of the center of the screen. I have an x and y rotation angle. The problem is the Y (which is modified by rotation on the x) is really not working as intended. Here is what I have. float yrotrad, xrotrad; yrotrad = (Camera.roty / 180.0f * 3.141592654f); xrotrad = (...

What is the best way to rotate cube in Opengl

Hi all, after reading stackoverflow questions on the topic, I am not able to find a solution. I have a Rubik's cube displayed using OpenGl in a Java Eclipse application and I want to "rotate" this cube in response to mouse events. I started with a "naive" (isn't it ?) solution as described here: http://stackoverflow.com/questions/14264...

Memory leak in a simple opengl program

Hi all, I've wrote a simple opengl program to make some test. Here is the program: #include <QApplication> #include <QGLWidget> #include <QTimer> #include <glut.h> class Ren : public QGLWidget { public: Ren() : QGLWidget() { timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); } void startUp...