Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: glimg image dimesions

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    18

    glimg image dimesions

    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.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    18
    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.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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:

    Code :
    glimg::Dimensions dims = imageSet->GetDimensions();

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    18
    What does the '->' between the imageset and GetDimensions(); represent?
    Last edited by Ygyaxthe3rd; 05-17-2013 at 06:40 PM.

  6. #6
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    18
    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 '->'.
    Last edited by Ygyaxthe3rd; 05-18-2013 at 09:04 AM.

  8. #8
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

  9. #9
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    18
    When I try using

    Code :
    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:

    Code :
    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) ===|

  10. #10
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •