Advertisement Jump to content

OpenGL Loading texture from dds file

Recommended Posts

Hello everyone!

I'm trying to complete OpenGL tutorial

And I faced a problem when loading texture from dds file to my triangle. Here is my code (basically from the tutorial):

Load DDS from file(Texture.cpp):

Vertex shader:

Fragment shader:

dds file:

rendered window:

In main file I call drawing triangle, I call texture.Bind();

Also I tried to manually set uv points in fragment shader, and it seems working(color might be changed based on coordinates). 


If you have any idea, will be really appreciated.



Share this post

Link to post
Share on other sites

Ok, I got an idea. It seems something wrong with uv coordinates.

Because, when I changed one row in vertex shader to 

UV = vertexPosition_modelspace.xy;

I got ugly stretched texture on my triangle.

Maybe I filled buffer in a wrong way.

Share this post

Link to post
Share on other sites

The problem was I created in a separate file another buffer and vertex array object. Here in texture I haven't created such object.

So I need to move this code to the place where vertex array object is bound.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!