[QUOTE=robanator1617;44402273]What extension are glsl files?[/QUOTE]
GLSL isn't generally stored in files, but you can use whatever you want, I guess.
.glsl should be fine
[editline]30th March 2014[/editline]
Yeah just use .glsl, at least that'll make it clear they're GLSL
[QUOTE=ArgvCompany;44402244]What is d.n?[/QUOTE]
Dot product of d and n.
EDIT: Thanks for ArgvCompany I've realised I actually invented my issue, and that is the behaviour I should be getting.
[IMG_THUMB] http://i.imgur.com/qRaVpc5.png[/IMG_THUMB]
I'm really confused, I understand when I learn c++, but opengl is confusing, I was told it was a better choice over DirectX, is that true?
[QUOTE=robanator1617;44402314]I'm really trying to understand this, but I don't know what hes doing with the shaders here, do you have any idea? [url]http://open.gl/drawing[/url][/QUOTE]
he/she attached the sources. check them :)
[QUOTE=Pappschachtel;44402351]he/she attached the sources. check them :)[/QUOTE] OH THANKS! I didn't see that!
Nevermind, too late.
Wait so I can just do it like this? :O
[code]
const GLchar* vertexSource =
"#version 150 core\n"
"in vec2 position;"
"in vec3 color;"
"out vec3 Color;"
"void main() {"
" Color = color;"
" gl_Position = vec4(position, 0.0, 1.0);"
"}";
const GLchar* fragmentSource =
"#version 150 core\n"
"in vec3 Color;"
"out vec4 outColor;"
"void main() {"
" outColor = vec4(Color, 1.0);"
"}";
[/code]
[QUOTE=robanator1617;44402490]Wait so I can just do it like this? :O
[code]
const GLchar* vertexSource =
"#version 150 core\n"
"in vec2 position;"
"in vec3 color;"
"out vec3 Color;"
"void main() {"
" Color = color;"
" gl_Position = vec4(position, 0.0, 1.0);"
"}";
const GLchar* fragmentSource =
"#version 150 core\n"
"in vec3 Color;"
"out vec4 outColor;"
"void main() {"
" outColor = vec4(Color, 1.0);"
"}";
[/code][/QUOTE]
As long as you have a sequence of characters in the correct order it doesn't matter how you do it. You can do it like that, you can load it from a file or you can download it over the internet if you really wanted to.
Now I'm getting this error trying to link glew:
[code]
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glDrawElements@16 referenced in function _main
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__wglGetProcAddress@4 referenced in function __glewInit_GL_VERSION_1_2
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__glGetString@4 referenced in function _glewGetExtension@4
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__wglGetCurrentDC@0 referenced in function _wglewGetExtension@4
1>C:\Users\Robbie\Documents\Visual Studio 2013\Projects\Project2\Debug\Project2.exe : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/code]
[QUOTE=robanator1617;44403533]Now I'm getting this error trying to link glew:
[code]
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glDrawElements@16 referenced in function _main
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__wglGetProcAddress@4 referenced in function __glewInit_GL_VERSION_1_2
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__glGetString@4 referenced in function _glewGetExtension@4
1>glew32s.lib(glew.obj) : error LNK2019: unresolved external symbol __imp__wglGetCurrentDC@0 referenced in function _wglewGetExtension@4
1>C:\Users\Robbie\Documents\Visual Studio 2013\Projects\Project2\Debug\Project2.exe : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/code][/QUOTE]
Have you linked opengl32.lib
[QUOTE=esalaka;44403565]Have you linked opengl32.lib[/QUOTE]
yep
EDIT: WAIT WTF. Now its working. I tryed that before, maybe a typed it wrong xD
thanks a lot :)
Having some trouble with a procedure in MySQL
[code]CREATE PROCEDURE CALCULATE_RATING(ID INT)
BEGIN
DECLARE SCORE INT;
DECLARE TOTAL INT DEFAULT 0;
DECLARE AVERAGE INT;
DECLARE DONE INT DEFAULT FALSE;
DECLARE RATINGS CURSOR FOR
SELECT `RATING`
FROM `REVIEWS`
WHERE `BOOK_ID` = ID
AND `APPROVAL`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE = TRUE;
OPEN RATINGS;
LOOP1:LOOP
FETCH RATINGS INTO SCORE;
IF DONE
THEN
LEAVE LOOP1;
END IF;
SET TOTAL := TOTAL + SCORE;
END LOOP;
SET AVERAGE := TOTAL / RATINGS%ROWCOUNT;
CLOSE RATINGS;
UPDATE `BOOK_INVENTORY`
SET `AVG_RATING` = AVERAGE
WHERE `ID` = ID;
END//[/code]
I get this error when it runs
[code]1054: Unknown column 'RATINGS' in 'field list'[/code]
Probably doing something dumb, anyone know what's wrong?
[QUOTE=Bazkip;44403687]Probably doing something dumb, anyone know what's wrong?[/QUOTE]
Using stored procedures could classify as a dumb thing. Reconsider if it's necessary.
The issue might lie here:
[code]
DECLARE RATINGS CURSOR FOR
SELECT `RATING`
FROM `REVIEWS`
WHERE `BOOK_ID` = ID
AND `APPROVAL`;
[/code]
And:
[code]
UPDATE `BOOK_INVENTORY`
SET `AVG_RATING` = AVERAGE
WHERE `ID` = ID;
[/code]
Unless your column and table names are all in uppercase, you should probably correct their capitalization.
[QUOTE=Alternative Account;44404106]Unless your column and table names are all in uppercase, you should probably correct their capitalization.[/QUOTE]
Isn't it not case-sensitive? I did it anyways and there was no change.
[editline]Fuck MySQL[/editline]
Turns out %ROWCOUNT isn't a thing in MySQL. Why are so many things missing from MySQL. It's fucking trash. I don't understand why anyone uses it.
(New guy here)
I'm trying to learn python3 and have been messing around with command prompt output. However I was looking to add colors to the cmd prompt and from everything I've seen, there are almost no libraries that support it on windows (such as curses, blessings, etc). I was trying to get close to something that can help me achieve a look similar to this:
[img_thumb]http://jeffquast.com/blessed-weather.png[/IMG_thumb]
From what I've seen almost every Python 3 library does not have much support for Windows (if any)
Windows' stock command prompt (cmd.exe) does not support giving individual characters different colors. I think it also doesn't support curses-like text-based user interfaces in the slightest, but I might be wrong on that.
[QUOTE=Alternative Account;44412564]Windows' stock command prompt (cmd.exe) does not support giving individual characters different colors. I think it also doesn't support curses-like text-based user interfaces in the slightest, but I might be wrong on that.[/QUOTE]
You can colour per character, but you can only use two colours in every character slot - foreground and background.
The palette is also really limited.
[QUOTE=Gerkin;44407134](New guy here)
I'm trying to learn python3 and have been messing around with command prompt output. However I was looking to add colors to the cmd prompt and from everything I've seen, there are almost no libraries that support it on windows (such as curses, blessings, etc). I was trying to get close to something that can help me achieve a look similar to this:
[img_thumb]http://jeffquast.com/blessed-weather.png[/IMG_thumb]
From what I've seen almost every Python 3 library does not have much support for Windows (if any)[/QUOTE]
Use Get/SetConsoleScreenBufferInfoEx() to change the colors of the palette, as well as other aspects of the console, but you can only have 16 different colors on the screen at any given time.
Brush up on the [url=http://msdn.microsoft.com/en-us/library/ms682087%28v=vs.85%29.aspx]Windows API[/url], apparently you can use it from Python. I even made a little test program that should compile. Note that this won't work on XP as you have to use [url=http://code.google.com/p/andrew-grechkin/source/browse/trunk/MinCE/src/setconsoleinfo.cpp?spec=svn23&r=23]undocumented API[/url] for it.
[code]
#include <windows.h>
#include <stdio.h>
int main()
{
// Get console information.
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFOEX csbiex;
GetConsoleScreenBufferInfoEx(hStdOut, &csbiex);
// Create a red gradient palette.
for (int color = 0; color < 16; color++)
csbiex.ColorTable[color] = color * 0x110000;
SetConsoleScreenBufferInfoEx(hStdOut, &csbiex);
// Spit out a string using above palette. This can be done in many ways with
// a combination of the Windows API and the C/C++ standard library.
char* string = "Hello Facepunch!";
for (int color = 0; color < 16; color++)
{
SetConsoleTextAttribute(hStdOut, color);
printf("%c", string[color]);
}
// It's good practice to close your handles, even though any handles
// associated with a process automatically close when that process terminates.
CloseHandle(hStdOut);
return 0;
}
[/code]
Hey guys, pretty goddamn new to programming so expect this post to make you laugh. Or cry. Anyway, I need to be able to find the (x,y) position along a map's border that is the absolute closest to a point within the map.
So far I've come up with this:
[t]http://i.imgur.com/Q79uaB0.png[/t]
Where "startPos" is the point along the boundary and "self" is the point within the map.
Before I begin even trying to actually write this into a function, I wanted to know if you guys had any better methods, general suggestions, insults, etc. The prospect of this scares me, as the only path I can come up with myself is a horrible mess of if-then-else statements to find the quarter the point is in. I know that isn't ideal.
Language is C# if that matters much.
[QUOTE=Tark;44417938]Hey guys, pretty goddamn new to programming so expect this post to make you laugh. Or cry. Anyway, I need to be able to find the (x,y) position along a map's border that is the absolute closest to a point within the map.
So far I've come up with this:
[t]http://i.imgur.com/Q79uaB0.png[/t]
Where "startPos" is the point along the boundary and "self" is the point within the map.
Before I begin even trying to actually write this into a function, I wanted to know if you guys had any better methods, general suggestions, insults, etc. The prospect of this scares me, as the only path I can come up with myself is a horrible mess of if-then-else statements to find the quarter the point is in. I know that isn't ideal.
Language is C# if that matters much.[/QUOTE]
Unless I'm missing something, can't you just compare the distance from the point to the 4 edges in a straight line and choose the lowest distance?
Can I assign a hotkey inside the Git Shell? So I can do stuff like
cls ; make ; ./bin/Executable.exe
with one keypress? I asked on Super User but I got a reputation-whoring non-answer.
[QUOTE=Number-41;44420391]Can I assign a hotkey inside the Git Shell? So I can do stuff like
cls ; make ; ./bin/Executable.exe
with one keypress? I asked on Super User but I got a reputation-whoring non-answer.[/QUOTE]
I don't believe there is a way to make a shortcut with one hotkey, you could try using an alias instead.
[editline]1st April 2014[/editline]
Or you could make a keyboard macro
[QUOTE=Bumrang;44418009]Unless I'm missing something, can't you just compare the distance from the point to the 4 edges in a straight line and choose the lowest distance?[/QUOTE]
hahahaha damnit that'd totally work, oh well, thanks!
I need someone who is good with C++ to help me, I am sincerely fucked. I've been trying to do this uni lab for 2 weeks its just a simple fucking program to draw a polygon with 3 vertices and it just won't fucking work. My clipping method returns a huge fucking array of points that weren't even defined, and nothing is working. I needed it done by this Thursday but at this rate I won't have it done ever and I absolutely need it done or I'm going to fail this subject tomorrow.
[QUOTE=Pat.Lithium;44425681]I need someone who is good with C++ to help me, I am sincerely fucked. I've been trying to do this uni lab for 2 weeks its just a simple fucking program to draw a polygon with 3 vertices and it just won't fucking work. My clipping method returns a huge fucking array of points that weren't even defined, and nothing is working. I needed it done by this Thursday but at this rate I won't have it done ever and I absolutely need it done or I'm going to fail this subject tomorrow.[/QUOTE]
You can add me on steam, I'm not sure if I would be able to help you out (been a bit busy with school [sp]and dota 2[/sp] lately) but I pretty much only use c++ and graphics stuff.
You can also come into the Facepunch Programmers chatroom (check on my profile, it's the featured group), we have a lot of people who also do c++/graphics stuff.
Anyone has a efficient way to dynamically build a menu structure from a string?
So for example "Menu/Option A/Option B" would result in:
Menu
Option A
Option B
So far i just have a bunch of foreach loops, and i can't get it to option B :f
Not quite programming related, but can someone tell me why the GitHub Windows app removed most of my Spotify song info project when I tried to add it as a repository? It only left the compiled exe and the require DLLs with it.
I was able to have Dropbox recover the files but fuck GitHub if it does this.
In c++ I ask for a name input, name may contain any kind of character; however it should start with a letter belongs to English alphabet. How would I check this? I can't figure it out.
[editline]3rd April 2014[/editline]
In other words, how can I check if the user actually entered a string, not an integer.
[editline]3rd April 2014[/editline]
In other words, how can I check if the user actually entered a string, not an integer or a character.
So I'm having a problem with OO in Lua. Inheritance is defined like this:
[lua]
function Entity:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
[/lua]
and my Particle class is defined like this:
[lua]
Particle = PhysObj:new({w = 16, h = 16, decay = 5})
function Particle:init()
self:setVel(math.random(-5, 5), math.random(-5, 5))
self:setColor(math.random(0, 255), math.random(0, 255), math.random(0, 255), 255)
end
function Particle:think(dt)
self:setA(self:getA() - dt / 5)
if self:getA() <= 0 then
self:remove()
end
end[/lua]
However, whenever I try to create a new Particle, every particle behaves the same and accesses the same variables(they all decay at once instead of in succession):
[lua]local particle = Particle:new()
particle:enable()
particle:setPos(self:getX(), self:getY())[/lua]
Why? And how can I make each new Particle independent of itself?
Anyone have a good tutorial on swing for java? I'm getting sexually frustrated with the Oracle one.
Sorry, you need to Log In to post a reply to this thread.