View Full Version : glimg image dimesions

05-15-2013, 09:21 PM
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.

Alfonse Reinheart
05-15-2013, 09:45 PM
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 (http://glsdk.sourceforge.net/docs/html/classglimg_1_1_image_set.html). Are you asking how to use that object? Because that seems self evident (http://glsdk.sourceforge.net/docs/html/structglimg_1_1_dimensions.html); it's a struct that has members which are publicly accessible.

05-16-2013, 02:34 PM
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.

Alfonse Reinheart
05-16-2013, 07:11 PM
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();

05-17-2013, 02:49 PM
What does the '->' between the imageset and GetDimensions(); represent?

Alfonse Reinheart
05-17-2013, 08:18 PM
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.

05-18-2013, 08:38 AM
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.

after reading about this operator, I realize that I knew what it was, but I have only ever seen it as '.', not '->'.

Alfonse Reinheart
05-18-2013, 09:36 AM
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.

05-18-2013, 05:17 PM
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) ===|

Alfonse Reinheart
05-18-2013, 10:22 PM
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.