opengl

Resource for understanding view, projection, 'virtual camera' in OpenGL or graphics in general

I noticed most resources either assume you know a lot already or assume you know math of professional level or assume you're going to find other resources to fill gaps. Is there a resource that takes someone without already a knowledge on view matrices in graphics and takes them to understanding fully how to set up a 'virtual camera' ...

GLSL Shaders Attributes as ints

Hello, I'm just learning OpenGL and I'm running into some issues. I'm using OpenGL 3.0 and GLSL 1.2. I have an array of matrices which I would like to selectively apply to different vertices. Instead of copying a matrix each time I want to indicate an index, I would instead like to pass in an integer as an index and use that integer...

How to 'bind' a element buffer array to vertex array object using direct state access?

Hi everyone! The title says it all. For the other buffers there are functions like: glVertexArrayVertexAttribOffsetEXT( this->handle, // vao handle vbo.getHandle(), // vbo handle index, // specifies the index of the generic vertex attribute to be modified. size, ...

OpenGL stencil buffer OR operation?

I'm not sure if this is possible to do, but it's worth a shot. I'm using the stencil buffer to reduce overdraw for light volumes in a deferred renderer using this algorithm (when the camera is outside the volume): Using a cheap shader, draw back faces with depth testing set to LEQUAL, marking them in the stencil buffer. Using the expen...

OpenGL: How to get GPU usage percent?

Is this even possible? ...

Graphics: .obj files and materials/textures

I am new to OpenGL / JOGL. I am able to hardcore a texture onto a polygon, and I am correctly drawing polygons specified in .obj files. I now want to draw the materials/textures specified in those .obj files, but I'm not quite sure what to do. For example, I downloaded this gazebo. The download contains a single .obj file. From that fil...

Problems with an unusual NSOpenGLView setup

Hi, This is a bit long, so feel free to skip to the numbered parts if you want to avoid the lengthy intro. I'm trying to set a subclassed NSOpenGLView in an unusual way and I am running into some problems. Basically, I am writing a program to perform a bioengineering simulation for my PhD and I need to be able to compile it under both ...

OpenGL: Create a sky box?

I'm new to OpenGL. I'm using JOGL. I would like to create a sky for my world that I can texture with clouds or stars. I'm not sure what the best way to do this is. My first instinct is to make a really big sphere with quadric orientation GLU_INSIDE, and texture that. Is there a better way? ...

OpenGL: Am I texturing this wrong?

I am new to OpenGL. I am using JOGL. I downloaded this model. It has a bunch of textures. I'm trying to apply "truck_color-blue.jpg" here, but I'm not sure I'm doing it right. This is what I'm seeing: Essentially, what I am doing is recording all the vt, v, and vn entries, then using the f lines to index into them. This is the code t...

Occlusion with octrees

I just started learning opengl and writing a first person shooter but I'm getting horrible framerates when I draw 5000 cubes. So now I'm attempting to perform occlusion and culling using an octree. What I'm confused about is where to cast the rays from. Do I only cast them from the fustrum near plane? It seems like I would miss part ...

Memory Efficient implementation of corner point grids in Java3D/OpenGL

Say I have NX*NY*NZ cells in a corner-point-grid. I have also a mask of NX*NY*NZ booleans that gives me which cells of the grid I have to draw. I would like to create an efficient indexed quad array in Java3D (or OpenGL, it does not matter at the end, since the concepts below are the same) using less memory as possible. For sake of sim...

How to get Screen coordinates from a 3D Point? Opengl

Hi, I've seen alot of Screen-Coordinate to world coordinate posts, but have not seen the opposite. Is there an easy way of getting screen coordinates from a 3d point, from any angle I view it from? I'm using C++ and opengl ...

Can someone describe the algorithm used by Ken Silverman's Voxlap engine?

From what I gathered he used sparse voxel octrees and raycasting. It doesn't seem like he used opengl or direct3d and when I look at the game Voxelstein it appears that miniature cubes are actually being drawn instead of just a bunch of 2d square. Which caught me off guard I'm not sure how he is doing that without opengl or direct3d. ...

OpenGL: Materials with Display Lists?

I am using JOGL with OpenGL. I'm drawing everything through display lists. I'm trying to figure out how to specify materials. I've been looking at this documentation. The following looks pretty straightforward: glPushMatrix(); glTranslatef (-1.25, 3.0, 0.0); glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); glMaterialfv(GL_FRONT,...

What is the most efficient way to draw voxels (cubes) in opengl?

I would like to draw voxels by using opengl but it doesn't seem like it is supported. I made a cube drawing function that had 24 vertices (4 vertices per face) but it drops the frame rate when you draw 2500 cubes. I was hoping there was a better way. Ideally I would just like to send a position, edge size, and color to the graphics ca...

OpenGL Buffer Object internal workings?

I've started to use Pixel Buffer Objects and while I understand how to use them and the gist of what they're doing, I really don't know what's going on under the hood. I'm aware that the OpenGL spec allows for leeway in regards to the exact implementation, but that's still beyond me. So far as I understand, the Buffer Object typically r...

How to draw multiple objects using a VBO and a single OpenGL drawelements call?

I've read that it is possible to draw multiple objects using a vbo and using single drawelements call. I haven't found any examples of this. Right now I'm making a drawelements call per cube drawn which is killing my frame rate since I'm making the entire game out of them. Any help is appreciated, especially example code. ...

How do I display/draw a .ply object in OpenGL?

I'm trying to make OpenGL draw the figure that I'm loading with OPENFILENAME. What I've got right now is: I can display the comments, vertex, how many faces, etc., but I cannot draw the figure and I'm not sure how to do it. I can draw other predetermined figures, but not the ones I'm trying to open. This is where I'm initializing ever...

How to apply a normal map in OpenGL?

I'm learning to use normal maps (per pixel lighting?) in 2D graphics with OpenGL. New to normal mapping, I managed to wrap my head around the Sobel operator and the generation of normal maps (mostly thanks to this), that is creating a (2D) array of normals from a (2D) array of pixel data. (Most of the tutorials and forum threads that I...

OpenGL: Turn off all lighting except what I specify?

I'm new to OpenGL/JOGL. I'm experimenting with lighting: gl.glEnable(GL2.GL_LIGHT1); gl.glEnable(GL2.GL_LIGHTING); When I disable the first line, all the objects in my scene get somewhat dark, but they still have some light. Where else could that light be coming from? (This is the only light source I have.) Is there some defau...