textures

Direct3D: Draw textured cube with single DrawIndexedPrimitives call. Possible?

I am trying to draw a textured cube using just 8 vertices and one DrawIndexedPrimitives call. Is this even possible? I am having problems with the UV co-ordinates. I am finding it impossible to come up with suitable UV values which will work for all faces of the cube. Take the following numbering as an example: UV is set to (0, 0) ...

How do I texture map a cube in OpenGL ES?

Having a lot of trouble getting texture maps to work in openGL ES (iphone). Here's what I've done: built an array of vertexes built an array of faces that reference the indices of the array of vertexes for each face built an array of colors so I can be sure I know which vertex on the cube is which. All of this following Jeff Lamarc...

How do I change or animate texture maps on openGL ES 1.1 objects?

I'm building a game that has an array of 7 * 5 tiles, similar to Scrabble tiles. The two main faces are supposed to have different letters on them. I've created a single geometry that I reuse by translating in x and y. I can change the letter that is mapped to the face of ALL the tiles, by setting the values in my glTexCoordPointer. My ...

How to use textures and arrays in CUDA?

Steps for using textures and arrays in CUDA? ...

Can't draw OpenGL ES textures to non-round locations

When drawing OpenGL ES textures, they seem to "snap" to round pixel locations, as though the draw location was being rounded. ie. drawing at (x:1.1, y:5.4) actually draws at (x:1, y:5). This causes the textures to appear to "jump" when scrolling, rather than move smoothly. Yes, I'm using floating point types for my vertices, etc. D...

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

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

Debugging a basic OpenGL texture fail? (iphone)

Hey all, I have a very basic texture map problem in GL on iPhone, and I'm wondering what strategies there are for debugging this kind of thing. (Frankly, just staring at state machine calls and wondering if any of them is wrong or misordered is no way to live-- are there tools for this?) I have a 512x512 PNG file that I'm loading up f...

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

Better way to generate tiles

Hi ! I'll start by saying that i'm REALLY new to OpenGL ES (I started yesterday =), but I do have some Java and other languages experience. I've looked a lot of tutorials, of course Nehe's ones and my work is mainly based on that. As a test, I started creating a "tile generator" in order to create a small Zelda-like game (just moving...

OpenGL 2D Texture Mapping problem.

Hi there, I am relatively new to OpenGL and I am having some issues when I am rendering an image as a texture for a QUAD which is as the same size of the image. Here is my code. I would be very grateful if someone helps me to solve this problem. The image appears way smaller and is squished. (BTW, the image dimensions are 500x375). gl...

Loading textures in an Android OpenGL ES App.

I was wondering if anyone could advise on a good pattern for loading textures in an Android Java & OpenGL ES app. My first concern is determining how many texture names to allocate and how I can efficiently go about doing this prior to rendering my vertices. My second concern is in loading the textures, I have to infer the texture to b...

Loading .png image from array of uint8_t into OpenGL ES texture

Normally, when we want to load a texture for OpenGL ES with .png, we simply add the .png images into XCode. The .png files will be altered for optimization by XCode and these altered png files can loaded into OpenGL ES texture during the runtime. However, what I am trying to do is quite different. I am trying to load a .png file that i...

Is there any way to add alpha to individual vertices in OpenGL Vertex Buffers?

Hello, I'm trying to learn how to use vertex buffers by making a sprite engine. I create a new buffer for each texture page I have, and can add instances of textured quads to the buffers, interleave their vertex and uv information and render them out fine using DrawElements. However, I can't find any way of setting the alpha on individ...

YUV Textures and Shaders

I've always used RGB textures. Now comes up the need of use of YUV textures (a set of three texture, specifying 1 luminance and 2 chrominance channels). Of course the YUV texture could be converted on CPU, getting the RGB texture usable as usual... but I need to get RGB pixel directly on GPU, to avoid unnecessary processor load... The pr...

iPhone: How much OpenGL cleanup do I need to do when a context goes away?

I several views in an iPhone app which happen to use independent openGL contexts. They are not necessarily long-lived so they go away before the process does. And they have a couple textures in each. Does -releaseing the EAGLContext cause all that GL state to get cleaned up for me? Or am I leaking textures etc by not finding a place to...

Counting texels using a fragment shader

Hi, I have two textures generated using a fragment shader. I want to be able to count the number of texels in each texture that are above some colour intensity. My question is how can this be done? My initial thought is to count these texels using the fragment shader before generating the texture. However, this would require some sort of...

Fastest possible way to render 480 x 320 background as iPhone OpenGL ES textures

I need to display 480 x 320 background image in OpenGL ES. The thing is I experienced a bit of a slow down in iPhone when I use 512 x 512 texture size. So I am finding an optimum case for rendering iPhone resolution size background in OpenGL ES. How should I slice the background in this case to obtain the best possible performance? My ma...

OpenGL ES displaying HUD display Text can't be colored black on top of textured 3D objects

This is a follow-up of this question on here http://iphonedevelopment.blogspot.com/2010/02/drawing-hud-display-in-opengl-es.html It tackles on the HUD (heads up display) which is based on this tutorial > http://stackoverflow.com/questions/2681102/opengl-es-displaying-hud-display-has-no-color-on-top-of-textured-3d-objects I wanted to set ...

OpenGL ES; rendering texture created from CGBitmapContext

I am executing the following, which I have derived from a few different tutorials (Just a single render pass, initialisation code not shown but works fine for untextured primitives): glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0, xSize, 0, ySize, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); g...