OpenGL Automatic Texture Coordinate Generation?

Recommended Posts

I have heard rumors of it in DirectX 9.0c but can not find any information. For example: http://msdn.microsoft.com/en-us/library/bb206247(VS.85).aspx At the bottom it reads, “Automatically Generated Texture Coordinates (Direct3D 9)”, but there is no link! So basically I want to do shadow-mapping in a way as closely related to the OpenGL FFP method as possible. My engine supports both, and so the methods should be as similar as possible. Additionally, the OpenGL version of my engine works on iPhones and iPod touches, which means no shaders. So how is shadow-mapping done in DirectX (FFP)? I am really looking for a way to perform the automatic texture coordinate generation so that the method can really match my OpenGL implementation in a generic way. That is, I can make a class that simply performs all the state changes needed to make shadow mapping work and just change how it works in OpenGL and DirectX, but it is much more flexible to instead make wrappers for the smaller parts and use the shadow-mapping class to bring them together, without itself needing to change for each graphics API. Specifically I want to do this (if possible) so that new graphics techniques can be supported in the future without needing the source code of my engine. So, is there a one-for-one way to do the FFP OpenGL shadow-mapping technique in DirectX? Thank you, L. Spiro

Share on other sites
Nevermind.

After years of searching I stumbled upon this:
http://msdn.microsoft.com/en-us/library/bb172621(VS.85).aspx

I wonder why all links in other areas of MSDN that refer to automatic texture-coordinate generation are invalid/missing.

L. Spiro

Share on other sites
Actually I have a question.

With the exception of D3DTSS_TCI_PASSTHRU, which resolves to zero, if any of the following values [there are no following values] is included with the index being set, the system uses the index strictly to determine texture wrapping mode. These flags are most useful when performing environment mapping.

This really just confuses me.

What I want is to simulate the OpenGL system of being able to set coordinate generation on a per-component basis.

For example, I want to set the SRT coordinates to eye-linear and leave Q default in texture slot 2.
In OpenGL:
::glClientActiveTexture( GL_TEXTURE0 + 2 );
::glEnable( GL_TEXTURE_GEN_S );
::glEnable( GL_TEXTURE_GEN_T );
::glEnable( GL_TEXTURE_GEN_R );
::glDisable( GL_TEXTURE_GEN_Q );
::glTexGenf( GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
::glTexGenf( GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
::glTexGenf( GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );

In DirectX (no clue here, this is where you come in):
IDirect3DDevice9::SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, (0 | D3DTSS_TCI_CAMERASPACEPOSITION) );
IDirect3DDevice9::SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, (1 | D3DTSS_TCI_CAMERASPACEPOSITION) );
IDirect3DDevice9::SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, (2 | D3DTSS_TCI_CAMERASPACEPOSITION) );
IDirect3DDevice9::SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, (2 | D3DTSS_TCI_PASSTHRU) );

Okay it is obvious that the last call is going to destroy everything the previous 3 calls did, so this is clearly not the way to get the same result as in OpenGL.
Anyone know how to do it?

Thank you,
L. Spiro

Create an account

Register a new account

• Partner Spotlight

• Forum Statistics

• Total Topics
627662
• Total Posts
2978519
• Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 10
• 12
• 22
• 13