opengl

Persistence of texture parameters

I use glBindTexture() to bind a previously created texture. After the glBindTexture() call I use glTexParameteri() to set MIN and MAG filter. No problem so far. Are those parameters I set using glTexParameteri() bound to the texture itself or are they lost if I bind another texture. Do i have to set them again? glGenTexture(1, &tex1); ...

SDL_GL_SwapBuffers Segfault

I'm getting a segfault that GDB says is coming from SDL_GL_SwapBuffers. However, I can't imagine why. The SDL documentation mentions no specific pre-conditions for calling swapBuffers except that double buffering be allowed. Is this an option I have to turn on while initializing OpenGL or is this a hardware capability thing? My code: h...

Wrapping/warping a CALayer/UIView (or OpenGL) in 3D (iPhone)

I've got a UIView (and thus a CALayer) which I'm trying to warp or bend slightly in 3D space. That is, imagine my UIView is a flat label which I want to partially wrap around a beer bottle (not 360 degrees around, just on one "side"). I figured this would be possible by applying a transform to the view's layer, but as far as I can tell,...

OpenGL - How do I compare pixel values from separate textures with the same location

Hi, I was wondering what is the best way to go about comparing a pixel that is currently being rendered (and accessed using a fragment shader) to a pixel with the same location in a previously stored unbound texture (both textures are the same size)? ...

Difference between glTexSubImage and glTexImage function in OpenGL

What is the difference between the two functions? Any performance difference? Thanks.. ...

OpenGl Deployment: Running it on other peoples computers!

I'm kind of confused here. Im using a mac trying to develop an opengl game. The Opengl frame work is dynamically linked. So therefore i need to force static or bundle it right? Wait, wait, i read that opengl is on all macs now, yet there's extra stuff u get if u install Xcode.(i have it installed). Anyways, I want this to work on OSX, w...

How do you determine when an object is drawn on-screen in OpenGL?

I'm extremely new to OpenGL. I'm writing a program that displays flying 3D text on screen. I need to know when certain text string appears (drawn) onto the screen and are visible to the user. The program needs to identify which text strings are displayed. (Note: although my problem deals with text, it could be generalized to any OpenGL o...

Generating bitmap on PixelShader

Hi, I have 16bit grayscale data on which I would like to make such operations: For every pixel: 1) Compute sample 's' downsampling 16bit->8bit using LUT 2) Store sample in RGB (24bit - 8bit per sample) texture R=s,G=s,B=s At the end I would like to have data that I could use in a windows DIB directly ( unsigned short 8bit per sample RGB...

Texture mapping to different parts of a 3ds model in Opengl?

I am trying to map the textures of a tree(That is in .3ds format) in OpenGL and C++.I am using vertex buffer objects, vertex array objects and shaders.The vertex coordinates, normals and texture coordinates are uploaded to shader via glVertexAttribPointer.My question is how can I select different textures for different parts of the model...

how to draw a text in OpenGL view cocoa-objective-c

i need draw a counter onto a OpenGL view. here is my source code for the video frame display cgl_ctx = CGLContextObj ( [[self openGLContext] CGLContextObj]); glEnable(GL_TEXTURE_RECTANGLE_ARB); glGenTextures(1, &_surfaceTexture); glDisable(GL_TEXTURE_RECTANGLE_ARB); GLint swapInt = 1;//100;//1; ...

OpenGL: raster texture directly to screen?

I have an OpenGL texture. There is a rectangle on my viewport the same size as the texture. Is there a way to raster the texture directly to the screen, without pasting it first on some quad? Thanks! ...

Trying to switch a texture when player dies (OpenGL + C++)

I'm creating a 2D game and when the player dies I want the texture I to switch to another (to show an explosion) I also want the game to pause for a second or two so the user can see that the texture has changed. My textures are loading correctly because I can apply it to a shape and i can see it if I say switched it with the players or...

OpenGL DECAL Texture on a Transparent Quad?

Hi, I have an OpenGL texture with transparent and opaque pixels (eg, texture contains a circle, area outside the circle is transparent with alpha of 0.0). I'm mapping this texture to a simple quad using GL_DECAL mode, and it works-- the transparent parts of the texture are invisible, and I see my circle against the background of the qu...

in OpenGL vertex shaders, what is w, and why do I divide by it?

void main(void) { vec4 clipCoord = glModelViewProjectionmatrix * gl_Vertex; gl_Position = clipCoord; gl_FrontColor = gl_Color; vec3 ndc = clipCoord.xyz / clipCoord.w; So the clipCoord is just doing standard fixed pipeline ransforms. Now, the ndc ... why do I divide by w, and what do I get from this? ...

Visualisation of star catalogues and celestial coordinates

Does anyone have a suggested methodology for visualising the data in a star catalogue such as the Bright Star Catalogue. I'm thinking that there would be a notional sphere and a viewpoint i.e. at the center of that sphere with two vectors representing the view direction and view horizons. I would then somehow project from the star cata...

Defining Light Coordinates

I took a Computer Graphics exam a couple of days ago which had extra credit question like the following: A light can be defined in one of two ways. It can be defined in world coordinates, e.g. a street light, or in the viewer (eye coordinates), e.g., a head-lamp worn by a miner. In either case the viewpoint can freely change. Describ...

Why can't I display same object in multiple viewports?

Hi, I'm pretty new to OpenGL. I was playing around with some code but I can't figure out why the following will not produce two viewports with the same object view. Here's the code: glViewport(0, windowHeight/2, windowWidth/2, windowHeight); glScissor(0, windowHeight/2, windowWidth/2, windowHeight); glMatrixMode(GL_PROJECTION); glLoadId...

NSOpenGLView resize on window resize

I have a class called ModelView which inherits from NSOpenGLView. When my program runs i attach the ModelView as follows to the main window. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application ModelView *glView; NSRect glViewRect = CGRectMake(0.0f, 0.0...

What is Khronos EGL and where can I find an open source implementation?

http://www.khronos.org/egl/ Is EGL a windowing and input framework for OpenGL like GLFW, SDL or GLUT? Is there a complete implementation yet? ...

Fragment shaders on a texture

Hello stack overflow. I am trying to add some post-processing capabilities to a program. The rendering is done using openGL. I just want to allow the program to load some home made fragment shader and use them on the video stream. I wrote a little piece of shader using "OpenGL Shader Builder" that just turns a texture in grayscale. The...