[QUOTE=Jookia;38554891][url=http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_New_Face]FT_New_Face[/url] returns a [url=http://www.freetype.org/freetype2/docs/reference/ft2-basic_types.html#FT_Error]FT_Error[/url]. Since you're using FreeType, good luck finding out what the error corresponds to.
Anyway, have you tried using a full path?[/QUOTE]If I use a path at all it doesn't recognize it as one.
[editline]22nd November 2012[/editline]
This is my code now
[cpp] FT_Face face;
if(FT_New_Face(ft, fontName, 0, &face))
{
debug.Print("Could not load font: ");
debug.Print(fontName);
}
switch(FT_New_Face(ft, fontName, 0, &face))
case FT_Error(1):
break;[/cpp]
It's still breaking at another point. The program runs for a few seconds, then breaks. It takes me to here:
[cpp] if ( !req || req->width < 0 || req->height < 0 ||
req->type >= FT_SIZE_REQUEST_TYPE_MAX )
return FT_Err_Invalid_Argument;[/cpp]
Which is in the FT source. So I think this has something to do with the height and width of the face not being available, which is caused by the face not being loaded.
[QUOTE=Meatpuppet;38550701]I'm pretty sure the latest is 150. I got this code on a tutorial for text rendering, and I wasn't sure what the "attribute" and "varying" types are so I couldn't just convert it to version 150.[/QUOTE]
Starting with OpenGL 3.3, they started syncing GLSL versions with OpenGL versions. 330, 400, 410, 420, 430 are newer versions of GLSL than 150.
[QUOTE=Bumrang;38533566]So I've had this one bug that's pretty much stopped my development of anything for the last month or so.
What it is: I have some drawing code for opengl that I created all in main.cpp, to be put into a class later. When I put it in a class it stopped drawing. Nothing could be seen on the screen besides a faint, nearly invisible white box covering the top right corner. More information about it can be found in my [url=http://stackoverflow.com/questions/13226515/code-in-main-cpp-works-but-when-i-put-it-in-a-class-it-doesnt]StackOverflow post.[/url]
I assumed this was a problem with my drawing code so I tried doing the same thing in SFML, surely it would be fixed there?
Nope. Right when I put it in a class, it once again, stopped drawing. This time there is no faint box, there is absolutely nothing.
[url=https://github.com/Bumrang/PongOut/tree/master/src]Here is the code for the OpenGL version.[/url] Mainly look at Ball.cpp, Ball.hpp, and main.cpp.
If anybody wants to see it I can upload the SFML version as well.[/QUOTE]
fixed the SFML version
I was accidentally declaring the variables inside of the constructor so they were destroyed as soon as the constructor finished, oops :v:
still doesn't explain why my opengl version doesn't display anything
e: nvm
Does anyone know of any hocus-pocus magic-maths to do the rotation of tetris blocks?
Assuming all tetraminos consist of a center block which will stay the same position when rotating it and a 3 more blocks all of which are just an offset from the center block
[QUOTE=Richy19;38565491]Does anyone know of any hocus-pocus magic-maths to do the rotation of tetris blocks?
Assuming all tetraminos consist of a center block which will stay the same position when rotating it and a 3 more blocks all of which are just an offset from the center block[/QUOTE]
Take each block and subtract its position from the centre block to get its offset. Then rotate the offset vectors by the required angle like so:
newx = oldx*cos(ang) - oldy*sin(ang)
newy = oldx*sin(ang) + oldy*cos(ang)
then add the new offset to the position of the centre block and you get the new position of the blocks.
[editline]23rd November 2012[/editline]
If you are rotating by 90 degrees, the equations reduce to this:
newx = -oldy
newy = oldx
[QUOTE=MakeR;38565608]If you are rotating by 90 degrees, the equations reduce to this:
newx = -oldy
newy = oldx[/QUOTE]
Why... why have I never realized this? It's so beautiful.
What's a good map editor that can export to .obj (or any similarily common file format)? I'd prefer if it had the ability to work with individual vertices or (even better) some CSG features.
[QUOTE=Meatpuppet;38553554]Need some help. This program is breaking and telling me it's an access violation. Can someone please look through my code and tell me what I'm doing wrong?
Main.cpp:
[url]http://pastebin.com/xSKcct9z[/url]
Text.h:
[url]http://pastebin.com/rRvsUuTS[/url]
Text.cpp:
[url]http://pastebin.com/a23ABPvT[/url]
I'm probably doing something terribly wrong. If anyone would take the time to just look at this, it would be greatly appreciated.
[editline]22nd November 2012[/editline]
I know the problem lies in the text class, because when the program breaks, it goes to the FT source.[/QUOTE]
Can anyone try to find what's wrong here? I can't really do anything else.
[QUOTE=Meatpuppet;38568462]Can anyone try to find what's wrong here? I can't really do anything else.[/QUOTE]
jesus christ learn how to use your debugger
Hey guys, been making a vector/matrix unit for pascal..
[url]http://pastebin.com/Ysqb3sUc[/url]
..not sure whever its because its so early, but i can't get the (matrix).createScale to work properly..
usage should be;
a := a.createScale(5);
.. i could be going mad however (lines #101 to #124).
any help great, and if anyone can be bothered, a test of some of the functions would be lovely..(done it myself but a fresh pair of eyes is allways usefull).
this is for a school project, thanks
[editline]24th November 2012[/editline]
[QUOTE=Lemmingz95;38569452]Hey guys, been making a vector/matrix unit for pascal..
[url]http://pastebin.com/Ysqb3sUc[/url]
..not sure whever its because its so early, but i can't get the (matrix).createScale to work properly..
usage should be;
a := a.createScale(5);
.. i could be going mad however (lines #101 to #124).
any help great, and if anyone can be bothered, a test of some of the functions would be lovely..(done it myself but a fresh pair of eyes is allways usefull).
this is for a school project, thanks[/QUOTE]
* i apologise for lack of comments, so shoot me...been writing this at light speed for [url]http://pastebin.com/VsmcmDGK[/url] (it works but is messy, kinda neat though)
I don't have a Pascal compiler and it's been years since I used it, but
[code]
function matrix.multiply(b : matrix): matrix;
var i,j,k : integer;
begin
for i := 1 to 4 do
for j := 1 to 4 do
for k := 1 to 4 do
multiply.coord[i,j] := coord[i,k] * b.coord[k,j];
end;[/code]
I don't think this works when your array is [1..16]
[code]constructor matrix.create(
maa, mab, mac, mad,
mba, mbb, mbc, mbd,
mca, mcb, mcc, mcd,
mda, mdb, mdc, mdd : double);
begin
m11 := maa; m12 := mab; m13 := mac; m14 := mad;
m21 := mba; m22 := mbb; m23 := mbc; m24 := mbd;
m31 := mca; m32 := mcb; m33 := mcc; m34 := mcd;
m41 := mda; m42 := mdb; m43 := mdc; m44 := mdd;
coord[1] := @m11; coord[2] := @m12; coord[3] := @m13; coord[4] := @m14;
coord[5] := @m11; coord[6] := @m12; coord[7] := @m13; coord[8] := @m14;
coord[9] := @m11; coord[10] := @m12; coord[11] := @m13; coord[12] := @m14;
coord[13] := @m11; coord[14] := @m12; coord[15] := @m13; coord[16] := @m14;
end;[/code]
Bad pointers
[QUOTE=dajoh;38569146]jesus christ learn how to use your debugger[/QUOTE]
i don't know how
[QUOTE=Meatpuppet;38569840]i don't know how[/QUOTE]
That's why he used the word 'learn'.
-I did something stupid that had nothing to do with this, but the error made it appear as if this was the cause-
It's not loading the font. This
[cpp]FT_Face face;
if(FT_New_Face(ft, "C:/Visual Studio/Projects/OpenGL/arial.ttf", 0, &face)) {
fprintf(stderr, "Could not open font\n");
}[/cpp]
doesn't work. The console prints that it can't load the file.
-snip-
[QUOTE=marvincmarvin;38570377]Would there be any reason I wouldn't be able to access a class inside a parent namespace from a child namespace? ie:
[cpp]
namespace parent {
class foo;
namespace child {
class bar {
public:
foo* name;
};
}
}
[/cpp]
According to MSVC "foo" doesn't exist.[/QUOTE]
Works fine for me with gcc. Try using a fully qualified name?
[QUOTE=Meatpuppet;38570452]It's not loading the font. This
[cpp]FT_Face face;
if(FT_New_Face(ft, "C:/Visual Studio/Projects/OpenGL/arial.ttf", 0, &face)) {
fprintf(stderr, "Could not open font\n");
}[/cpp]
doesn't work. The console prints that it can't load the file.[/QUOTE]
It could be loading the font fine, just not creating the face.
I don't understand why can I do this
[code]char thingo[100];
cin>>thingo //I type in "butts"
[/code]
and it works but not this
[code]
thingo = "butts"[/code]
"butts" is a pointer to a string in memory
I made a framebuffer with argb as color and "depth24stencil8" as renderbuffer.
But how can I use that depth information as a texture now ?
I tried to bind my renderbuffer to "Texture2D" but that doesn't work.
Do I need to copy the depth information into an extra texture somehow?? Wouldn't that be awefully slow?
edit: forgot to mention that the framebuffer is working as intended. I draw the whole scene to it, then render it as a fullscreen quad.
[editline]24th November 2012[/editline]
Got it. You cannot get the texture easily from a renderbuffer.
You have to use a depth-texture!
[code]
depthtexture = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, renderBuffer);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Clamp);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Clamp);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.DepthComponent, width, height, 0, PixelFormat.DepthComponent, PixelType.UnsignedByte, IntPtr.Zero);
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, TextureTarget.Texture2D, depthtexture, 0);
[/code]
If anyone knows a better way, please tell :)
[QUOTE=MakeR;38565608]Take each block and subtract its position from the centre block to get its offset. Then rotate the offset vectors by the required angle like so:
newx = oldx*cos(ang) - oldy*sin(ang)
newy = oldx*sin(ang) + oldy*cos(ang)
then add the new offset to the position of the centre block and you get the new position of the blocks.
[editline]23rd November 2012[/editline]
If you are rotating by 90 degrees, the equations reduce to this:
newx = -oldy
newy = oldx[/QUOTE]
This does the job fine, however its rotating counter-clockwise, if I want to rotate it clockwise would it be:
newx = oldy
newy = -oldx
[QUOTE=Jookia;38573030]It could be loading the font fine, just not creating the face.[/QUOTE]
I don't know why it wouldn't create the face... let me try loading a font with a different filetype
[editline]24th November 2012[/editline]
According to my fantastic debugging skills, it breaks at this line:
[cpp]FT_GlyphSlot glyph = face->glyph;[/cpp]
I have to do a trace of a simple program in MARIE (a very basic example computer).
[quote]
Suppose initially AC = 1000, M[200] = FFFF, PC = 100. trace the fetch execute (instruction) cycle of the following sequence of MARIE instructions using Register transfer notation (similar to Figure 4.14 of your text).
Load 200 //PC = 100 here
Add 200
Jns 300[/quote]
Here is what i have so far, i'm mimicing how they draw it in my textbook
[t]http://i.imgur.com/LutSE.png[/t]
The problem is, in the textbook program the hex contents of memory is listed for 100,101,102... etc. In my program, i am only told that M[200] = FFFF. What happens when i try to access M[101]? Is it just zeroes? Am i right in assuming that?
Here is the values of face:
[cpp]+ face 0xcccccccc {num_faces=??? face_index=??? face_flags=??? ...} FT_FaceRec_ *
[/cpp]
So I guess it's not loading the face.
[editline]24th November 2012[/editline]
automerge
[QUOTE=Richy19;38575519]This does the job fine, however its rotating counter-clockwise, if I want to rotate it clockwise would it be:
newx = oldy
newy = -oldx[/QUOTE]
Yes
In C++ is it possible to have a reference argument that also has a default value?
ie:
[cpp]
WaterCube(glm::vec3 &pos = &glm::vec3(0.0f))
{
//do stuff
}
[/cpp]
[QUOTE=Richy19;38580478]In C++ is it possible to have a reference argument that also has a default value?
ie:
[cpp]
WaterCube(glm::vec3 &pos = &glm::vec3(0.0f))
{
//do stuff
}
[/cpp][/QUOTE]
I don't think so - not if you're creating it like that. If it's a global variable or static instance of a class then it should be alright. Untested.
[QUOTE=mechanarchy;38580661]I don't think so - not if you're creating it like that. If it's a global variable or static instance of a class then it should be alright. Untested.[/QUOTE]
It works fine if the reference is a const, so:
[cpp]WaterCube(const glm::vec3 &pos = glm::vec3(0.0f));[/cpp]
works fine.
Also are these coordinates/indecies correct for a cube? I think so but all its drawing is 1 triangle
[cpp]/*
* 8/---/5
* / /|
* 1/---/4|
* | | /6
* | |/
* 2\---/3
*/
glm::vec3 vec[8];
vec[0] = glm::vec3(-0.5f, 0.5f, 0.5f);
vec[1] = glm::vec3(-0.5f, -0.5f, 0.5f);
vec[2] = glm::vec3(0.5f, -0.5f, 0.5f);
vec[3] = glm::vec3(0.5f, 0.5f, 0.5f);
vec[4] = glm::vec3(0.5f, 0.5f, -0.5f);
vec[5] = glm::vec3(0.5f, -0.5f, -0.5f);
vec[6] = glm::vec3(-0.5f, -0.5f, -0.5f);
vec[7] = glm::vec3(-0.5f, 0.5f, -0.5f);
GLuint index[36];
index[0] = 1;
index[1] = 2;
index[2] = 4;
index[3] = 4;
index[4] = 2;
index[5] = 3;
index[6] = 4;
index[7] = 3;
index[8] = 5;
index[9] = 5;
index[10] = 3;
index[11] = 6;
index[12] = 5;
index[13] = 6;
index[14] = 8;
index[15] = 8;
index[16] = 6;
index[17] = 7;
index[18] = 8;
index[19] = 7;
index[20] = 1;
index[21] = 1;
index[22] = 7;
index[23] = 2;
index[24] = 8;
index[25] = 1;
index[26] = 5;
index[27] = 5;
index[28] = 1;
index[29] = 4;
index[30] = 2;
index[31] = 7;
index[32] = 3;
index[33] = 3;
index[34] = 7;
index[35] = 6;[/cpp]
Sorry, you need to Log In to post a reply to this thread.