Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / C++ / C# - Error loading vertex shader (C++ and DX111)

Author
Message
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 15th May 2012 17:52
Hi!

I'm trying to render a simple 2d triangle. The code I've written compiles and executes fine. But the call to CompileD3DShader returns false causing a message box saying "Error loading vertex shader!" as you can see in the code below.

Implementation of the LoadContent function:



Implementation of CompileD3DShader



My shader code looks like this



What could be wrong? I'm new to DirectX programming

BEST!

www.memblockgames.com
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 17th May 2012 02:24 Edited at: 17th May 2012 02:24
Shouldn't the vertex return the world coordinates?

Like this:


EDIT: Other than that, I see no obvious problems with your code. Sorry I can't help more.

mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 17th May 2012 23:36
Hmmm,,,, you might have a point there. Thanks! I'll try it out!

www.memblockgames.com
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 18th May 2012 23:50
Hi, I did'nt try what you suggested because hen I tried to compile and runthe code that accompanies the book I'm reading (My code is just a follow along when I read the chapter) it runs, and displays the solid green triangle as it should.

I deleted my shader file, and copied over the authors file to my project and now my app runs without the 'could not compile vertex shader message' but it does not display the triangle. Insted ehen i quit the app I get a bunch of D3D11 warnings in the output window that does'nt make sence to me



I'm using Visual c++ 2010 express

www.memblockgames.com
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 22nd May 2012 00:54
Hello again,,,

Now it woeks! I had completely forgotten the pixel shader code in the //shader loading code// section (No wonder that I could'nt see the triangle)

But I'm still getting all the STATE_CREATION WARNINGS as shown above. I googled it and found someone else getting there warnings and he had a reply where that user said that it seems like he's calling delete on invalid pointers (Release is a method on DX objects that does the same thing) I've been searching thru all my code like mad but I cannot see that i call release on some invalid pointers. And I've also compared my code to the one the author of the book wrote and I see no differences. He's code works fine without getting the warnings.

I have also tried in my main.cpp to not create an object of my class, but just render the surface with just a background color and it works without the warnings. But something must be wrong. I just don't know what

www.memblockgames.com
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 22nd May 2012 02:26
IIRC, those warnings mean that you did not call Release() on everything you created before exiting.

Login to post a reply

Server time is: 2026-06-11 09:55:32
Your offset time is: 2026-06-11 09:55:32