Jump to content
  • Advertisement

stororokw

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

3 Neutral

About stororokw

  • Rank
    Newbie

Personal Information

  • Interests
    Art
    Programming
  1. stororokw

    Textures, some work and some doesn't???

    Works fine on my computer. Looks the same as the screenshot i posted.
  2. stororokw

    Textures, some work and some doesn't???

    I get this I also get a runtime error in shader.cpp line 56
  3. stororokw

    Textures, some work and some doesn't???

    I tried both and they render okay.
  4. stororokw

    Textures, some work and some doesn't???

    I took a look at your code from github OpenGLTextureProblem and for me things appear to be working properly. Do you have the version of the code you used to post that last screenshot?
  5. stororokw

    Textures, some work and some doesn't???

    Seems to be a problem with the texture loading. In your texture source file change to the following code: //Not Transparent texture. if (!trans) { glPixelStorei(GL_UNPACK_ALIGNMENT, 1); GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, data)); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); } Another way is to force stbi to use 4 channels so that it aligns to four bytes Texture::Texture(std::string path, bool trans, int unit) { // ... unsigned char *data = stbi_load(path.c_str(), &m_width, &m_height, &m_channels, 4); // ... if (data) { //Not Transparent texture. if (!trans) { GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)); } // ... } //... }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!