User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: OpenGL Sample not working

12 May 2017, 02:39

Ok, I think I have it. The problem is in this line:
NS_ASSERT(glGetUniformLocation(po, "projectionMtx") <= 255);
Could you please edit the code and tell me the value returned by glGetUniformLocation(po, "projectionMtx") in your machine.

Thanks!
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: OpenGL Sample not working

12 May 2017, 11:45

What kind of exception are you getting when the debugger halts there?
Can you please be more specific? I am only beginer with this, although I am more then beginer in C++. When local debugger start run, I get "SpiningCube.exe has triggered a breakpoint." with options Break or Continue.

Ok, I think I have it. The problem is in this line:
Code: Select all
NS_ASSERT(glGetUniformLocation(po, "projectionMtx") <= 255);
Could you please edit the code and tell me the value returned by glGetUniformLocation(po, "projectionMtx") in your machine.
What I need to edit? You mean delete this
 <= 255
in code?

Whatever I do, program crash and when this line of code is deleted, I get this:
>	SpiningCube.exe!Noesis::Render::GLRenderDevice::CreatePrograms() Line 976	C++
	po	26/*(this value is allways 26)*/	unsigned int
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: OpenGL Sample not working

12 May 2017, 12:01

When I coment all NS_ASSERT code
//NS_ASSERT(glGetUniformLocation(po, "projectionMtx") <= 255);
mPrograms.projectionMtxLocation = (NsInt8)glGetUniformLocation(po, "projectionMtx");
mPrograms.projectionMtxHash = 0;

//NS_ASSERT(glGetUniformLocation(po, "opacity") <= 255);
mPrograms.opacityLocation = (NsInt8)glGetUniformLocation(po, "opacity");
mPrograms.opacityHash = 0;

//NS_ASSERT(glGetUniformLocation(po, "radialGrad") <= 255);
mPrograms.radialGradLocation = (NsInt8)glGetUniformLocation(po, "radialGrad");
mPrograms.radialGradHash = 0;

//NS_ASSERT(glGetUniformLocation(po, "rgba") <= 255);
mPrograms.rgbaLocation = (NsInt8)glGetUniformLocation(po, "rgba");
mPrograms.rgbaHash = 0;
Program run without crash, but I get only blue background window and nothing else.
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: OpenGL Sample not working

12 May 2017, 20:00

Sorry for not explaining correctly. What I need is knowing what glGetUniformLocation() function is returning (leave the rest of code of untouched).
GLint location = glGetUniformLocation(po, "projectionMtx");
printf("%d", location);

NS_ASSERT(glGetUniformLocation(po, "projectionMtx") <= 255);
mPrograms[i].projectionMtxLocation = (NsInt8)glGetUniformLocation(po, "projectionMtx");
mPrograms[i].projectionMtxHash = 0;
I need to know the value of location in your machine (just put a breakpoint after invoking).
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: OpenGL Sample not working

12 May 2017, 20:11

Aha, ok,
location	23724032	int
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: OpenGL Sample not working

12 May 2017, 22:04

Thanks for your collaboration! The following patch should fix your problems:
Index: GLRenderDevice.cpp
===================================================================
--- GLRenderDevice.cpp	(revision 6447)
+++ GLRenderDevice.cpp	(working copy)
@@ -970,20 +970,16 @@
             mPrograms[i].vertexFormat = p.vertexFormat;
             mPrograms[i].object = po;
 
-            NS_ASSERT(glGetUniformLocation(po, "projectionMtx") <= 255);
-            mPrograms[i].projectionMtxLocation = (NsInt8)glGetUniformLocation(po, "projectionMtx");
+            mPrograms[i].projectionMtxLocation = glGetUniformLocation(po, "projectionMtx");
             mPrograms[i].projectionMtxHash = 0;
 
-            NS_ASSERT(glGetUniformLocation(po, "opacity") <= 255);
-            mPrograms[i].opacityLocation = (NsInt8)glGetUniformLocation(po, "opacity");
+            mPrograms[i].opacityLocation = glGetUniformLocation(po, "opacity");
             mPrograms[i].opacityHash = 0;
 
-            NS_ASSERT(glGetUniformLocation(po, "radialGrad") <= 255);
-            mPrograms[i].radialGradLocation = (NsInt8)glGetUniformLocation(po, "radialGrad");
+            mPrograms[i].radialGradLocation = glGetUniformLocation(po, "radialGrad");
             mPrograms[i].radialGradHash = 0;
 
-            NS_ASSERT(glGetUniformLocation(po, "rgba") <= 255);
-            mPrograms[i].rgbaLocation = (NsInt8)glGetUniformLocation(po, "rgba");
+            mPrograms[i].rgbaLocation = glGetUniformLocation(po, "rgba");
             mPrograms[i].rgbaHash = 0;
         }
         else
Index: GLRenderDevice.h
===================================================================
--- GLRenderDevice.h	(revision 6446)
+++ GLRenderDevice.h	(working copy)
@@ -228,10 +228,10 @@
         NsUInt8 vertexFormat;
         GLuint object;
 
-        NsInt8 projectionMtxLocation;
-        NsInt8 opacityLocation;
-        NsInt8 radialGradLocation;
-        NsInt8 rgbaLocation;
+        GLint projectionMtxLocation;
+        GLint opacityLocation;
+        GLint radialGradLocation;
+        GLint rgbaLocation;
 
         NsUInt32 projectionMtxHash;
         NsUInt32 opacityHash;
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: OpenGL Sample not working

12 May 2017, 23:00

Thanks, it looks like working. I can see now Login menu, but there are no cubes (if they should be there) as in D3D11 sample.
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: OpenGL Sample not working

13 May 2017, 00:18

Yes, that's correct. Integration samples are not unified yet. Cool, I will integrate this patch in the next version of Noesis.

Thanks for the feedback!

Who is online

Users browsing this forum: No registered users and 1 guest