opengl

Suggested framework for generic 3D demo software

Hi everyone, My company has decided that we need a "generic" demo infrastructure for our technology demos, given that I can write this using JOGL or OpenGL and create my own framework, I'd hate to reinvent the wheel. But there are so many 3D gfx engines out there and so many OpenGL wrappers! Basically, we want to use 3D graphics to re...

Inaccurate Mouse Coordinates Returned

The issue is that the further the mouse click is from the top left origin (0,0) the greater the height inaccuracy when the vertex is plotted. Any ideas? int WindowWidth = 19; int WindowHeight = 13; int mouseClickCount = 0; int rectPlotted; GLint x1; GLint y1; GLint x2; GLint y2; //Declare our functions with prototypes: void display(voi...

3d Accelerometer calculate the orientation

Hi, I have accelerometer values for the 3 axis(usually when there is only gravity contains data between -1.0 and 1.0 ): float Rx; float Ry; float Rz; I make soma calculations, then I get the angles for each axis. float R = sqrt(pow(Rx,2)+pow(Ry,2)+pow(Rz,2)); float Arx = acos(Rx/R)*180/M_PI; float Ary = acos(Ry/R)*180/M...

OpenGL: Convention for which axis is "up"?

I'm new to OpenGL. It appears that I can make whatever axis be "up" that I want. However, what is idiomatic/conventional? ...

OpenGL: How to undo scaling?

I'm new to OpenGL. I'm using JOGL. I have a WorldEntity class that represents a thing that can be rendered. It has attributes like position and size. To render, I've been using this method: /** * Renders the object in the world. */ public void render() { gl.glTranslatef(getPosition().x, getPosition().y, getPos...

Poor opengl image processing performance

I'm trying to do some simple image processing using opengl. Since I couldn't find any good library that does this alrdy I've been trying to do my own solution. I simply want to compose a few images on the gpu and then read them back. However the performance of my implementation seems almost equal to what it takes do on the cpu... someth...

Getting Face-Vertex meshes (vertxes and indexes arrays) from a 3D file format

I want to import a 3D model into a program that uses open GL. I will use glDrawElements() so I am going to need the vertexes and indexes arrays. The model is originally saved in a sldprt file extension but I don't think it will be hard to change it into another file format. Anyway, I want to know what the simplest 3D file format is. An...

3D Graphics: How to think about a model's position

I'm new to graphics. I'm experimenting with OpenGL / JOGL. I have a .obj file that I'm rendering. I'm having difficulty placing it exactly where I want it in the world. I have a plane that I want it to rest on, taking into account the model's runtime-set size. Just doing a transformation isn't quite enough, because I need to take into ...

What is the point of the matrix stack in OpenGL?

Why would I use OpenGL's matrix stack (as opposed to wrapping my own matrix class and just using that)? I'm not really sure why it is so complicated for such a simple task. Is there's some special use case for it? If it isn't necessary, what's a good replacement for it? ...

Simple OpenGL code always causes a segmentation fault (C++ on Ubuntu, virtual machine)

I just started trying to use OpenGL in C++ for a class(I have previously used it in Java a fair amount). And I started off trying to write something substantial, I couldn't get that to stop Seg faulting so I wrote this piddly little piece of code which is nearly a line for line copy from an example in the first chapter of the red book. ...

How can I efficiently draw thousands of particles? (C++ / OpenGL)

I'm currently writing an interactive simulator which displays the evolution of a system of particles. I'm developing on Windows 7 32-bit, using Visual Studio. Currently, I have a function to draw all the particles on screen that looks something like this: void Simulator::draw() { glColor4f(255, 255, 255, 0); glBegin(); for ...

what packages do I need to install on Ubuntu to get ruby-opengl to compile?

I am trying to use the ruby-opengl package, when I install it the compliler complains that it cannot find the correct header files. What Ubuntu packages (9.10) do I need to make this work? ...

Threads for peer to peer communication

I am trying to make a multi-player network game. Each player is represented by a rectangle on the screen. I am using OpenGL for the graphics and also the user input (commands like MOVE-LEFT, MOVE-RIGHT etc ) will be handled by it (or GLUT or sumthing). I have the following architecture for the game. There are 4 players(nodes) in the g...

Can't include <gl/gl.h>

I'm using Visual Studio 2010. I'm trying to write simple Camera class in OpenGL. I need to include gl/gl.h in Camera.h gl/gl.h is already included in main.cpp and Camera.h is included in main.cpp When I put #include <gl/gl.h> in Camera.h i got bunch of errors likr this one: Error 11 error C2086: 'int APIENTRY' : redefinition ...

XNA glColor equivalent

I come from the land of OpenGL, so I'm similar with glColor functions, and how they work with the textures that get outputed using the default GL blending methods. I can't seem to get GraphicsDevice.BlendFactor to work as glColor does, but I may not be using the right blending settings. Without using shaders is it possible to get the e...

OpenGL and XNA Matrix differences

XNA has the following Matrix objects under BasicEffect public Matrix World public Matrix View public Matrix Projection OpenGL uses the following defines for glMatrixMode() GL_MODELVIEW GL_PROJECTION I'm not really sure why one would have more than the other, to be honest. I'm porting a GL game over, and it would be nice if I could...

Does glSubTexImage block?

Hi everyone! This is a question about syncronization in OpenGL. And the question is: At which point in the following (pseudo) code sample does syncronization happen. // 1. try to map buffer object (write only and invalidate buffer) copy new data to mapped buffer unmap buffer // 2. bind buffer call subteximage to fill texture f...

Mipmaps+PBO: strange issues

Hello guys, I'm using PBOs to load textures faster in my application. If I use an opengl 3 or better video card I can then easily build the mipmaps with a call to glGenerateMipmap and it works fine. But on my older opengl 2.1 card (radeon x800), that function is not available so i must use one of two legacy methods: glTexParameteri(GL_T...

How to write configure.ac and Makefile.am for freeglut?

I want to use freeglut for my project. In my configure.ac it looks like this, it worked like this for SDL so I just replaced some potions and hoped it works for freeglut as well but it does not. So what am I doing wrong? # Check for freeglut PKG_CHECK_MODULES([FREEGLUT], [freeglut >= 3.0]) AC_SUBST(FREEGLUT_CFLAGS) AC_SUBST(FREEGLUT_LI...

OpenGL blend problem

I want to draw aquarium (container) standing on table. Walls of aquarium need to be blended. But, if I draw table first and then aquarium I get: - looking from the up of the table: ok - looking from the bottom of the table: wrong, I still see aquarium If I draw aquariun first and then table I get: - looking from the up of the table: ...