textures

Self-Referencing Renderbuffers in OpenGL

I have some OpenGL code that behaves inconsistently across different hardware. I've got some code that: Creates a render buffer and binds a texture to its color buffer (Texture A) Sets this render buffer as active, and adjusts the viewport, etc Activates a pixel shader (gaussian blur, in this instance). Draws a quad to full screen, wi...

Why won't my texture show up?

Okay, I'm using Java and JoGL. I'm trying to load and display a texture, but the texture isn't showing up at all. I'm not getting any errors at all, so I don't know what the problem could be. import javax.media.opengl.*; import javax.media.opengl.glu.*; import com.sun.opengl.util.*; import com.sun.opengl.util.j2d.*; import java.awt.*; ...

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? ...

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? ...

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, ...

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...

Can I use a grayscale image with the OpenGL glTexImage2D function?

I have a texture which has only 1 channel as it's a grayscale image. When I pass the pixels in to glTexImage2D, it comes out red (obviously because channel 1 is red; RGB). glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, dicomImage->GetColumns(), dicomImage->GetRows(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelArrayPtr); Do I change GL_RGBA? If s...

How to visualize a depth texture in OpenGL?

I'm working on a shadow mapping algorithm, and I'd like to debug the depth map that it's generating on its first pass. However, depth textures don't seem to render properly to the viewport. Is there any easy way to display a depth texture as a greyscale image, preferably without using a shader? ...

AS3 3D terrain texture generation: Looking for intermediate/advanced ideas

Hello, all! I have been bashing away at Away3D for AS3, and have made a little terrain generator, using Perlin Noise to create a heightmap, and then for texturing, to splice together 5 images (very generic noise based water, beach, grass, rock & snow) depending on the height. Where to next? I doubt my ability to contribute directly to ...

How do I render text on to a square (4 vertices) in OpenGL?

I'm using Linux and GLUT. I have a square as follows: glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right I guess I can't use glutBitmapCharacter, since this is only ideal for 2D ortho. Simple enough, I'd like to re...

efficient texel access in OpenGL

I'm working on a game in OpenGL and here's what I'd like to do: During an iteration of game logic, access texels of a texture for computations. Still during the same logic interation, possibly modify the texels of the texture. Render the game scene with the current version of the texture. Start another iteration with similar access to ...

What are the usual troubleshooting steps for OpenGL textures not showing?

After making a few changes in my application, my textures are no longer showing. So far I've checked the following: The camera direction hasn't changed. I can see the vectors (when colored instead of textured). Any usual suspects? ...

Simple OpenGL texture map not working?

I'm trying to figure out texture mapping in OpenGL and I can't get a simple example to work. The polygon is being drawn, though it's not textured but just a solid color. Also the bitmap is being loaded correctly into sprite1[] as I was successfully using glDrawPixels up til now. I use glGenTextures to get my tex name, but I notice it ...

Tiling texture bmp file as texture onto a rectangle in OpenGL?

I have a pic.bmp that I'm attempting to tile onto a 3 x 2 rectangular flat surface for a demo I'm making. I'm attempting to keep the aspect ratio of the bmp in tact but I still want to tile it across that surface. Right now I have the surfaces vertices as (0,0,0), (3,0,0), (0,2,0) and (3,2,0). How can I apply this bmp to the flat surf...

How do I make textures transparent in OpenGL?

I've tried to research this on Google but there doesn't appear to me to be any coherent simple answers. Is this because it's not simple, or because I'm not using the correct keywords? Nevertheless, this is the progress I've made so far. Created 8 vertices to form 2 squares. Created a texture with a 200 bit alpha value (so, about 80% t...

What is a good way to load textures dynamically in OpenGL?

Currently I am loading an image in to memory on a 2nd thread, and then during the display loop (if there is a texture load required), load the texture. I discovered that I could not load the texture on the 2nd thread because OpenGL didn't like that; perhaps this is possible but I did something wrong - so please correct me if this is act...

iPhone OpenGL ES 2d background texture

Hi, i have a 1024 x 1024 image I use for a texture in my game for the background. Im wondering if their is a proper way to handle drawing a large background texture. How I am doing it currently: texCoord { 0,0,1,0,0,1,1,1 } vertice { 0,0,0,height,width,0,width,height } texCoordPointer(texCoord) vertexPointer(vertice) bind the texture...

Dynamically alter or destroy a Texture2D for drawing and collision detection

I am using XNA for a 2D project. I have a problem and I don't know which way to solve it. I have a texture (an image) that is drawn to the screen for example: |+++|+++| |---|---| |+++|+++| Now I want to be able to destroy part of that structure/image so that it looks like: |+++| |---|---| |+++|+++| so that collision now will work ...

Does it make sense to use own mipmap creation algorithm for OpenGL textures?

I was wondering if the quality of texture mipmaps would be better if I used my own algorithm for pre-generating them, instead of the built-in automatic one. I'd probably use a slow but pretty algorithm, like Lanczos resampling. Does it make sense? Will I get any quality gain on modern graphics cards? ...

512x512 Texture causing huge GPU stress on iPhone, despite tiling

I'm testing my simple OpenGL ES implementation (a 2D game) on the iPhone and I notice a high render utilization while using the profiler. These are the facts: I'm displaying only one preloaded large texture (512x512 pixels) at 60fps and the render utilization is around 40%. My texture is blended using GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALP...