i have some glReadPixel code that's giving me a linking error - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

i have some glReadPixel code that's giving me a linking error

meligomeligo Posts: 7Member
#include
#include
#include

int main()
{

int aHeight = 100;
int aWidth = 100;

int * pixelDump = 0;

glReadPixels(
0,
0,
aHeight,
aWidth,
GL_RGBA,
GL_UNSIGNED_BYTE,
pixelDump
);

cout << pixelDump;

return 0;
}
Is all I have right now. I'm pretty good at figuring out a lot through examples and reading but I've never had any formal education in programming. I'm attempting to write a program that will function as a macro when I'm finnished. I want it to be able to respond to color changes in a region of pixels and then have the program move and click the mouse and perform some typing, basic macro stuff, and I'm doing so to aid my learning process.

I do however need some help. I read up on a lot of the gl.h lib stuff on the MSDN and came up with this simple few lines to try and test glReadPixel.

I've managed to get rid of my code errors and now am getting this error.
"getPixelsEve.obj : error LNK2001: unresolved external symbol __imp__glReadPixels@28
Debug/getPixelsEve.exe : fatal error LNK1120: 1 unresolved externals"

Please help!
Nic

Comments

  • gautamgautam Posts: 642Member
    Firstly you can't use glReadPixels just like that. You need a GL context for this. Secondly you are having a linker error meaning you didn't specify the compiler to explicitly link opengl.lib.

    Look into http://nehe.gamedev.net for tutorials on how to setup a gl Window and so on.

    Good luck.


    : #include
    : #include
    : #include
    :
    : int main()
    : {
    :
    : int aHeight = 100;
    : int aWidth = 100;
    :
    : int * pixelDump = 0;
    :
    : glReadPixels(
    : 0,
    : 0,
    : aHeight,
    : aWidth,
    : GL_RGBA,
    : GL_UNSIGNED_BYTE,
    : pixelDump
    : );
    :
    : cout << pixelDump;
    :
    : return 0;
    : }
    : Is all I have right now. I'm pretty good at figuring out a lot through examples and reading but I've never had any formal education in programming. I'm attempting to write a program that will function as a macro when I'm finnished. I want it to be able to respond to color changes in a region of pixels and then have the program move and click the mouse and perform some typing, basic macro stuff, and I'm doing so to aid my learning process.
    :
    : I do however need some help. I read up on a lot of the gl.h lib stuff on the MSDN and came up with this simple few lines to try and test glReadPixel.
    :
    : I've managed to get rid of my code errors and now am getting this error.
    : "getPixelsEve.obj : error LNK2001: unresolved external symbol __imp__glReadPixels@28
    : Debug/getPixelsEve.exe : fatal error LNK1120: 1 unresolved externals"
    :
    : Please help!
    : Nic
    :

Sign In or Register to comment.