OpenGL shaders and inputs

Buddies

There´s some limitation about use of openGL shaders?
In Cg Shaders i got possible shader inputs … and in openGL? Are the same inputs?

Are you sure you want to use openGL shaders? I suggest just using plane Cg. The only reason to use them is if you are doing embedded programming. And if you are doing that you can look them up in source…

I´m not sure.
I buy a big book about OpenGL shaders and i think pratice it in Panda3D. I read a lot about CG shaders and pratice a little. I read cg manual, Panda´s manual about it and other articles but… i can´t feel the spirit of shaders development :smiley: . Today i just see my xbox and think "someday, someday… " :slight_smile:
Maybe i need more time … dont know

Lot of thanx Tree

In GLSL, there are already a big number of variables provided to you by the GLSL language. We don’t provide custom Panda3D-specific inputs, but in general you don’t need those.

Dummy question:

Then i can use all standart OpenGL codes without worry? I can´t did it before, but i´ll try more carefully tonight.

I know i wanna too much but someone can post a very basic code who´s interact with OpenGL (or a link instead)?

Very Thanx

You can use any GLSL shader with Panda3D that you can find on the web. (Note that some of them may require custom inputs, though.)

Thanx but i have another problem. I try to use basic GLSL shader decribe in manual and got this error:

:display:gsg:glgsg(error): An error occurred while compiling shader!
0(1) : error C0000: syntax error, unexpected '<' at token "<"
0(1) : error C0501: type name expected at token "<"
0(1) : warning C7530: OpenGL requires main to return void
0(1) : error C1110: function "main" has no return statement
:display:gsg:glgsg(error): at 413 of c:\panda3d-1.7.0\panda\src\glstuff\glShaderContext_src.cxx : GL error 1281

I´m on windows7, panda-1.7.0, GeForce9600 and Notepad++ to write shader.

My program:

import direct.directbase.DirectStart
from panda3d.core import *
from sys import exit

shaderLoc=["../shaders/vertexBasic.glsl", "../shaders/fragBasic.glsl"]

smile=loader.loadModel("smiley")
smile.reparentTo(render)

shader=Shader.load(Shader.SLGLSL, shaderLoc[0], shaderLoc[1], "")
smile.setShader(shader)


camera.setPos(0,-20,0)
base.disableMouse()
base.setFrameRateMeter(True)
base.accept("escape", exit)
base.run()

Vertex

void main() {
  gl_Position = ftransform();
}

Fragment


void main() {
  gl_FragColor = vec4(gl_Color.g, gl_Color.r, gl_Color.b, 1.0);
}

Some ideas?
Regards

That’s a bug in 1.7.0. The latest buildbot release fixes that.

Ok master. I´ll download it.
Thanx

Buddies

I downloaded the lastest buildbot of Panda and try the same code before. Now i got this message:

:display:gsg:glgsg(error): An error occurred while linking shader program!
Fragment info
-------------
0(2) : error C5052: gl_Position is not accessible in this profile
(0) : error C5052: gl_Vertex is not accessible in this profile

What is this? Whata hell is a profile? :open_mouth:

A profile is a machine language a shader can be compiled to. Best analogy I can think of is it is like coding a program in C++, but it can be compiled for Windows, Linux, Macs, etc. Different profiles support different features.

Thanx David
Everything is run fine now :wink:
My python editor have a bug, a i reinstall it and everything is all right!