Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 0:31
Waldermort30-Aug-07 0:31 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 0:53
Naveen30-Aug-07 0:53 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 0:57
Waldermort30-Aug-07 0:57 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 0:59
Naveen30-Aug-07 0:59 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 1:54
Waldermort30-Aug-07 1:54 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 2:09
Naveen30-Aug-07 2:09 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 2:13
Waldermort30-Aug-07 2:13 
GeneralRe: Debugging a release build Pin
jhwurmbach30-Aug-07 2:20
jhwurmbach30-Aug-07 2:20 
GeneralRe: Debugging a release build Pin
Cyrilix30-Aug-07 20:01
Cyrilix30-Aug-07 20:01 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 20:07
Waldermort30-Aug-07 20:07 
QuestionFileSystemWatcher in C++ - how to stop? Pin
dkwo30-Aug-07 0:05
dkwo30-Aug-07 0:05 
AnswerRe: FileSystemWatcher in C++ - how to stop? Pin
Waldermort30-Aug-07 0:19
Waldermort30-Aug-07 0:19 
GeneralRe: FileSystemWatcher in C++ - how to stop? [modified] Pin
dkwo30-Aug-07 0:25
dkwo30-Aug-07 0:25 
QuestionActive Directory Service Intertface ADsGetObject fails with 80004002 Pin
Killer329-Aug-07 23:45
Killer329-Aug-07 23:45 
QuestionVC6 to VS.NET 2002 Port Errors Pin
Jason Teagle29-Aug-07 23:40
Jason Teagle29-Aug-07 23:40 
AnswerRe: VC6 to VS.NET 2002 Port Errors Pin
KarstenK30-Aug-07 0:43
mveKarstenK30-Aug-07 0:43 
GeneralRe: VC6 to VS.NET 2002 Port Errors Pin
Jason Teagle30-Aug-07 10:09
Jason Teagle30-Aug-07 10:09 
GeneralRe: VC6 to VS.NET 2002 Port Errors Pin
KarstenK30-Aug-07 20:18
mveKarstenK30-Aug-07 20:18 
QuestionGetting some error while using make file... Pin
Yashusid29-Aug-07 23:07
Yashusid29-Aug-07 23:07 
AnswerRe: Getting some error while using make file... Pin
Roger Broomfield29-Aug-07 23:44
Roger Broomfield29-Aug-07 23:44 
GeneralRe: Getting some error while using make file... Pin
Yashusid29-Aug-07 23:54
Yashusid29-Aug-07 23:54 
QuestionOpenGL, GLSL, C++, DLL, Delphi , f...ing mix Pin
Delfistyaosani29-Aug-07 23:05
Delfistyaosani29-Aug-07 23:05 
Hi all!
I wrote something like 3D Engine with Delphi, but I had to use a C++ DLL for loading GLSL shaders, because it seemed impossible to write it on delphi (problem with text files and PCHAR-s)
so, now my DLL or app doesn't crash, but shaders work incorrectly.
Do anyone know what can be the reason?
Here's my DLL (MS Vcpp 6.0)
#include "stdafx.h"<br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <windows.h><br />
#include <string.h><br />
#include <iostream.h><br />
<br />
#include <glew\glew.h><br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
                       DWORD  ul_reason_for_call, <br />
                       LPVOID lpReserved<br />
					 )<br />
{<br />
    return TRUE;<br />
}<br />
<br />
struct TshaderDescribtor<br />
{<br />
int Shader_prog; <br />
int Shader_vert;<br />
int Shader_frag;<br />
char *info;<br />
};<br />
<br />
bool glewinited=false;<br />
<br />
char *textFileRead(char *fn) {<br />
<br />
	FILE *fp;<br />
	char *content = NULL;<br />
<br />
	int count=0;<br />
<br />
	if (fn != NULL) {<br />
		fp = fopen(fn,"rt");<br />
<br />
		if (fp != NULL) {<br />
      <br />
      fseek(fp, 0, SEEK_END);<br />
      count = ftell(fp);<br />
      rewind(fp);<br />
<br />
			if (count > 0) {<br />
				content = (char *)malloc(sizeof(char) * (count+1));<br />
				count = fread(content,sizeof(char),count,fp);<br />
				content[count] = '\0';<br />
			}<br />
			fclose(fp);<br />
		}<br />
	}<br />
	return content;<br />
}<br />
<br />
extern "C"<br />
{<br />
void __declspec(dllexport) __cdecl writeln(char *text,bool endline)<br />
{<br />
	if (endline)<br />
	cout << endl;<br />
	printf(text);<br />
}<br />
<br />
void __declspec(dllexport) __cdecl InitGlew()<br />
{<br />
	 glewInit();<br />
glewinited=true;<br />
}<br />
<br />
<br />
void __declspec(dllexport) __cdecl LoadTextFile(char *fn, char *content) {<br />
    content = textFileRead(fn); <br />
}<br />
<br />
TshaderDescribtor _declspec(dllexport) __cdecl glocLoadShaders(char *vertfile,char *fragfile,int testsize,bool useprog)<br />
{<br />
 TshaderDescribtor tmpshader; <br />
 if (glewinited)<br />
 {<br />
 tmpshader.Shader_vert = glCreateShader(GL_VERTEX_SHADER);<br />
 tmpshader.Shader_frag = glCreateShader(GL_FRAGMENT_SHADER);<br />
<br />
 BOOL fileloaded = true;<br />
<br />
 char * vs;<br />
 char * fs;<br />
<br />
 vs = textFileRead(vertfile);<br />
 fs = textFileRead(fragfile);<br />
<br />
 writeln("vertex shader filename:",true);<br />
 writeln(vertfile,true);<br />
 writeln("vertex shader source:",true);<br />
 writeln(vs,true);<br />
<br />
 writeln("fragment shader filename:",true);<br />
 writeln(fragfile,true);<br />
 writeln("fragment shader source:",true);<br />
 writeln(fs,true); <br />
<br />
 const char * vv = vs;<br />
 const char * ff = fs;<br />
<br />
 glShaderSource(tmpshader.Shader_vert, 1, &vv,NULL);<br />
 glShaderSource(tmpshader.Shader_frag, 1, &ff,NULL);<br />
<br />
 free(vs);free(fs);<br />
<br />
 glCompileShader(tmpshader.Shader_vert);<br />
 glCompileShader(tmpshader.Shader_frag);<br />
<br />
 tmpshader.Shader_prog = glCreateProgram();<br />
 <br />
 glAttachShader(tmpshader.Shader_prog,tmpshader.Shader_vert);<br />
 glAttachShader(tmpshader.Shader_prog,tmpshader.Shader_frag);<br />
<br />
 glLinkProgram(tmpshader.Shader_prog);<br />
 if (useprog)<br />
 glUseProgram(tmpshader.Shader_prog);<br />
 tmpshader.info="AEEEEE! :D";<br />
 } <br />
 else<br />
 writeln("GLEW is not initialized! (did you forget to call 'InitGlew?')",true);<br />
 return tmpshader;<br />
}<br />
}<br />
<br />

and I use it so:
<br />
procedure setshaderparameters(progobj:integer);<br />
begin<br />
    glActiveTexture(GL_TEXTURE0);<br />
    glBindTexture(GL_TEXTURE_2D, texture[8]);<br />
    tex1_loc := glGetUniformLocation(s_prog, 'TextureUnit0');<br />
    glUniform1i(tex1_loc, 0);<br />
<br />
    glActiveTexture(GL_TEXTURE1);<br />
    glBindTexture(GL_TEXTURE_2D, texture[9]);<br />
    tex2_loc := glGetUniformLocation(s_prog, 'TextureUnit1');<br />
    glUniform1i(tex2_loc, 1);<br />
<br />
    efcoe_loc := glGetUniformLocation(progobj,'efcoe');<br />
<br />
    time_loc := glGetUniformLocation(progobj,'TIME_FROM_INIT'); <br />
    glUniform1iARB(tex1_loc,texture[8]);<br />
    glUniform1iARB(tex2_loc, texture[9]);<br />
<br />
<br />
end;<br />
<br />
procedure LoadShaders()<br />
begin<br />
tmpshad:=glocLoadShaders(pchar(cur_dir+'\shaders\toon_vert.txt'),pchar(cur_dir+'\shaders\toon_frag.txt'),1,false);<br />
end;<br />


Thanks "by force" Big Grin | :-D
Questiondouble and long-double Pin
includeh1029-Aug-07 22:18
includeh1029-Aug-07 22:18 
AnswerRe: double and long-double Pin
toxcct29-Aug-07 22:26
toxcct29-Aug-07 22:26 
AnswerRe: double and long-double Pin
jhwurmbach29-Aug-07 23:11
jhwurmbach29-Aug-07 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.