opengl

OpenGL Projection Matrices

I have a question on taking a viewer and their projection plane and how exactly to calculate the projected point that should be created. EX. Viewer at the origin, looking in the negative Z direction. Projection plane at z = -2. Point (-6,1,-4). I have seen some websites talking about using similar triangles and some that have a matrix ...

how to revert glScalef() ?

Im using glScalef() for zooming in my program, now when i revert it back to the original size with code: glScalef(1.0f/ZOOM, 1.0f/ZOOM, 1); It doesnt work very well in high zooms... (maybe because of the lost decimals?) How i can revert it back perfectly to the original size without any calculations like above? ...

Retrieving Pixels From a Previously Bound Texture - OpenGL

In OpenGL is it possible to retrieve the pixel array from a previously created texture given only the texture ID? ...

When using a GL_RGBA16F_ARB-texture, it contains just crap, but I get no error message

I generate a texture like this: GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,...

How do draw to a texture in OpenGL.

Now that my OpenGL application is getting larger and more complex, I am noticing that it's also getting a little slow on very low-end systems such as Netbooks. In Java, I am able to get around this by drawing to a BufferedImage then drawing that to the screen and updating the cached render every one in a while. How would I go about doing...

Why doesn't glCopyTexSubImage2D copy my square correctly?

here is the output: http://i43.tinypic.com/9a5zyx.png if things were working the way i wanted, the colors in the left square would match the colors in the right square. thanks for any help regarding the subject #include <gl/glfw.h> const char* title="test"; GLuint img; unsigned int w=64,h=64; int screenwidth,screenheight; void enable2...

Tackling alpha blend in OpenGL for better performance

Since having blends is hitting perfomance of our game, we tried several blending strategies for creating the "illusion" of blending. One of them is drawing a sprite every odd frame, resulting in the sprite being visible half of the time. The effect is quit good. (You'd need a proper frame rate by the way, else your sprite would be notice...

Can 3D OpenGL game written in Python look good and run fast?

I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). When I was planning what to do, I started wondering about switching to Python. I know that Python didn't come into existence ...

Suggestion for a simple graphics project for school

I am in my 6th semester of CS engineering, and I need to submit a project. Could anyone suggest a simple project using OpenGL? ...

Cocoa/OpenGL coordinate transformations

I'm trying to plot some data by timestamp in a NSOpenGLView. I also want to overlay some non-openGL Cocoa elements above the data, such as highlighting boxes. My difficulty is in getting the coordinate systems to line up. My data's timestamps are in seconds since the epoch. The values run from -2 to 2. I can plot the raw data without to...

Where I can get the OpenGL Libraries?

OpenGL Libraries and header files are • opengl32.lib • glu32.lib • gl.h • glu.h where i can get these files ? ...

How to blend a quad, already with a texture on it.

I made a quad with a nice texture on it. The texture has an alpha channel (RGBA). I replaced the quad with the texture (GL_REPLACE), so now I have a billboard with (semi)transparant pixels on it. So far, no problem. But now I want to blend the entire billboard, so it's overall opacity changes. How would I do this? ...

Resizing an OpenGL window causes it to fall apart

For some reason when I resize my OpenGL windows, everything falls apart. The image is distorted, the coordinates don't work, and everything simply falls apart. I am sing Glut to set it up. //Code to setup glut glutInitWindowSize(appWidth, appHeight); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutCreateWindow("Test Window"); //In d...

How can I render to a cubemap?

I am trying to render to a cubemap, and I found instructions here: http://www.opengl.org/wiki/GL_EXT_framebuffer_object#Quick_example.2C_render_to_texture_.28Cubemap.29 glGenTextures(1, &color_tex); glBindTexture(GL_TEXTURE_CUBE_MAP, color_tex); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParamete...

Verbose glsl Shader compile on Intel

I have a project that uses glsl shaders. This project is designed not to print anything to stdout unless something is going wrong or you explicitly turn on some extra debug output. When a shader compile fails the log length given by glGetProgramInfoLog is >0, and sometimes when it succeeds its >0, and gives compile warnings instead. Wh...

How to use GL_REPEAT to repeat only a selection of a texture atlas? (OpenGL)

How can I repeat a selection of a texture atlas? For example, my sprite (selection) is within the texture coordinates: GLfloat textureCoords[]= { .1f, .1f, .3f, .1f, .1f, .3f, .3f, .3f }; Then I want to repeat that sprite N times to a triangle strip (or quad) defined by: GLfloat vertices[]= { -100.f, -100.f, ...

Object won't rotate?

void RenderBrain(void) { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); ifstream myFile("brainData.txt"); if (!myFile.is_open()) { cout << "Unable to open file"; exit(1); // terminate with error } glRotatef(80.0f, 1.0f, 0.0f, 0.0f); while (! myFile.eof()) { myFile>>a[0]; myFile>>a[1]; myFile>>a[2]; myFile>>a[3];...

Palette Animation in OpenGL

I am making an old-school 2d game, and I want to animate a specific color in my texture. Only ways I know are: opengl shaders. animating one color channel only. white texture under the color-animated texture. But I don't want to use shaders, I want to make this game as simple as possible, not many extra openGL functions etc.. And t...

How to I draw pixels as a texture to a polygon in OpenGL?

In C++ OpenGL, I want to draw each pixel manually (as a texture I assume) on to a simple square primitive, or indeed 2 polygons forming a square. I have no idea where to start, or what phrases to look for. Am I looking for texture mapping or creating textures? Most examples are to load from a file, but I dont want to do that. I've trie...

Cheetah 3d Model > XCode Open GL Application

Hi, I'd like to import objects I create in Cheetah 3D to my open GL iphone app. Can someone show me how this can be done? I can export my objects as any number of file formats, but I'm thinking obj is the correct one. What do I need to do to render this in my opengl canvas? Thanks, I am a total n00b when it comes loading things from...