开发者

How would i be able to use GLU_RGBA or other GLU_ parameters?

hey i have yet another question. There isnt much information involved but i noticed that even though i have libglu32.a linked, and the glu.h included, im still not ablt to use GLU_ parameters

Im wondering how that is not so. would anyone have any ideas?

if any code is needed please comment and i will respond quickly.

Also, My IDE is CodeBlocks with 开发者_StackOverflowMinGW as the compiler on windows 32 bit.


glu is not part of OpenGL. It's an auxiliary library to OpenGL, but the tokens from GLU make no sense if passed to pure OpenGL functions. Or in layman's terms: If you want to use a token beginning with GLU_... you've to pass it to functions prefixed glu....


It appears that you're getting GLU confused with GLUT. There is no GLU_RGBA, but there is a GLUT_RGBA that's passed when creating the display window.


This not so much an answer but a comment on your code. I see, that you're using SFML as framework. SFML internally uses OpenGL, and sf::Image is backed by an OpenGL texture. Or in other words: There's no need to create an OpenGL texture from a sf::Image on your own. Actually SFML takes care everything is properly set up for using an image as OpenGL texture.

In your code you have this:

GLuint LoadTexture(sf::Image image)
{
    GLuint Texture;
    glGenTextures(1, &Texture);
    glBindTexture(GL_TEXTURE_2D, Texture);
    gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA,image.GetWidth(),image.GetHeight(), GL_RGBA,GL_UNSIGNED_BYTE,image.GetPixelsPtr());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    return Texture;
}

You don't need this function at all. All you've to do is image->Bind() instead of LoadTexture(image), becase there is a texture already. Just take a look at the code of sf::Image http://www.sfml-dev.org/documentation/1.6/Image_8cpp-source.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜