textures

Advice on cross-platform OpenGL image loader for textures.

Hello. I need to load PNGs and JPGs to textures. I also need to save textures to PNGs. When an image exceeds GL_MAX_TEXTURE_SIZE I need to split the image into separate textures. I want to do this with C++. What could I do? Thank you. ...

How to load and display image in OpenGL ES for iphone

Hi, I'm a newbie and trying to display a sprite on my iPhone screen using OpenGL ES. I know its far simpler and easier to do it with cocos2d but now I'm trying to code directly on OpenGL. Is there any simple yet efficient way to load and display sprites in OpenGL ES. What I've found until now is much much complex. :( ...

OpenGL: Loading a texture changes the current color

I noticed that when I'm loading a texture, it might change the current drawing color, depending on the texture's color. For example after executing glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, info.biWidth, info.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,bitmap); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParame...

Compiling specific code NULLs my textures.

A very strange error: if I add some specific code to my project, any textures I use contain nothing but 0. Even when I'm not running any of the code that was added. The specific code here is the kernels of an nVidia CUDA sample [1], the Bicubic Texture Filtering sample, in specific the CatMulRom kernel. I've traced it down to one of the...

Problems using glDrawTexfOES to render background image with foreground objects

I have a simple iPhone OpenGL ES app, in which I render a full-screen background image using a texture, and then draw 3D polyhedra on top of it using lines. The texture is displayed using glDrawTexfOES. The problem is that I don't seem able to display the polyhedra on top of the background. In the glDrawTexfOES call, if I use a z value ...

Why does full-screen iPhone background texture need y-offset of 32 points?

I'm using a full-screen background texture. It's stored in a 512x512 PNG file. When rendering it to the screen using glDrawTexfOES, for some reason I need to add a 32 point y-offset in order to make it align with the screen. Why? glBindTexture(GL_TEXTURE_2D, backgroundTexture); int backgroundRectangle[] = { 0, 480, 320, -480 }; // Handl...

OpenGL Nvidia Driver 259.12 texture not working

My OpenGL application which was working fine on ATI card stopped working when I put in an NVIDIA Quadro card. Texture simply don't work at all! I've reduced my program to a single display function which doesn't work: void glutDispCallback() { //ALLOCATE TEXTURE unsigned char * noise = new unsigned char [32 * 32 * 3]; memset(noise, 255...

Creating texture with varying alpha values for drawing anti-aliased lines in OpenGL-ES

I am working on drawing anti-aliased lines in OpenGL-ES on iPhone. I am using an approach outlined in iPhone 3D Programming, called "Rendering Anti-Aliased Lines with Textures". The basis idea is to iterate through the line creating a bounding rectangle for each line segment (pair of vertices). This bounding rectangle can be represented ...

Setting Up OpenGL ES 2.0 Textures

Hi everyone, I'm working on an iPhone project in Xcode 3.2.4 for which I'd like to display textures using OpenGL ES 2.0. I don't have much previous experience working with OpenGL, but so far it doesn't seem too awful. So far I've mainly been referring to The OpenGL ES 2.0 Programming Guide (gold book). Right now I've got a project base...

OpenGL: Is it acceptable to work with textures like 2500*2500 pixels?

Hi, The title says it all. Of course the texture will not be completely visible on the screen. And I can make it always draw just the visible part (With glTexCoord2f and then glVertex2f). (It is the big "level"-image, which I have to move around for a sliding camera). Notice this rendering has to be real-time in my game (game is written...

In computer graphics, what's the difference between a UVW mapping and a UV mapping?

In working with textures, does "UVW mapping" mean the same thing as "UV mapping"? If so why are there two terms, and what is the "W"? If not, what's the difference between them? [Wikipedia currently isn't illuminating on this question: http://en.wikipedia.org/wiki/Talk:UVW_mapping] ...

iPhone OpenGL - How to gradient fade out a texture?

I want to customize the reflection from the FlowCover (Cover Flow remake) sample code. Now, the reflection (a texture) is only transparent but I want it to have a gradient so that the texture fades to be completely transparent. How would you achieve this effect with OpenGL? This is the code that handles the textures. glPushMatrix(); gl...

Multiple textures in GLSL - only one works

Hi, There's been similar threads before, but I could not find a solution in them. My problem is getting more than one texture accessible in a GLSL shader. Here's what I'm doing: Shader: uniform sampler2D sampler0; uniform sampler2D sampler1; uniform float blend; void main( void ) { vec2 coords = gl_TexCoord[0]; vec4 col = textu...

o3d textures and transparency

I'm working at galery on o3d(plagin version) and I need make photos transparent. Photos are on hud. Here is some code: g_canvasInfoPict = o3djs.canvas.create(g_pack, g_hudRoot, g_hudViewInfo); alphaParam = g_canvasInfoPict.transparentState_.getStateParam("o3d.AlphaReference"); alphaParam.value = 0.5; alphaParam = g_canvasInfoPict.tran...

How do I make d3d use my vertex alpha values?

I'm trying to render a textured quad in d3d, and its not using the alpha values of the VERTICES of the quad the texture is being rendered to. Rather it is using the alpha of the TEXTURE. I want d3d to use the alpha of the VERTICES of the polygon it is placed upon. I have an idea it has to do with SetTextureStageState, but I can't quit...

iPhone OpenGLES texture loading issue with transparency

Hey, I've been using this method (I think I got it from one of Apple's example code projects): - (void)loadTexture:(NSString *)name intoLocation:(GLuint)location { CGImageRef textureImage = [UIImage imageNamed:name].CGImage; if(textureImage == nil) { NSLog(@"Failed to load texture!"); return; } NSInteger texWidth = CGImageG...

How can I alphablend only certain parts of a texture in DX 9?

Hello everyone! How can I alphablend only certain parts of a texture in DX 9? For example, layers in Photoshop (or any other photo editing program that supports layers). You can draw something in a layer (background filled with alpha), then place the layer over the original image (draw the texture on the screen) which leads to the or...

An UV mapping algorithm to maximize texel density and consistency?

I'm looking for a way to automatically map a 3D mesh's polygons onto UV space such that texel density is maximized and kept as consistent as possible between polygons. Does an algorithm exist that will provide better results in this respect than standard projections such as planar, box, cylindrical, and spherical? ...

Background Texture Image in iPhone Drawn with Distortion in OpenGL ES

Hello, I'm having a problem rendering a background texture in my iPhone app. The following images show the problem: http://www.tojamgames.com/wp-content/uploads/2010/09/background_layer1.png tojamgames.com/wp-content/uploads/2010/09/IMG_0246.png (can't make this a link, sorry) First one is the correct image, the second one is the on...

OpenGL repeating texture causes anomalies when rotated

I have a texture being drawn to a quad. The texture is the repeating pattern in the top-left corner of this screenshot: http://img828.imageshack.us/img828/3305/blahpv.png The opengl texture is only 3px by 9px and the texture coordinates I'm passing are very large numbers and it loops over the 3x9 texture by using GL_REPEAT. Any explanati...