Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9232265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:16:23+00:00 2026-06-18T06:16:23+00:00

I am having some issues with textures when using OpenGL 3.3 Core. If I

  • 0

I am having some issues with textures when using OpenGL 3.3 Core.

If I use the compat profile it renders perfectly. I tried to debug by using the glGetError()

It returns an invalid enum after getting a vao. And returns the same during the main loop. But surely thats not the issue? – It woudld be impossible to have an error by that point.

I was under the impressning that calling glGetError() would clear the error so the next call would just show the errors between the two?

My Platform is Windows7 64 with a nVidia GTX580 with driver version 310.70.

For my loading lib I am using glload at the min however I have used GLEW also.
I am using the GLFW to manage the OpenGL context and DevIL to load texures. I am building in VS2010.

Here is a link to my full source. (I have riped everything from my main program out and named variable as logicly as possible)

full source code

Code that mostly likely to cause the problem.

Loading the image with devIL and buffering to the GPU.

void loadImage(const char* imageFile)
{
    ILuint texid; 
    ilGenImages(1, &texid); 
    ilBindImage(texid); 

    ilLoadImage(imageFile);

    int size = ilGetInteger( IL_IMAGE_SIZE_OF_DATA ) ;
    ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE); 


    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1,&textureBuffer);
    glBindTexture(GL_TEXTURE_2D, textureBuffer);

    glTexImage2D(GL_TEXTURE_2D, 
         0, 
         ilGetInteger(IL_IMAGE_BPP), 
         ilGetInteger(IL_IMAGE_WIDTH),
         ilGetInteger(IL_IMAGE_HEIGHT), 
         0, 
         ilGetInteger(IL_IMAGE_FORMAT),
         GL_UNSIGNED_BYTE,
         ilGetData());

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    ilDeleteImages(1, &texid);


}

Render function called from the main loop.

void render()
{
    glUseProgram(program);
    glBindVertexArray(vao);

    glBindBuffer(GL_ARRAY_BUFFER, dataBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementObject);
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,textureBuffer);

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)(8*4));
    glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,0); 

    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glUseProgram(0);
}

Vertex shader

#version 330

layout(location = 0) in vec2 position;
layout(location = 1) in vec2 coords;
smooth out vec2 textureCO;
void main()
{
    gl_Position = vec4(position.x,position.y,0.0,1.0);
    textureCO = coords;

}

Fragment shader

#version 330

out vec4 outputColor;
smooth in vec2 textureCO;
uniform sampler2D texture1;
void main()
{
    vec4 textureColor = texture(texture1, textureCO);
    outputColor = textureColor;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:16:24+00:00Added an answer on June 18, 2026 at 6:16 am

    Regarding the question of getting a GL_INVALID_ENUM, this is a common problem with the GLEW library. It’s documented here on opengl.org. Just clear the error (by calling glGetError, like you say) and then OpenGL error reporting will behave as normal (or more precisely, as you’re expecting).

    As for the texture problem, it may be related to the call to ilGetInteger(IL_IMAGE_BPP). In core profiles, the internal format may only be one of the specified image formats, while according to the DevIL documentation, ilGetInteger(IL_IMAGE_BPP) returns an integer value of the number of bytes per pixel. glTexImage*D under compatibilty mode will accept values of 1, 2, 3, or 4 for the internal format, but those values will also generate a GL_INVALID_VALUE error under a core profile.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a videogame in Android using OpenGL ES. I'm having some issues with
Im having some issues with deleting an entry from mongo DB. Im using node-mongodb-native
I am relatively new to OpenGL and I am having some issues when I
Having some issues deploying this. I've tried to deploy it twice now. Here's what
Just having some issues with building a function using nodeJS. It doesn't seem to
After having some issues using OpenSSL and gSOAP, I have been looking into the
I'm having issues trying to get a texture loaded into VRAM. I'm using OpenGL
I'm having some issues with the StdClass() object in PHP.. I'm using it to
I'm having some issues with the Facebook Like and Send button. I'm using XFBML
I am having some issues editing my code to use the PHP foreach function.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.