API Internal ID's, and my ID's
When I give an API (for example SDL or OpenGL) a name for a surface/texure, like this:
SDL_Surface foo;
GLuint foo;
Would that be different from say... this:
typedef struct {
SDL_Surface foo;
GLuint foo;
} fooTypeStruct;
What I mean is, if I make several fooTypeStructs, would GL or SDL see all the surfs as one, or would they tell the difference between all the foo's?
Thanks!
SDL_Surface foo;
GLuint foo;
Would that be different from say... this:
typedef struct {
SDL_Surface foo;
GLuint foo;
} fooTypeStruct;
What I mean is, if I make several fooTypeStructs, would GL or SDL see all the surfs as one, or would they tell the difference between all the foo's?
Thanks!
You can't have 2 variables with the same name and different type. That's just asking for trouble!
"When you dream, there are no rules..."
Taxxodium Wrote:You can't have 2 variables with the same name and different type. That's just asking for trouble!
I know, but that's not exactly what I meant.
Do OpenGL or SDL (for example) differentiate between variables named the same in different cases of structs?
a) this is absolutely nothing to do with OpenGL or SDL
b) you can't have two fields of a struct with the same name
b) you can't have two fields of a struct with the same name
OneSadCookie Wrote:a) this is absolutely nothing to do with OpenGL or SDL
b) you can't have two fields of a struct with the same name
I must be explaining very poorly, for that is not what I meant. A GLuint is not actually texture data, nor is it a picture. It is an ID with which OpenGL can access corresponding data and sizes, etc. Now, if I have two named the same, even if they are in different cases of a struct, would that compose OpenGL at all?
Thanks!
When you pass a texture ID to an OpenGL function (or any other function), it has no knowledge whatsoever of where that ID came from - all it knows is that there are 32 bits of data on the stack, and it will expect them to represent a texture ID. Variable names in particular are a high-level concept that goes away entirely once your code is compiled.
So, if you're talking about something like this:
...then storing unique values in struct1.textureID and struct2.textureID isn't a problem. Each one has its own storage space in memory within the bounds of the storage space for the entire struct. So, given that, and given that functions know nothing about their parameters other than their type and value, I think that should answer your question?
So, if you're talking about something like this:
Code:
struct myStruct {
GLuint textureID;
};
struct myStruct struct1;
struct myStruct struct2;...then storing unique values in struct1.textureID and struct2.textureID isn't a problem. Each one has its own storage space in memory within the bounds of the storage space for the entire struct. So, given that, and given that functions know nothing about their parameters other than their type and value, I think that should answer your question?
ThemsAllTook Wrote:When you pass a texture ID to an OpenGL function (or any other function), it has no knowledge whatsoever of where that ID came from - all it knows is that there are 32 bits of data on the stack, and it will expect them to represent a texture ID. Variable names in particular are a high-level concept that goes away entirely once your code is compiled.
So, if you're talking about something like this:
Code:
struct myStruct {
GLuint textureID;
};
struct myStruct struct1;
struct myStruct struct2;
...then storing unique values in struct1.textureID and struct2.textureID isn't a problem. Each one has its own storage space in memory within the bounds of the storage space for the entire struct. So, given that, and given that functions know nothing about their parameters other than their type and value, I think that should answer your question?
YES! Thank you.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Internal Error on XCode | softengg | 1 | 2,396 |
Jan 23, 2008 11:40 PM Last Post: OneSadCookie |
|
| Engine Internal Fundamental Design | Jones | 6 | 2,952 |
Nov 1, 2006 07:37 AM Last Post: Jones |
|

