[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 39
File: 1456638606389.jpg (160 KB, 1231x505) Image search: [Google]
1456638606389.jpg
160 KB, 1231x505
Previous thread: >>53714324

What are you working on, /g/?
>>
>>53721251
BIG
>>
>>53721319
GUY
>>
>>53721330
FOR YOU
>>
>>53721251
I'm making a chess engine
>>
>>53721251
I'm making a "bot" that monitors tasks for this repo I manage on Asana and posts them on GitHub as issues. Fairly purposeless but fun and I also like github more for these so this is a work around that doesn't inhibit my team. Written in C.
>>
File: php masterrace.png (2 MB, 1598x1585) Image search: [Google]
php masterrace.png
2 MB, 1598x1585
>>53721251
>>
How do i go from C++ command line to gui with qt?
>>
>>53721362
Same, how far did you get? I've completed non-sliding piece move generation, moving on to sliding piece move generation soon.

Maybe our engines can play against each other when they're done.
>>
Why is Java programming so difficult I don't understand it
>>
>>53721382
Just Google some Qt tutorials and work from there. There's no magic to learning a library/framework/etc., you just have to read the docs and some sample code then get started with your code.
>>
>>53721530
Oh wow, then you must be really special, since java was made for retards, by retards, with retards
>>
File: pysoccer.webm (614 KB, 1920x1080) Image search: [Google]
pysoccer.webm
614 KB, 1920x1080
Working on a turn based python soccer game.
>>
>>53721654
woah...
>>
>>53721654
turn based soccer..
that will be interesting..........
>>
>>53721686
I hope.
>>
GUYS WHAT MEME LANGUAGE SHOULD I USE?
>>
>>53721731
C is the best meme language desu senpai.
>>
>>53721731
How can i know if a programming language is a meme?
>>
Working on my file server with torrent support. I've finally tagged the source as 0.1.
https://gitgud.io/0xBA5/matcha
>>
>>53721751
It's a shit meme language, but it's definitely memetic.
>>53721812
Is the language turing-complete? Does it include experimental/academic-tier features? Does it have a small but dedicated fanbase? If yes to all of these, it's a meme. C and some others are memetic because of their rabid fanbase alone, though.
>>
My larger projects are unmanageable. What easy and robust design patterns should I use in c++?
>>
Sorry to meme here /g/ I need some help.

So I downloaded all 40 gigs of the Gentoomens Library, a friend gave me the magnet. I've always been a Wincuck for the sake of steam gaymes/ease of use with random shit/I got a version of Wincuck10 that has cortana partially disabled and no updates (implying less NSA, I know, but it helps ease my mind a bit).

Thing is, I just want to into Software Dev. I got a new job and I noticed about 10 peoples work could be replaced by one program, I could probably write something in Java that could do the job desu famalamo. I'm also extremely lazy, programming is a way for me to make passive income from what I've been reading, at that would let me be a NEET full time.


REAL QUESTION:
What do I learn to make apps that Normans will buy? Just stick with Java?
>>
>>53721731
Nim
>>
File: ebinm8.gif (546 KB, 255x255) Image search: [Google]
ebinm8.gif
546 KB, 255x255
>>53721980
Ebin buzzwords my friendo
>>
>>53721980
>a friend gave me the magnet
a google search is always your friend
>>
Java programmers are Indians.
>>
>>53721623
>Says a guy who can't program
>>
>>53721510
Gonna start with move generation soon. I will have more time to work on it in a week or so.
>>
>>53721816
Cool work man, wish I was competent enough to give you technical feedback.
>>
>>53721530
whats so hard about it anon
>>
>>53722182
What language are you using?
>>
>>53721654
fuck id love to do something like this
>>
>>53721623
>fox and the grapes
>>
>>53722305
Then do it, nothing's stopping you.
>>
>>53722305
Why don't you do something like it?
>>
What am I doing wrong?
//truncate groups of 2x2 pixels to the value of the topleft most pixel
for (int i = 0; i < bmp_height; i += 2)
{
for (int j = 0; j < bmp_width; j += 2)
{
*((pixel_ptr * i) + (j + 1)) = *((pixel_ptr * i) + j);
*((pixel_ptr * (i + 1)) + j) = *((pixel_ptr * i) + j);
*((pixel_ptr * (i + 1)) + (j + 1)) = *((pixel_ptr * i) + j);
}

}
>>
>>53722340
Multiplying pointers by integers, for one.
>>
>>53722359
Where? I'm trying to use i and j to add an offset to the pointer and then dereference it.
>>
>>53722380
>pixel_ptr * i
>>
>>53722380
pixel_ptr * i
>>
>>53721843
Why are you so butthurt about C?
>>
>>53722340
Hard to say, but my guess would be that your for loops should start at 1, otherwise you're probably accessing some forbidden memory.

What errors are you getting?
>>
File: can bouncing.gif (930 KB, 509x381) Image search: [Google]
can bouncing.gif
930 KB, 509x381
Writing AI for my loli kidnapping sim. Now you can distract them by throwing things! The green thing is just a debug noise visualizer. The intensity is the loudness of the noise, and green indicates slightly-suspicious. Red=suspicious, blue=not. I have it so that louder noises also drown out quieter ones (if they're below a multiplicative threshold of the loudest noise they hear) so you could mask suspicious noises (screams, etc) with louder noises potentially.
>>
>>53722485
>loli kidnapping sim
I hope you'll go to jail.
>>
>>53722485
.............
>>
>>53722485
Wait... is this related to loli simulator? That old project on agdg?
>>
>>53722485
i saw your posts on agdg back when you started and im impressed youre still making this game. youre still a degenerate though.
>>
>>53722485
so what happens if you succeed?
>>
File: playing doctor (4chan version).gif (2 MB, 509x382) Image search: [Google]
playing doctor (4chan version).gif
2 MB, 509x382
>>53722545

Yes.

>>53722511

That's not very nice!
>>
>>53722558
He has his own perfect, tailored virtual world in which to retire until his clock runs out?
>>
>>53722485
what
>>
File: wandering dungeon.gif (1 MB, 620x453) Image search: [Google]
wandering dungeon.gif
1 MB, 620x453
>>53722558

Succeed in what? Me as the programmer, in making the game? Or the player, succeeding in kidnapping? If the latter, then obvviously you take them back to your rape dungeon. Gif related (but has old graphics)
>>
>>53722485
>you could mask suspicious noises (screams, etc) with louder noises potentially
kek

you really thought this through

fucked up though
>>
>>53722485
oh man, there's a project I thought I would never see again
>>
>>53722561

Cool, I like the can bouncing mechanic. Good luck, lolisim anon!
>>
I've got a real-time websockets game but it seizes up every couple of seconds for no apparent reason. I'm only sending about ~100 B/s to each player and it fucks up with as little as two.

Does anyone have any experience with this?
>>
>>53722602
ps, I'll post the link to it in a few, it's on heroku
>>
>>53722394
>>53722396
It compiles and runs fine when I only have one for loop

int a[10] = {0,1,2,3,4,5,6,7,8,9};
for(int i = 0; i < 10; i++)
printf("%u ", *(a + i));

doesn't have any problems.
>>
>>53722485
>>53722511
ULTIMATE KEK
>>
>>53722579
>>53722561
Are you using an engine?
Also, what can you do in the rape dungeon, other than play farmer?
>>
>>53722561
Did you draw the assets?
>>
>>53722623
You're not multiplying pointers in your example.
>>
>>53722623
>a + i
is fine
>a * i
is not
>>
>>53722668
For what reason though
>>
What's the best editor that can be used with one hand?
>>
>>53722623
This code doesn't multiply pointers, the earlier one did.
What's the supposed semantic of multiplying pointers by integers?
>>
>>53722334
>>53722323
Im a noob and Im putting all my effort into making a .sprx menu for gtav on the ps3. If you dont know what that is look it up. its a mind fuck for me lol
>>
>>53722678
a pointer is an address

ptr * 0 would be null which is forbidden to dereference

ptr * 2 could be some completely irrelevant address
>>
File: 5 skin genes 5x size.png (36 KB, 1320x960) Image search: [Google]
5 skin genes 5x size.png
36 KB, 1320x960
>>53722580

Wait until you get to the genetics and breeding aspects. There's 5 genes for expressing skin tone, 5 for hair colour, and 4 for eye colour (although mostly just 2 of them determine it, HERC2 and GEY, which are mostly what determines blue/green/brown IRL, I did some research on it. the other ones have smaller affects like the amount of collagen present, etc. IRL there more ones but they don't affect it significantly, it's mostly HERC2/GEY.) Then there's some more genes that don't affect the colour of anything, but have various other effects. I even put in a nympho gene for fun.

>>53722636

C++ using a custom engine that uses SFML for drawing.

>>53722649

I drew the old oens you see in this pic and in >>53722579 but the ones in >>53722561
and >>53722485 someone else from AGDG drew for me, although I haven't seen them online for a few months... I hope they're okay and come back!
>>
>>53722688
>Im a noob
You just have to practice. We all start as noobs.
>>
>>53722704
>ptr * 2 could be some completely irrelevant address
What if it isn't?
>>
with open(objfilepath, 'r') as mf:
for line in mf:
path_obj = next(iglob(os.path.join(line, line.strip() + '*')))
obj_stats = os.stats(str(path_obj))


I'm reading filepaths to filenames in
objfilepath
,

when I try to retrieve stats on the files of interest which have been chosen and written in objfilepath - it doesn't let me.

I get error code:

AttributeError: 'module' object has no attribute 'stats'


os.stat basically works by

os.stat('afile.txt')

How can I get it to work with my code?
>>
>>53722710
my sides
>>
>>53722710
Cool. Wish I could draw, then I'd start making a game.
>>
>>53722727
you don't know that

there are no guarantees
>>
>>53722727
Then you have a hard to debug memory access bug in your program.
>>
>>53722729
Use stat instead of stats.
>>
File: vag tearing.png (34 KB, 640x480) Image search: [Google]
vag tearing.png
34 KB, 640x480
Also vaginal/anal circumference/stretching/tearing/etc, pic related.

I also looked a bit into psychology so I've got some minor personality modeling using https://en.wikipedia.org/wiki/Big_Five_personality_traits and also a kind of mood system where lolis have a baseline mood and they'll slowly gravitate towards it but doing actions to them affect it too. I did a log-scale though so that if they're neutral giving them a gift will have a bigger affect, but you'll see diminishing returns once you reach a certain point, to make it harder to just spam gifts. For mood I've got the axes as happiness, relaxation, arousal, seriousness, anger and surprise. I guess relaxation/surprise are kinda related though, but not quite. nervousness doesn't imply surprise, I guess.
>>
Here is the websockets game I mentioned earlier: http://cf-clone.herokuapp.com/

Set your name in the top right corner and then either create a game or join one. Be warned, it lags like shit which is what I'm trying to fix.
>>
>>53722787
Now we're talking.
>>
>>53722762
>>53722776
so
*(ptr + ptr + ptr)

is fine, but
*(ptr * 3)

is not, even though they both imply the exact same thing.
>>
>>53722812
no

*(ptr + offset)

is fine
>>
>>53722812
It's not invalid, but if your machine has 600 memories and your pointer points to memory 400, what the fuck is it going to do when you ask it for memory 800?
>>
>>53722787
>6 years

kill yourself
>>
>>53721654
So Blitzball
>>
>>53722812
No, neither of them is fine.

The only arithmetic operations defined for pointers (and making sense) are:
pointer + integer
pointer - integer
pointer += integer
pointer -= integer
pointer++
++pointer
pointer--
--pointer
pointer1-pointer2
>>
File: park filled with pee 1.png (63 KB, 640x480) Image search: [Google]
park filled with pee 1.png
63 KB, 640x480
Oh, and for the genetics system I also have gene pools for given groups of nationalities which correspond to different probabilities for getting a given gene as the recessive vs dominant allele, and then each nationality besides belonging to a gene pool (of which I have nordic, mid-european, mediteranian-european, hispanic, arabic, african, polynesian, indian, south-east-asian, east-asian) they also contain a list of ~20-50 first and last names to pull from, which I looked up so they're mostly the most popular names in their respective nations/groups.

As you can see form the pic I also added in bladder-mechanics too so lolis can get full bladders and wet themselves, forming puddles on the ground, and the colour of the pee depends on how hydrated they were (I just go by a generic concentration variable, so my Urine struct just has volume and urobilin (thing that causes yellow colour) content.

>>53722845

Not until I finish the game.
>>
>>53722844
virtual memory is a little more complex than that. OS can map memory to any address it wants
>>
>>53722340

Trying to losslessly scale down an image that was nearest neighbor upscaled?
>>
>>53721623
That's a description I would use more for JavaScript imo.
>>
>>53722857
You're my hero
>>
What's the most efficient language to write a web shopping checkout bot in? Need it to be as quick as possible and easy to use a list of proxies with. I was thinking C because it's been my goto lately but I've made some very quick bots with node.

Anything like cheerio for C lang?
>>
File: item choosing GUI.gif (763 KB, 632x475) Image search: [Google]
item choosing GUI.gif
763 KB, 632x475
You can also expand and upgrade the rape-dungeon as well, with the editor shown in this picture. In the future I'm going to make the lolis moods change depending on their surroundings. I already gave them a favourite colour, so I'll just need to calculate an overall oppinion of their mood form that and other favourite things, like whether they like girly, neutral, fancy, etc styles, and overall quality of materials.

>>53722907

Thanks!
>>
>>53722938

How long have you been working on this?
>>
>>53722783
>>53722783
Omfg I'm a retard, I'm literally going to get up first thing tomorrow morning pull my jaw down to the floor, cock my eyes and push my tongue under my bottom lip (belm) and go to the doctors and get my self checked out for down syndrome

Thanks though dude.
>>
>>53722930
Probably piet
>>
>>53722857
Nice game, when is it available and how can I track your progress ?
>>
>>53722938
This should have an isometric view.
>>
>>53722938
how long did it take to reach this stage of development?
>>
>>53722947

I remember this from back when I used to lurk AGDG in the early, early days on /v/.
>>
File: bleedout puddle.gif (3 MB, 620x453) Image search: [Google]
bleedout puddle.gif
3 MB, 620x453
There's also cops as you can see in >>53722857 which will shoot you if you've comiited crimes (which will only be reported if someone sees you do it, or if you do it to a loli and she escapes and tells her parents - the AI so far is pretty simple for that though, periodically they just try and escape back to their bedroom, and if they make it home they tell their parents and all your crimes get reported to the cops, so the next time the cops see you they report your current position to the other cops and everyone does pic related to you)

>>53722947
>>53723000

like 2.5 years, although there have been gaps. I didn't work on it at all from New Year's to May last year, and didn't work on it from New Year's until a week ago this year, plus lots of other gaps.

>>53722970

No.

>>53722963

I have a thread on double-chan's /agdg/ board. Also I posted on this chan's /vg/'s AGDG (amateur game dev general) threads occasionally.
>>
>>53722787
>>53722857
>>53722938
sup lrsp
>>
>>53723035
Funnily enough when I asked that, I didn't know that it was actually some rape game haha, just thought it looked cool.

Although it's not my thing, I've never seen such a dark game, it's really interesting. What was your motivation behind making it?
>>
File: genocide.png (120 KB, 640x480) Image search: [Google]
genocide.png
120 KB, 640x480
>>53723111
>What was your motivation behind making it?

It needed to exist, that is all.
>>
>>53723035
Stop using gifs and use webms
>>
>>53723157
those poor penguins / muslims / black women with long hair!
>>
>>53723181
>>
>>53723157
>It needed to exist, that is all.
I like your style anon
demo when also post webms instead
>>
>>53722787
I find it hard to believe this isn't a joke.. but deep down I know it's not
>>
>>53723207
>no aryans
>>
>>53723258

Wouldn't that be the Noridc (Norwegian, Swedish) or European (English, French, German) pools? Look at them. They look pretty aryan to me.
>>
File: 8kek.jpg (3 MB, 7680x4320) Image search: [Google]
8kek.jpg
3 MB, 7680x4320
>>53722787
>Nationality
>Wearing
kek
>>
>>53723283
Aryans should have white skin, blond hair, blue eyes and noble facial features.
>>
>>53722787
The part I like most about your posts is that unlike literally any other game dev, you actually do at least some research for the features you implement.
>>
>>53723258
>no jews
>>
File: loligen.png (274 KB, 1111x3455) Image search: [Google]
loligen.png
274 KB, 1111x3455
>>53723316

How's that any different from the Nordic pool? I set the probabilities for GEY/HERC2/etc to be very low and same for the dark hair pigmentaiton genes, so they're very likely to be blonde with blue eyes, as you can see in the post...

>>53723332

It's fun to learn about genetics and such though. I even looked up stats for height/weight according to age then did a bit of regression to get some polynomials that approximate it, so I can get semi-realistic baseline heights/weights, then add in other factors. I even found some stats for bladder capacity per gender/age as well as urine flow rates per gender/age, and also the amount of calories required too, then I Just did some LERPing on those. pic related.

I kinda did the same thing for anal/vaginal sizes, but since I was unsuccessful on finding emperial data for that on lolis I had to just kind of make up my own function that took into account various factors (age, weight, puberty progression, etc) and they make sure it matches the stats I was able to find on adult females.

>>53723349

In the game world all the Jews were gassed.
>>
>>53723415
>constants not at the top or in a header
You suck.
>>
>>53723415
Jesus christ
>>
>>53721654
sounds boring
>>
>>53723415
Cool, anon. You have a fine numerical modeling skill.
>>
>>53723438

They have static storage so they're only initialized the first time the method is invoked, and the data is only relevant to the functions I'm storing them inside of, and if you were talking about the constants in the polynomials from the regression they don't really represent anything besides value for beta_i's in the regression, so giving them named constant variables would be silly.
>>
>>53723207
you're a fuckin madman m8
>>
File: itsaprankbro.webm (1 MB, 480x360) Image search: [Google]
itsaprankbro.webm
1 MB, 480x360
>>53721251
can anyone recommend a good introduction website or video on where to start getting into software programming?
>>
>>53723639
http://programarcadegames.com/
>>
>>53723706
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-005-elements-of-software-construction-fall-2011/index.htm
>>
I have finally become good at programming but now I don't know what should I build?
>>
>>53723837
Write a simple chatbot that learns how to speak from what the user types to it.
>>
File: 1458894854059.jpg (339 KB, 1029x850) Image search: [Google]
1458894854059.jpg
339 KB, 1029x850
How does a program like h2testw work?

Since C's rand function is only a psuedo random generator and you can replicate it's behavior by giving it the same seed value, could I get reliable results if I used rand() initialized with NULL and then kept writing till the disk was full?

And for the verify operation, I reset the rand() function and keep reading until the byte being read no longer matches the output of rand().
>>
File: 349.png (14 KB, 800x600) Image search: [Google]
349.png
14 KB, 800x600
I've been programming for about two years now in Python and C#, and I want to try out some graphics shit.

What's a recommended starting place for 2D and simple 3D graphics, with some effects and shit?
>>
Am currently using the following code to implement input validation.

while (copies1 < MIN_COPY || copies1 > MAX_COPY)
{
cout << "That is outside of the valid range.\n";
cout << "Please enter a number between 1 - 30: ";
cin >> copies1;
}


How to further refine this to deny inputs with letters or symbols? As it is now if I accidentally enter "23e" instead of 23 the program continues, yet then at a certain point enters an infinite loop. Thanks.
>>
>>53723963
Could look into regex.
>>
>>53723963

Try to cast it into an int and catch the exception.
>>
>>53723924
opengl (v3+ for no ffp). Or play around with shadermonkey.
>>
>>53723924
Monogame is a great framework for C#
>>
>>53723924
OpenGL with GLSL. Make sure you down use an outdated tutorial. If it talks about primitives (glbegin(), pushmatrix() and all that shit) look for one about shaders. Primitives are deprecated.
>>
File: avd uses too much memory.png (180 KB, 1616x719) Image search: [Google]
avd uses too much memory.png
180 KB, 1616x719
Android bros, why is my emulator using so much RAM to start up D:
>>
>>53724069
It's Android.
>>
>>53721731
anything... as long as
B O T N E T
O
T
N
E
T

is the IDE
>>
>>53724006
>>53724046
>>53724056

Alright, cool. I'll check out OpenGL then.
Is the documentation and the tutorials on opengl.org worth checking out, or are there better resources out there?
>>
>>53723996

So

 
cin >> copies1;
static_cast<int>(copies1);


I'm sorry, I have no clue how to cast as I've never needed to implement it before.
>>
>>53724069
>emulator is emulating a phone with 881mb
>why is it using up a gigabyte of memory
Hmmm
>>
File: 1458493763548.gif (3 MB, 444x250) Image search: [Google]
1458493763548.gif
3 MB, 444x250
>>53724124
it used to work fine and now it uses too much, can't even launch my projects
>>
>>53723844
bump
>>
There is literally nothing wrong with BotNet
>>
Writing a microkernel for ARM in pure assembly, I might call it GNU/Turd or some shit
>>
File: explosion gril.jpg (168 KB, 1240x1754) Image search: [Google]
explosion gril.jpg
168 KB, 1240x1754
>>53723844
this was much easier than I thought
$ ./h2testw 
91 76 7E B0 68 85 1F 52 7C 74 Data written, 1073741824 bytes
91 76 7E B0 68 85 1F 52 7C 74 Everything is fine, all bytes read.
>>
File: 311.png (12 KB, 560x407) Image search: [Google]
311.png
12 KB, 560x407
>>53724113

I don't know C++, but an example in Python would be like so
def input_validation(s):
try:
foo = int(s)
return foo
except ValueError:
return -1
>>
>>53724095
>Is the documentation and the tutorials on opengl.org worth checking out
yes
>>
File: abeginning.png (17 KB, 439x280) Image search: [Google]
abeginning.png
17 KB, 439x280
So /dpt/ I've been writing a class system in Scheme. What kind of features should I add?

So far I'm thinking about adding something like Java interfaces and single inheritance. I'm not too knowledgeable about the different kinds of features in non C++/Java shit though because I haven't used a language with OOP outside of those.

>>53724335
Why would you even fucking bother responding if you don't know C++. Maybe I should respond to him with my Scheme code.
>>
>>53724478
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
>>
>>53724335
that's fucking disgusting, i can't believe python shitters defend this garbage
>>
Java professional here will help you with your java homework or assignments
>>
>>53724506
POO
>>
>>53724514
IN
>>
>>53724514
for you
>>
>>53724530
COMPUTER
>>
>>53724478
>Maybe I should respond to him with my Scheme code.
Go ahead. It's not as if the execution for such a simple task is going to vary a fuckload between languages.

>>53724503
What?
>>
>>53724492
Why do you think I have a rainbow parentheses mod anon-kun?
>>
All the Indians at my Software Engineering firm in America they complain all day long about bugs in the code they wrote and then they talk about how they are sending back a lot of their money to help family back home
>>
>>53724567
in a sensible language it's just a simple cast with no exception bullshit needed for such a trivial task
>>
>>53724568
>rainbow parentheses
I like this
>>
>>53724593
You should ask them if their family uses the money to buy toilets.
>>
>>53723996
>>53724113
static_cast doesn't throw exceptions. use std::stoi.

cin >> copies1;

try {
std::stoi(copies1);
} catch (...) {
// oh god everything's fucked
}
>>
Somewhat noobish OpenGL question:
static const GLchar *vertex_shader_src =
"#version 330 core\n"
"layout(location = 0) in vec2 pos;"
"layout(location = 1) in vec3 color;"
"layout(location = 2) in vec2 texcoord;"

"out vec3 vColor;"
"out vec2 vTexcoord;"

"uniform float time;"

"void main()"
"{"
" mat3 rot = mat3("
" cos(time), sin(time), 0,"
" -sin(time), cos(time), 0,"
" 0, 0, 1"
" );"
" mat3 scale = mat3("
" cos(time), 0, 0,"
" 0, cos(time), 0,"
" 0, 0, 1"
" );"
" mat3 trans = mat3("
" 1, 0, -cos(time * 3) / 2.0,"
" 0, 1, sin(time * 3) / 2.0,"
" 0, 0, 1"
" );"

" mat3 mat = rot * scale * trans;"

" gl_Position = vec4((vec3(pos, 1.0) * mat).xy, 0.0, 1.0);"
" vColor = color;"
" vTexcoord = texcoord;"
"}";

I assume this is incredibly wasteful, because it's recomputing the transformation matrix for every vertex.

How can I compute the transformation matrix outside of the vertex shader? I know I can compute it outside of OpenGL, and pass it in as "uniform mat3 mat;" or whatever, but I wanted to know if there was a good way to do this inside OpenGL.
>>
>>53724335

Thanks but I don't know Python so I have no clue how to translate that into C++.
>>
>>53724616

Can you provide an example?
>>
A queue

package body Queues is

procedure Print (Q: Queue_Point) is
begin
if Q /= null then
Text_IO.Put(Integer'Image(Q.Item) & " ");
Print(Q.Next);
else
Text_IO.New_Line(1);
end if;
end Print;

procedure Enqueue (I: Integer; Q: in out Queue) is
Temp: Queue_Point;
begin
if Q.Tail = null then
Q.Tail := new Node'(I, null);
Q.Head := Q.Tail;
else
Temp := new Node'(I, null);
Q.Tail.Next := Temp;
Q.Tail := Temp;
end if;
end Enqueue;

procedure Dequeue (Q: in out Queue) is
Temp: Queue_Point;
begin
if Q.Head /= null then
if Q.Head.Next/=null then
Temp := Q.Head;
Q.Head := Q.Head.Next;
Free(Temp);
else
Free(Q.Head);
end if;
else
Q.Tail := Q.Head;
end if;
end Dequeue;

end Queues;
>>
>>53724568
because you are a fabulous queer who likes pretty colors anon-chan
>>
>>53724626
Probably also helps if you assign the return value of std::stoi() to a variable or something.
>>
>>53724637
You just do, and you pass it in as a uniform.
>>
>Tfw I am so use to programming in Java nothing else feels write and I want to write long verbose code for everything
>>
>>53724648
int result = to_int(x);
if(E_ERR) return 1;
printf("%d\n", result);
>>
>>53724677
So just doing it outside of OpenGL (i.e. on the CPU) is the best way?
>>
>>53724637
You typically send the transformation matrix as a precomputed uniform and then multiply the vertex with it in the program.
>>
>>53724709
Yes. It's either do it on the CPU, do it separately for each vertex, and an unbelievably stupid way (unless you were generating like 100,000 matrices with different parameters at once) would be to do it in a compute shader.
>>
>>53724709
The matrices are so small that just the overhead of sending them to the GPU would outcost performing the operation. You gain with GPUs when your matrices are something like 64x64 or something.
>>
>>53724506
Write a method that abbreviates a string.
>>
>>53724637
generally you should minimize computation and/or memory usage. if the vertices are using the same transformation matrix then it doesn't make sense to compute it for each vertex individually, just pass it as a uniform
>>
>>53724752
Tiny shits like transformation matrices don't even need to be "sent" to the GPU, they can reside in system memory accessible over PCI-E. But good luck controlling that in OpenGL (you need an extension like AMD_pinned_memory).
>>
>>53724705

And what's fundamentally different about this? It seems to me you're catching an exception.
>>
>>53724660
ada hurts my eyes
>>
>>53724752
sure there's an overhead but what if he has a gorillion vertices
>>
>>53724833
I'm just learning by writing toy programs at the moment, so I don't have many vertices.
>>
>>53724860
Then you should be doing the general best practice which is to generate once on the GPU and pass in as a uniform.
>>
>>53724860
>>53724888
*CPU
>>
>>53724833
The transformations are performed in parallel, that's the strength of GPUs to begin with. Actually, I'm wondering if it might not be faster to write an opencl program to do the transform and then pass the handle to the vertex shader, but I think it's all pipelined to begin with and the opencl program would just itself do vec4-wise transforms instead of block-wise. The difference wouldn't be night-and-day if you're not operating on ridiculously detailed geometry.
>>
>>53724901
>Actually, I'm wondering if it might not be faster to write an opencl program to do the transform and then pass the handle to the vertex shader
It would certainly not be.
>>
>>53724860
you should use a uniform, even if it's just to learn

>>53724901
it's not necessarily completely wasteful to do work in the vertex shader, but generally it's reserved for things that apply for the specific vertex and not ALL vertices, and you will be using uniform variables either way
>>
File: better-interfaces-than-java.png (30 KB, 758x297) Image search: [Google]
better-interfaces-than-java.png
30 KB, 758x297
>tfw 12 lines of code and your interface system is already more powerful than Java's
>>
>>53724929
Sure it may be expressive but is it efficient?
>>
>>53724942
is java efficient?
>>
>>53724929
disgusting

>>53724966
compared to lisp is sure as hell is
>>
>>53724822
The syntax highlighting doesn't help
>>
>>53724966
It can be. It precompiles its interfaces.
>>
>>53724928
The transform uniform won't change based on vertex, but actually I seem to recall that opengl (et al.) arranges the work kernel in consequence, and since the value is a uniform, it can be optimized.
>>
>>53724966
Not in the slightest compared to lisp.
>>
How do I get a following on GitHub?
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>53725007
ok that must be why lisp is the #1 programming language... oh wait
>>
>>53725024
Write a good project that is useful to lots of people.
>>
>>53724973
Lol maybe clojure is slow but scheme is pretty fast. Scheme also doesn't run in a vm, so it doesn't have nearly as much startup time or memory usage.
>>
>>53721654
https://www.youtube.com/watch?v=IivUVo4V1Wo
M E S S I M E S S I M E S S I
E
S
S
I

M
E
S
S
I

M
E
S
S
I
>>
>>53725024
Find someone who writes a good project that is useful to lots of people and call them sexist.
>>
>>53724929
How can you do better interfaces than Java, or any other language with interfaces, exactly? They are not a very nuanced concept.
>>
>>53722485

You're still alive ?
Great to hear about you, anyway.
>>
>>53725062
Do you really want that following?
>>
>>53724929
>>53725069
Not to mention that interfaces are kinda meaningless with dynamic typing...
>>
>>53725069
Rather than checking method signature, what I posted allows the user to provide his own checking mechanism.

So in that case I could write a "friendly" interface which checks to see if a procedure called 'greet exists in an object and if 'greet returns a cordial message.
>>
>>53725089
And when is that check done?
>>
>>53724973
>>53725007
>Is Java efficient
One says its horrible compared to Lisp, the other says the opposite. What the fuck.
>>
>>53725088
what? No, that makes them even more useful.
Imagine how many problems interfaces would solve in javascript! No more wacky type dependant behaviour.
>>
>>53725025
>pajeets actually believe java is popular because of its speed
LITERALLY CAN'T MAKE THIS SHIT UP!
>>
>>53725110
Java is objectively bad
>>
>>53725110
java is one of the fastest programming languages

>>53725119
lisp is unpopular because it's generally just shit
>>
File: crisp.png (254 KB, 512x512) Image search: [Google]
crisp.png
254 KB, 512x512
>>53724637
mfw Cfags can't
let vertex_shader_src = [%blob "shaders/vertex_shader.vert"]

>>53725052
>Scheme also doesn't run in a vm, so it doesn't have nearly as much startup time or memory usage.
this is implementation-dependent
>>53725089
kinda misses the point because you can't know these things for sure until run-time
>>
>>53725112
>Imagine how many problems interfaces would solve in javascript
Such as...
>>
>>53725069
See: ocaml.
>>
>>53725138
O C A M L
C
A
M
L
>>
>>53725141
OCaml doesn't need interfaces in the OO sense because of structural typing, though.
>>
>>53725141
>>53725167

Jesus christ, just fucking leave this thread. No one gives half a fuck about your shitty memeguage.
>>
File: 3f8.jpg (36 KB, 600x500) Image search: [Google]
3f8.jpg
36 KB, 600x500
>>53722787
>>
>>53725110
It depends on your lisp. Clojure is run in the JVM and many Scheme interpreters compile to code only a bit slower than C, depending on the task of course. Most interpreters compile to something without a VM so you can have lightweight executables, but others, like Clojure, don't.

>>53725138
That's not a big deal because you have a REPL loop though. It still enforces certain properties, and can enforce more properties than Java enforces.
>>
>>53725186
B U TT H U R T
U
T
T
H
U
R
T
>>
ahh yes a read eval print loop loop
>>
How do i check if a form is visible on C#? And if it's visible, i want it to close and then open again.
Is this right:
if(formOpen.Visible == true){
formOpen.Visible = false;
formOpen.Visible = true;
}
else{
formOpen.Visible = true;
}

[spoiler]It's been awhile and the faq won't teach how do i post in code mode[/spoiler]
>>
>>53725212
>Scheme interpreters compile

Yeah, I'm sure they do just that!
>>
>>53725141
I'll check out Ocaml to see what I can add to my pet class project. Thanks.

>>53725228
The extra loop is the terminal emulator.
>>
Can I run assembly code in a web browser?
>>
>>53725249
>I'll check out Ocaml
Don't, it's a meme. He prowls these threads just to post "MUH OCAML" every time but it will always be a meme, and a shitty one at that.
>>
>>53725251
asm.js
>>
what does it even mean for a language to be a meme

"i don't like it"?
"it looks hard"?
"muh java baby duck syndrome"?
>>
>>53725186
*ahem* i do
>>53725184
interfaces serve the purpose of explicit type signatures and explicitly hiding methods
>>53725212
>That's not a big deal because you have a REPL loop though. It still enforces certain properties, and can enforce more properties than Java enforces.
yes, but in order for you to check that the method returns a certain string, you'd need to first call the method. you could do this whenever a class is created, but if it has side effects your program will run them an extra time. if you wait until it's called, then the tests won't find errors early and there's no reason to use them over normal tests. in java you could do the same with annotations for tests
>>
>>53725132
rajesh pls
>>
>>53725280
Is there any problem with java?
>>
>>53725280
It means it looks cool up front (haskell) but when you actually try to use it for something even slightly non-trivial, its myriad design flaws that prevented it from becoming mainstream bare their teeth and you die.

>>53725292
>this retard doesnt know what JIT is

You're the real rajesh here.
>>
>>53723415
The more posts you make, the less this seems like just some joke which got out of hand...
>>
>>53725306
>JIT
non sequitur
>>
>>53725301
it's pretty much the pinnacle of mediocrity
it doesn't do anything terribly but it also doesn't do anything really well

>>53725306
haskell has a single design flaw and it is laziness by default
ocaml is pretty well-designed, i'd like to hear what you think its flaws are other than opinions like "le FP sux xD"
>>
>>53725278
What about asm.js?
>>
>>53725286
Then that's a limitation of writing code with side effects. Being able to choose what you're testing for is still a big boost in expressiveness over just method signature.
>>
>>53725335

FP does suck though. But JavaScript is as FP as OCaml so it's not a flaw of OCaml, whose real flaw is having god-awful syntax and support
>>
>>53725351
yes
>>
File: bleedout.gif (4 MB, 620x453) Image search: [Google]
bleedout.gif
4 MB, 620x453
>>53725310

Maybe because it isn't? You can find the source code from June's pre-alpha demo on the threads on double-chan's /agdg/. Not sure how much there was there but it's up to ~55KLOC cross ~533 files of C++ plus a bunch of external scripting stuff in loliscript/json/etc. Do you really think someone would go through all that effort for a joke...?
>>
>>53725360
it wasn't designed to have lack of support you idiot, that can't be a design flaw

concrete syntax is subjective and the least important part of any language
>>
>>53725351
It's your "Assembly code" in your web browser. You never specified what "Assembly code" is. If you want to run machine code in your browser, go find an emulator implemented in JS for the CPU.
>>
>>53725335
What about java compatibility? I'm kind of new into programming, but which languages are the ones who do "anything well"?
Or, not war intended, wich language is above the others?
>>
>>53725360
Please use your mouth to speak and your fingers to type. Your anus is not an equivalent replacement.
>>
>>53725377
Not a design flaw but its part of what makes it a meme language.
>>
>>53725186
i want python shitters, jscucks, hasklelers and lispfags to leave. Ctards can stay
>>
>>53725386
OCaml, ATS, Clean, that's about it.
>>
>>53721654
your arcs don't line up properly
>>
>>53725403
I write JS on the frontend and the backend and use libraries like https://github.com/azer/left-pad in almost all my projects. I use python for all my personal projects that are not web-based (but I still use node for some of those), and I like to tinker around with Haskel/OCaml/Lisp and other functional languages for fun. I never touch C. And I will continue to post in this thread until the day I die.
>>
>>53725381
So, you can pretend to run machine code, but no matter what you're going to have to use something like Javascript for any normal browser?
>>
>>53725402
Come back when your favorite meme language java is used to implement even a relevant portion of parsers and compilers, let alone virtually all of them.
Come back when the most popular unikernel is written in your meme language and not ocaml.
Come back when the fastest fft implementation isn't written in ocaml.
Or you could go back to india and remember to poo in the loo.
>>
>>53725403
But I'm a lispfag and a Ctard. Do I stay or do I go?
>>
>>53725441
Most parsers are written in C you fucktard.

>most popular unikernel
This phrase sounds like "best smelling turd"
Thread replies: 255
Thread images: 39

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.