Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Oct 1999
Offline Last Active Mar 25 2015 08:29 AM

Topics I've Started

glBindTexture - what is the technical reason that it is slow?

05 March 2015 - 12:36 PM

I've been looking all over the place for an answer to this question and I'm only getting bits and pieces of the answer. I learned the hard way a long time ago that calling glBindTexture is relatively slow; I found out from a friend of mine that it was because I was binding the texture every time I drew a triangle lol! The simple fact is that calling glBindTexture comes at a price, and minimizing calls is always the best choice!


Anyway, there's a reason it's slower than most other function calls that change the opengl states, and I'm looking for the technical answer.


So far, with my limited understanding of hardware in general, the main reason I think it's slow is because every time you call glBindTexture, the hardware copies the texture from Texture RAM into the Texture Cache because the Cache is faster to read from. Although the copy is fast in it's own right, copying larger textures should take longer than smaller textures, and if done enough times no matter the size of the texture, will become a performance bottleneck.


Yes/No? Is there more to it than that?

I need help with understanding Invert vs Transpose

28 December 2008 - 05:46 AM

I'm a little confused by the difference between inverting a matrix versus transposing a matrix. I invert my camera matrix to bring objects into camera space, and transpose my texture matrix to be used for my shadow maps. The two function that I have that invert and transpose matrices are similar, and that's what is confusing me. The xyz rotation axis are being transposed in both, but the forth column, and position, are treated differetly. I guess I understand why the invert function I have works, but I don't understand what the 4x4 transpose is doing with the 4th column and position data. Invert function: b[0]=a[0]; b[1]=a[4]; b[2]=a[8]; b[3]=0.0f; b[4]=a[1]; b[5]=a[5]; b[6]=a[9]; b[7]=0.0f; b[8]=a[2]; b[9]=a[6]; b[10]=a[10]; b[11]=0.0f; b[12]=-(a[12]*a[0])-(a[13]*a[1])-(a[14]*a[2]); b[13]=-(a[12]*a[4])-(a[13]*a[5])-(a[14]*a[6]); b[14]=-(a[12]*a[8])-(a[13]*a[9])-(a[14]*a[10]); b[15]=1.0f; Transpose function: temp[0]=m[0]; temp[1]=m[4]; temp[2]=m[8]; temp[3]=m[12]; temp[4]=m[1]; temp[5]=m[5]; temp[6]=m[9]; temp[7]=m[13]; temp[8]=m[2]; temp[9]=m[6]; temp[10]=m[10]; temp[11]=m[14]; temp[12]=m[3]; temp[13]=m[7]; temp[14]=m[11]; temp[15]=m[15]; -WhatEver

Euler Angles Beyond 90 degrees from Matrix

26 August 2008 - 10:44 AM

I looked around all over the place to find out how to extract euler angles from a matrix, and I found it. Yippeee right? Nope, I'm dealing with sort of a more unique problem. Apparently, and this makes sense, you can only extract angles that are limited to 0 and 89 degrees. Here is the problem I am posed with: 1. Rotate a matrix around it's axes 360 degrees 2. Extract x rotation from matrix I end up with 0 degrees. I need it to give me 360 degrees. I am writing a plugin for AfterEffects that will export animations to LightWave. If I have a AfterEffects layer rotating around it's axes 4 times, then I need to be able to convert that rotation from xyz order (AfterEffects) to yxz order (LightWave). Actually, all these numbers are in radians in my source code, but I am calling them degrees here for simplicity. Any help would be appreciated. Thank you.

How do you pass a tangent array for use by the TANGENT semantic

31 August 2007 - 05:14 PM

I have looked everywhere and I can't seem to find out how to pass a pointer of an array of tangents to the GPU for use by the TANGENT semantic in my cg shader. I know you use glActiveClientTextureARB(GL_TEXTURE0...4) and so on along with glTexCoordPointer for setting up texture pointers, but how do you pass a pointer that contains a tangent array? I'm stumped!

How do you find and remove redundent vertices fast?

07 February 2006 - 01:54 AM

Since this topic doesn't really fit anywhere else, I thought I'd post it here, because I'm sure the answer has something to do with math. I've been trying to think of different ways to remove duplicated xyz values from an array of vertices. I've been testing each vertex with all the other vertices, but processing 300,000 vertices (100,000 triangles) is waaaaay to slow using that method. LightWave does it quickly somehow, but how??? Are they hashing the vertices or something?