opengl

Which book should I read to learn how to use OpenGL for game development?

I'm planning on learning some game development using OpenGL (I'm on Mac OS X and Ubuntu machines most of the time, so DirectX obviously won't do.) and I'd like to know which book would be best for learning OpenGL, and what version I should learn. I have good knowledge of various programming languages, including C/C++ and Objective-C, so...

Triangle is taking up whole window?

I am trying to draw a triangle using GL_POLYGON but for some reason it is taking the whole window.. ... typedef struct myTriangle { float tx; float ty; } myTriangle; std::vector<myTriangle> container; void display() { glClear(GL_COLOR_BUFFER_BIT); for(int i = 0; i < (int)container.size(); ++i) { glBegin(GL_POLYGON);...

Video as voxels in OpenGL

Hi any good references on displaying sequence of images from a video as voxel data in OpenGL? I want to display all these images at once as a cuboid with 50% alpha and navigate using keyboard or mouse. Any suggestions or references would be of great help. Thank you ...

Finding Pixel Color

I am trying to figure out how to extract the RGB value from the pixel chosen. Every time I click though, it gives me a value of 0, even though I am clicking on a colored triangle. void mouse(int button, int state, int x, int y) { if(state == GLUT_DOWN) { float mx = p2w_x(x); // pixel to world coordinates float my = p...

How to programm 3D in open gl

hello i want to program in open gl in 3D (have a special screen and glasses) what do i have to do for that? (options, code, ..?) thanks ...

Change color component

Hello, I'm writing graphic shader program. I wrote everything I need except the color changing. In cycle there is passing some counter variable to the shader and I have to change it's color from white to orange shade. What I have change to achive this? ...

How to copy CUDA generated PBO to Texture with Mipmapping

I'm trying to copy a PBO into a Texture with automipmapping enabled, but it seems only the top level texture is generated (in other words, no mipmapping is occuring). I'm building a PBO using //Generate a buffer ID called a PBO (Pixel Buffer Object) glGenBuffers(1, pbo); //Make this the current UNPACK buffer glBindBuffer(GL_PIXEL_UNPA...

Inverted-colors text on top of an OpenGL scene

Hello, I have a font texture which I use in order to draw text on top of my OpenGL scene. The problem is that the scene's colors vary so much that any solid color I use is hard to read. Is it possible to draw my font texture with inverted colors? A call to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); would just draw it with a sol...

How to prevent an OpenGL application from drawing?

Hello everybody! How can i prevent an external OpenGL application(no sources available) from drawing like it can be done by GDebugger? The problem is Dassault Catia that opens complex models within five(!) hours because they are rendered while the loading is in process. When the border of this application is clicked and the mouse bu...

Mono c# vs c++ in opengl game development?

Which of these languages is better for opengl game with primary platform linux? I would like if you compared them in performance and libraries support. ...

how to use glm's operator== in stl algorithms?

Hi everybody! Last question before the weekend ... i promise ... :) Title says it all: is it possible to use the operators defined in glm::gtx::comparison in stl algorithms? Specifically i have this code: std::vector<glm::ivec3> vecA, vecB; // vectors with content bool result = std::equal(vecA.begin(), vecA.end(), vecB.begin()); ...

Different size of Buffers for Vertex and Texture Coordinates?

Is there any way to use differently sized buffers for glDrawElements? I somehow want to map vertices to texture coordinates, so that the texture coordinate buffer is able to be actually smaller than the vertex buffer. Example: vertex buffer has 16 vertices and the texture coordinate buffer has 6 vertices. vertex_buffer[0] -> texture_co...

.obj file conversion to OpenGL model header file - indices and f parameters?

The OpenGL model header file I'm working with contains definitions along the following: static const float modelVertices[NUM_OBJECT_VERTEX * 3] = {} static const float modelTexCoords[NUM_OBJECT_VERTEX * 2] = {} static const float modelNormals[NUM_OBJECT_VERTEX * 3] = {} static const unsigned short modelIndices[NUM_OBJECT_INDEX] = {} ...

OpenGL save render for later use

This is a pretty beginner question, but given that I render a complex shape in OpenGL which requires a lot of calculations, is there anyway to export that to a state like a model that can be opened again later given you wont edit it again? I can't create them outside the program (with something like Blender) since the shape is computed ...

sdl app segfaults on sdl_gl_setattribute

Hi, I'm trying to compile this example and play around with it a bit. I've already corrected the main error the people were having with this example where they would call sdl_gl_setattribute before SDL_Init was called but I'm still getting a segfault right after the first SDL_GL_SetAttribute call. I've ran sdl with opengl apps before on ...

Create a right-angled triangular prism in OpenGL

I'm learning OpenGL (specifically, using JOGL) and I'm trying to create a right-angled triangular prism. I learned you can create an equilateral prism with glutWire/SolidCylinder and a a low number of slices (3 for a triangle, obviously). So I'm wondering if there's some other way to make a prism, or if there's some way to scale an equ...

OpenGL: Render to FBO using multiple textures

Hi, I'm experimenting with a renderer. What I want is to write a color buffer and a normal buffer to two separate textures. I got that part figured out. However, the color buffer is supposed to be a combination of two textures. This should do the trick: glActiveTexture(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); g_Tex->Bind(); glActiv...

Using glTranslate and glRotate to move and rotate?

I am learning openGL and I am writing an application that draws a 2D triangle and rotates it around its z-axis depending on its position. Its middle (t1.tx, t1.ty) is constantly being changed when the triangle is dragged with the mouse. The problem is that when I drag the triangle to another location, instead of staying where its at and ...

Loading an image to an OpenGL texture using Cocoa

This seems like it should be something that's easy to do, but I can't seem to find a source out there to tell me how to do it. I would like to load a texture from an image file into my shader. I'm trying to stick as close to the core profile as possible in OpenGL 3.3, although I understand a lot of things are still not implemented in O...

Is cl-opengl glut mature?

I want to create my own editor to code in, at first I was going to use ncurses to make a terminal editor. Not working, the library has no documentation and it's mail list is completely empty. I'm probably going to make it with a gui library instead. I'm thinking of just using glut from cl-opengl, but I can't find any info on how develope...