Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Cg problem...  (Read 1437 times)
0 Members and 1 Guest are viewing this topic.
Offline hell32.dll

Senior Newbie





« Posted 2008-09-30 12:48:14 »

Hi to all!

i have an problem...
some time ago i use one time, simple Cg vertex shader, with position,color and texcoords, and all works propertly...
but now, i cant initialize my vertex shader Sad

next i will write problems in comments Wink

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
cgProfile = CgGL.cgGLGetLatestProfile(CgGL.CG_GL_VERTEX);
if (cgProfile == CgGL.CG_PROFILE_UNKNOWN
        || cgProfile == CgGL.CG_INVALID_ENUMERANT_ERROR) {

    cgSupport = false;
} else {
//profile will equals int 7001 or CG_PROFILE_VP4

/*
* i have an GeForce 8600 GT and latest nVidia drivers with supporting OpenGL 3
* and CgToolkit 2.1, cg.dll and cgGL.dll i have copy to jre/lib/ext
*/


    cgSupport = true;

    cgContex = CgGL.cgCreateContext();
      cgVertexShader = CgGL.cgCreateProgramFromFile
              (cgContex, CgGL.CG_SOURCE, "CgBasics.cg", cgProfile, "main", null);

// context creates normally
// but:
    try {
        cgVertexShader = CgGL.cgCreateProgramFromStream(cgContex,
                CgGL.CG_SOURCE,new FileInputStream("CgBasics.cg"),cgProfile,"main",null);
    } catch (IOException e) {
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    }

// cgVertexShader will not create even if i use CgGL.CreateProgramFromFile(...)
// result will be equals "null"

    CgGL.cgGLLoadProgram(cgVertexShader);

// and after that step cgVertexProgram will equals null

    cgModelViewProj = CgGL.cgGetNamedParameter(cgVertexShader, "modelViewProj");
}


please help  Undecided

Sorry i'm bad speak English =)
Offline xinaesthetic

Senior Devvie


Medals: 1



« Reply #1 - Posted 2008-09-30 17:25:15 »

Have you tried to retrieve any error messages from Cg?  Prolific calls to a function similar to that below are highly recommended. 

1  
2  
3  
4  
5  
6  
7  
8  
9  
private void checkCgError() {
   int err = CgGL.cgGetError();
     
   if (err != CgGL.CG_NO_ERROR) {
         System.out.println("CG error: " + CgGL.cgGetErrorString(err));
         System.out.println(CgGL.cgGetLastListing(context));
         System.exit(1);
   }
}


It would be nice if there was some equivalent to the DebugGL pipeline to do this automatically after each CgGL call.  Maybe there already is?

edit: come to think of it, I might start using AspectJ for stuff like this.
Offline hell32.dll

Senior Newbie





« Reply #2 - Posted 2008-09-30 19:15:32 »

Oh relly thanx!!! it help..with findind error in a shader Wink

Sorry i'm bad speak English =)
Pages: [1]
  ignore  |  Print  
 
 

 
DesertCoockie (33 views)
2018-05-13 18:23:11

nelsongames (75 views)
2018-04-24 18:15:36

nelsongames (70 views)
2018-04-24 18:14:32

ivj94 (752 views)
2018-03-24 14:47:39

ivj94 (82 views)
2018-03-24 14:46:31

ivj94 (622 views)
2018-03-24 14:43:53

Solater (98 views)
2018-03-17 05:04:08

nelsongames (179 views)
2018-03-05 17:56:34

Gornova (405 views)
2018-03-02 22:15:33

buddyBro (1065 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!