texture-mapping

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

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

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

Texture mapping in MATLAB

I have points in 3D space and their corresponding 2D image points. How can I make a mesh out of the 3D points, then texture the triangle faces formed by the mesh? Update See answer ...

OpenGL: Disable texture colors?

Is it possible to disable texture colors, and use only white as the color? It would still read the texture, so i cant use glDisable(GL_TEXTURE_2D) because i want to render the alpha channels too. All i can think of now is to make new texture where all color data is white, remaining alpha as it is. I need to do this without shaders, so ...

Problem cube mapping in OpenGL using DDS compressed images

Hi All, I am having trouble cube mapping when using a DDS cube map, I'm just getting a black cube which leads me to believe I have missing something simple, here's the code so far: DDS_IMAGE_DATA *pDDSImageData = LoadDDSFile(filename); //compressedTexture = -1; if(pDDSImageData != NULL) { int height = pDDSImageData->height; i...

How do I use texture-mapping in a simple ray tracer?

I am attempting to add features to a ray tracer in C++. Namely, I am trying to add texture mapping to the spheres. For simplicity, I am using an array to store the texture data. I obtained the texture data by using a hex editor and copying the correct byte values into an array in my code. This was just for my testing purposes. When the v...

Opengl ES and texcoord

Hi, I've got some code which I would like to translate into Opengl ES. I'm not experienced with it however, so here it goes. The original code does a loop like this: glBegin(GL_TRIANGLES); for(i=0; i<num_triangles; i++) { glNormal(...); glTexCoord2f(...); glVerted3fv(...); glTexCoord2f(...); glVerted3fv(...); glTex...

What is the correct behavior when both a 1D and a 2D texture are bound in OpenGL?

Say you have something like this: glBindTexture(GL_TEXTURE_2D, my2dTex); glBindTexture(GL_TEXTURE_1D, my1dTex); glBegin... What is the correct OpenGL behavior? To draw the 1d texture, the 2d or both? For each active texture are there actually multiple textures that can be bound to it at the same time (i.e. a 1d, 2d, 3d cube map, etc.)...

Texture mapping an NGon?

I'm not sure how to go about figuring out how to map texture cooridnates for a 2D NGon (N sided polygon) How can this be done? The effect i'm trying to achieve is for the texture to fit on the polygon and stretch out accordingly so the whole texture fits on it. Thanks ...

Modifying a model and texture mid-game code

Just have a question for anyone out there who knows some sort of game engine pretty well. What I am trying to implement is some sort of script or code that will allow me to make a custom game character and textures mid-game. A few examples would be along the lines of changing facial expressions and body part positions in the game SecondL...

mapping pictures to a sphere or cylinder

hi, i am developing an application where client can add his photos to appear on a sphere or ball or coffee cup and able to save them and give it for printing using flex. like itasveer.com site. i tried to use away3D but if the image is small it is stretched and added to sphere. i dont want it to strech instead the original image shud app...

Mapping irregular shapes or other polygons (cartoons, sprites) to triangles in OpenGL ES

I don't understand the concept of showing sprites mapped into OpenGL Triangles. If OpenGL ES only draws triangles and points, How do you display/map non-triangular shapes? Why would a shape mapped to a triangle not be distorted? To explain: In my mind, mapping, say, a sprite of Mario, to a triangle would produce a distorted or cropp...

Texture coordintes for a polygon and a square texture

basically I have a texture. I also have a lets say octagon (or any polygon). I find that octagon's bounding box. Let's say my texture is the size of the octagon's bounding box. How could I figure out the texture coordinates so that the texture maps to it. To clarify, lets say you had a square of tin foil and cut the octagon out you'd be ...

OpenGL-ES Texture Atlas. t axis is inverted.

I'm mapping a texture from my texture atlas to a square on a cube. For some reason, the t axis is inverted with 0 being at the top and 1 being at the bottom. Any ideas why this is happening? Also, I have to specify the texture coordinates in clockwise order rather than counter-clockwise. I am using counter-clockwise windings. The vertic...

Opengl problem with texture in model from obj

Hello! I writing small program in OpenGL, and I have problem ( textures are skew, and I dont know why, this model work in another obj viewer) What I have: http://img696.imageshack.us/i/obrazo.png/ What I want http://img88.imageshack.us/i/obraz2d.jpg/ Code of project (I use devil for images): #pragma once #include <windows.h> ...

Repeating only a portion of a texture in OpenGL ES?

I know it's possible to repeat an entire texture by setting the wrap mode to GL_REPEAT, but is it somehow possible to repeat only a subregion of the texture? For example, when the texture is part of an atlas. I'm targetting OpenGL ES 1.x, so shaders are out. ...

What does setting the GL color before doing a texture mapping operation do?

I am looking at some sample code in a book that creates a jittered antialiasing effect by repeatedly rendering a scene (at different offsets) onto a offscreen texture, then using that texture to repeatedly draw a quad in the main view with some blend stuff set up. To accumulate the color "correctly", the code is setting the color like s...

OpenGL texture mapping

I have two objects drawn on screen in openGL, one is a sphere using the GLU object and one is a texture mapped star. Regardless of the z coordinates, the texture mapped star always seems to draw in front. Is this normal openGL behavior? Is there a way to prevent this? Note: I am working within the worldwind framework, so maybe something...