I can’t seem to figure out how to use glimg to find the width and height of an image that has been loaded into an image set. I know it uses the glimg:: Dimensions class, but I cant figure out how this is done.
I’m not really sure what the problem is. Are you wondering how to get a Dimensions instance from an ImageSet? Because the docs cover that. Are you asking how to use that object? Because that seems self evident; it’s a struct that has members which are publicly accessible.
I am wondering how to get a Dimension instance from an ImageSet, but I am new to programming, so I am having trouble understanding how it is done by reading the docs. I am looking for some example code of how this would be done.
You need example code… for a single function call? It’s no different from calling any other member function of a class. If you can call GetMipmapCount
or GetArrayCount
, then you can call GetDimensions
.
But if you really insist:
glimg::Dimensions dims = imageSet->GetDimensions();
What does the ‘->’ between the imageset and GetDimensions(); represent?
You have asked about a very basic C++ concept, something you’d learn in any Introduction to C++ book. So… get such a book and read it. You’ll probably learn a lot of other important things you’ll need to know, and you need that foundation of knowledge before you can effectively use the SDK (or any C++ library).
Graphics programming is not for someone who’s just starting to learn programming. Before you can learn how to code graphics, you need to have a solid understanding of the fundamentals of programming in whatever language you intend to code graphics in.
So I found it through some searching, and it appears to be a postfix expression. I’m sorry to waste your time with such a basic question. I have only taken two high school classes on programming and only one of them involved c++, and that was about a third of the semester and only involved the console, so I have very little c++ knowledge. Thank you for your help with my other programming questions, I will do more research before asking a question like this again.
(edit)
after reading about this operator, I realize that I knew what it was, but I have only ever seen it as ‘.’, not ‘->’.
after reading about this operator, I realize that I knew what it was, but I have only ever seen it as ‘.’, not ‘->’.
The fact that you say that proves that you don’t know what it is. Because they’re not the same thing.
To clarify, .
is used to access members of an object. ->
is used to access members of a pointer to an object, or to invoke the operator ->
overload of an object and access members of the returned pointer.
So in general, if you have some variable o
(which could be a pointer or a class object), o.name()
and o->name()` will not work on the same variable. Or if it does, they almost certainly won’t do the same thing.
When I try using
glimg::Dimensions dims = ImageSet->glimg::ImageSet::GetDimensions();
after I have loaded the image into an image set and created a texture with it, it returns this error:
C:\C++\TextureTest\main.cpp||In function 'int main()':|
C:\C++\TextureTest\main.cpp|62|error: expected primary-expression before '->' token|
C:\C++\TextureTest\main.cpp|62|warning: unused variable 'dims' [-Wunused-variable]|
||=== Build finished: 1 errors, 1 warnings (0 minutes, 0 seconds) ===|
This is not a C++ forum; this is an OpenGL forum. Your questions show that you don’t understand the language very well. So please go back to learning C++; once you understand how to use pointers and how to access members of pointers, as well as other basic C++ concepts, then you can move on to graphics programming.